module Data.Text.ParagraphLayout.Rich.ParagraphData
( loremIpsumParagraph
, nestedBoxesParagraph
)
where
import Data.Text (pack)
import Data.Text.Glyphize (Font)
import Data.Text.ParagraphLayout.Internal.BoxOptions
import Data.Text.ParagraphLayout.Internal.ParagraphOptions
import Data.Text.ParagraphLayout.Internal.Rich.Paragraph
import Data.Text.ParagraphLayout.Internal.TextOptions
import Data.Text.ParagraphLayout.Internal.TreeOfTexts
t_ :: TextOptions
t_ = defaultTextOptions
b_ :: BoxOptions
b_ = defaultBoxOptions
rootBox :: TextOptions -> [InnerNode d] -> RootNode d
rootBox opts nodes = RootBox (Box nodes opts)
box :: d -> BoxOptions -> TextOptions -> [InnerNode d] -> InnerNode d
box label boxOpts textOpts nodes = InlineBox label (Box nodes textOpts) boxOpts
text :: d -> String -> InnerNode d
text label contents = TextSequence label (pack contents)
-- | Filler text using the Latin script.
-- Source: <https://www.lipsum.com/>
loremIpsumParagraph :: Font -> ParagraphOptions -> Paragraph String
loremIpsumParagraph font = constructParagraph
(pack "xxxx")
(rootBox t
[ text "text" "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."
]
)
(pack "z")
where
t = t_ { textFont = font, textLanguage = "zxx" }
nestedBoxesParagraph :: Font -> ParagraphOptions -> Paragraph String
nestedBoxesParagraph font = constructParagraph
(pack "prefix")
(rootBox t
[ text "text1" "this paragraph has "
, box "box2" b_ t
[ box "box3" b_ t
[ text "text2" "nested "
]
, text "text3" "boxes"
]
]
)
(pack "suffix")
where
t = t_ { textFont = font, textLanguage = "en" }