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 = "
" start_summary = "" end_detail = "
" end_summary = "" (fLine, rest) = firstLine inlines