this repo has no description
1module HsBlog.Convert where
2
3import qualified HsBlog.Markup as Markup
4import qualified HsBlog.Html as Html
5
6convert :: Html.Title -> Markup.Document -> Html.Html
7convert title = Html.html_ title . foldMap convertStructure
8
9convertStructure :: Markup.Structure -> Html.Structure
10convertStructure structure =
11 case structure of
12 Markup.Heading n txt ->
13 Html.h_ n $ Html.txt_ txt
14
15 Markup.Paragraph p ->
16 Html.p_ $ Html.txt_ p
17
18 Markup.UnorderedList list ->
19 Html.ul_ $ map (Html.p_ . Html.txt_) list
20
21 Markup.OrderedList list ->
22 Html.ol_ $ map (Html.p_ . Html.txt_) list
23
24 Markup.CodeBlock list ->
25 Html.code_ $ unlines list
26