~jaro/balkon

ref: 5e218e2739e4175ea58ef98686426d80919e2f64 balkon/test/Data/Text/ParagraphLayout/TextData.hs -rw-r--r-- 2.0 KiB
5e218e27Jaro Test with only directionally neutral characters. 1 year, 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
module Data.Text.ParagraphLayout.TextData
    ( arabicEmpty
    , englishEmpty
    , englishWord
    , arabicHello
    , czechHello
    , serbianMixedScript
    , mixedDirectionSimple
    , arabicAroundEnglish
    , englishAroundArabic
    )
where

import Data.Text (Text, empty, pack)
import Data.Text.Glyphize (Direction (DirLTR, DirRTL))

type Language = String
type DirectionRunLengths = [Int]
type Sample = (Direction, Language, Text, DirectionRunLengths)

arabicEmpty :: Sample
arabicEmpty =
    ( DirRTL
    , "ar"
    , empty
    , []
    )

englishEmpty :: Sample
englishEmpty =
    ( DirLTR
    , "en"
    , empty
    , []
    )

englishWord :: Sample
englishWord =
    ( DirRTL
    , "en"
    , pack "word"
    , [4]
    )

arabicHello :: Sample
arabicHello =
    ( DirRTL
    , "ar"
    , pack "سلام"
    , [4]
    )

czechHello :: Sample
czechHello =
    ( DirLTR
    , "cs"
    , pack "Ahoj, světe!"
    , [12]
    )

serbianMixedScript :: Sample
serbianMixedScript =
    ( DirLTR
    , "sr"
    , pack "Vikipedija (Википедија)"
    , [23]
    )

-- | Source:
-- <https://www.w3.org/International/articles/inline-bidi-markup/uba-basics>
--
-- Used to test the effect of base direction.
mixedDirectionSimple :: Direction -> Sample
mixedDirectionSimple dir =
    ( dir
    , "ar"
    , pack "bahrainمصرkuwait"
    , [7, 3, 6]
    )

-- | Source:
-- <https://www.w3.org/International/articles/inline-bidi-markup/uba-basics>
arabicAroundEnglish :: Sample
arabicAroundEnglish =
    ( DirRTL
    , "ar"
    , pack "في XHTML 1.0 يتم تحقيق ذلك بإضافة العنصر المضمن bdo."
    -- TODO: Should be [3, 9, 36, 3, 1] according to Unicode BiDi.
    , [3, 10, 35, 4]
    )

-- | Source:
-- <https://www.w3.org/International/articles/inline-bidi-markup/uba-basics>
englishAroundArabic :: Sample
englishAroundArabic =
    ( DirLTR
    , "en"
    , pack "The title is مفتاح معايير الويب in Arabic."
    -- TODO: Should be [13, 18, 11] according to Unicode BiDi.
    , [13, 19, 10]
    )