diff options
Diffstat (limited to 'src/Secret.hs')
-rw-r--r-- | src/Secret.hs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Secret.hs b/src/Secret.hs new file mode 100644 index 0000000..7b428ce --- /dev/null +++ b/src/Secret.hs @@ -0,0 +1,46 @@ +module Secret +( to_secret +) where + + +{- + - + - Écrit par Hédy GIRAUDEAU + - 27/07/17 + - +-} + + + +import Text.Pandoc +import Text.Pandoc.JSON + + +firstLine :: [Inline] -> ([Inline],[Inline]) +firstLine [] = ([],[]) +firstLine ((SoftBreak) : x) = ([], x) +firstLine (x:q) = ([x] ++ y, z) where (y,z) = (firstLine q) + + + + +to_secret (BlockQuote (Para (Str(first) : inlines) : blocks)) = + Div + ("", ["secret"], []) + ([ + RawBlock (Format "html") + (start_detail ++ start_summary) + ] ++ [Plain $ fLine] ++ [ + RawBlock (Format "html") + (end_summary) + ] ++ [ Plain rest ]++ blocks ++ [ + RawBlock (Format "html") + (end_detail) + ] + ) + where start_detail = "<details>" + start_summary = "<summary>" + end_detail = "</details>" + end_summary = "</summary>" + (fLine, rest) = firstLine inlines + |