~jaro/balkon

ref: 034a323deb9c3858d2396406d7e22410984ba4e6 balkon/test/Data/Text/ParagraphLayout/ParagraphData.hs -rw-r--r-- 3.0 KiB
034a323dJaro Make SpanOptions a separate type. 1 year, 8 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
module Data.Text.ParagraphLayout.ParagraphData
    (arabicFillerParagraph
    ,czechHelloParagraph
    ,emptyParagraph
    ,emptySpanParagraph
    ,loremIpsumParagraph
    ,mixedLanguageLTRParagraph
    ,mixedScriptSerbianParagraph
    ,mixedScriptWordsParagraph
    ,trivialParagraph
    )
where

import Data.Text.ParagraphLayout (Paragraph, ParagraphOptions, SpanOptions(..))
import Data.Text.ParagraphLayout.ParagraphConstruction

-- | Span with text in the Czech language.
cs :: SpanOptions
cs = SpanOptions { spanLanguage = "cs" }

-- | Span with text in the English language.
en :: SpanOptions
en = SpanOptions { spanLanguage = "en" }

-- | Span with text in the Japanese language.
ja :: SpanOptions
ja = SpanOptions { spanLanguage = "ja" }

-- | Span with text in the Serbian language.
sr :: SpanOptions
sr = SpanOptions { spanLanguage = "sr" }

-- | Span with text in no language.
zxx :: SpanOptions
zxx = SpanOptions { spanLanguage = "zxx" }

emptyParagraph :: ParagraphOptions -> Paragraph
emptyParagraph = "x" |<>| "zzzzzzz"

emptySpanParagraph :: ParagraphOptions -> Paragraph
emptySpanParagraph = "xx" |< en~"" >| "zzzzz"

trivialParagraph :: ParagraphOptions -> Paragraph
trivialParagraph = "xxx" |< en~"a" >| "zzz"

-- | Fillter text using the Arabic script.
-- Source: <https://generator.lorem-ipsum.info/_arabic>
arabicFillerParagraph :: ParagraphOptions -> Paragraph
arabicFillerParagraph = "xxxx" |< zxx~"إعلان بأيدي وبغطاء هذه من. عرض غينيا يتمكن واعتلاء في. و فرنسا الثانية وفي, أسر إذ السبب ارتكبها مليارات. فكان الشتاء، ما حتى, غير أن وصغار الأخذ. في الصفحة لهيمنة وتتحمّل وتم, أن أما وبداية الغالي." >| "z"

-- | Fillter text using the Latin script.
-- | Source: <https://www.lipsum.com/>
loremIpsumParagraph :: ParagraphOptions -> Paragraph
loremIpsumParagraph = "xxxx" |< zxx~"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." >| "z"

czechHelloParagraph :: ParagraphOptions -> Paragraph
czechHelloParagraph = "xxxxx" |< cs~"Ahoj, světe!" >| "zz"

mixedScriptSerbianParagraph :: ParagraphOptions -> Paragraph
mixedScriptSerbianParagraph = "xxxxxx" |< sr~"Vikipedija (Википедија)" >| "zzzz"

-- | For testing line breaking on boundaries that are different from script
-- boundaries.
mixedScriptWordsParagraph :: ParagraphOptions -> Paragraph
mixedScriptWordsParagraph = "xxxxxxx" |< zxx~"jjjжжжjjj jjjжжжjjj жжжjjjжжж жжжjjjжжж jжj jжj жjж жjж" >| "zzzzzzzz"

mixedLanguageLTRParagraph :: ParagraphOptions -> Paragraph
mixedLanguageLTRParagraph = "Tak " |< cs~"jsem tady, " >|< ja~"世界!" >| "zzzzzz"