diff options
author | defanor <defanor@uberspace.net> | 2017-11-08 13:05:35 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-11-08 13:05:35 +0300 |
commit | 6ca97c245713ea6ba83a3cd1d3c9873bac6bcd99 (patch) | |
tree | 47c4a8b33bfb51942831951573df5a9d566a73e2 /Pancake | |
parent | 1d8a5140e3ce03d9fa6b9c63a6621ab3ab64eb4c (diff) |
Denote headings
Diffstat (limited to 'Pancake')
-rw-r--r-- | Pancake/Printing.hs | 1 | ||||
-rw-r--r-- | Pancake/Rendering.hs | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Pancake/Printing.hs b/Pancake/Printing.hs index 9bc6c81..04d9de6 100644 --- a/Pancake/Printing.hs +++ b/Pancake/Printing.hs @@ -93,6 +93,7 @@ showSexps uri ro = showDenotation :: Denotation -> String showDenotation (Link u) = list ["link", ".", encodeStr $ show u] showDenotation (Math m) = list ["math", ".", encodeStr m] + showDenotation (Heading l) = list ["heading", ".", show l] mergeStyled :: [Styled] -> [Styled] mergeStyled = foldr mergeStyled' [] diff --git a/Pancake/Rendering.hs b/Pancake/Rendering.hs index e88a9ad..0794616 100644 --- a/Pancake/Rendering.hs +++ b/Pancake/Rendering.hs @@ -37,6 +37,7 @@ data Listing = Bulleted data Denotation = Link URI | Math String + | Heading Int deriving (Show, Eq) -- | A styled string. @@ -339,11 +340,10 @@ renderBlock (P.DefinitionList dl) = in mapM_ renderDefinition dl renderBlock (P.Header level attr i) = do storeAttr attr - strings <- readInlines i - storeLines [[""]] - indented $ map (map (Fg Green) . ([fromString (replicate level '#'), " "] ++) - . map (Bold . Underline)) strings - storeLines [[""]] + indented =<< map (map (Denote (Heading level) . Fg Green) + . ([fromString (replicate level '#'), " "] ++) + . map (Bold . Underline)) + <$> readInlines i renderBlock P.HorizontalRule = do st <- get indented [[Fg Black $ |