diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-06-18 17:49:59 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-06-18 17:49:59 -0700 |
commit | ff6a2baeb9940276fbbaf486a5711378d13cc1e1 (patch) | |
tree | 5eb6dd9d6bf28496860dd1b29a22b01806aa9529 /src/Text/Pandoc/Writers | |
parent | 0d364a284d9a43a419abff94d227ad341ed82c2c (diff) | |
download | pandoc-ff6a2baeb9940276fbbaf486a5711378d13cc1e1.tar.gz |
More polish on Haddock reader/writer.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/Haddock.hs | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/Text/Pandoc/Writers/Haddock.hs b/src/Text/Pandoc/Writers/Haddock.hs index 4d6b8e69f..36f57c2b7 100644 --- a/src/Text/Pandoc/Writers/Haddock.hs +++ b/src/Text/Pandoc/Writers/Haddock.hs @@ -80,22 +80,11 @@ pandocToHaddock opts (Pandoc meta blocks) = do -- | Return haddock representation of notes. notesToHaddock :: WriterOptions -> [[Block]] -> State WriterState Doc notesToHaddock opts notes = - mapM (\(num, note) -> noteToHaddock opts num note) (zip [1..] notes) >>= - return . vsep - --- | Return haddock representation of a note. -noteToHaddock :: WriterOptions -> Int -> [Block] -> State WriterState Doc -noteToHaddock opts num blocks = do - contents <- blockListToHaddock opts blocks - let num' = text $ writerIdentifierPrefix opts ++ show num - let marker = text "[" <> num' <> text "]" - let markerSize = 4 + offset num' - let spacer = case writerTabStop opts - markerSize of - n | n > 0 -> text $ replicate n ' ' - _ -> text " " - return $ if isEnabled Ext_footnotes opts - then hang (writerTabStop opts) (marker <> spacer) contents - else marker <> spacer <> contents + if null notes + then return empty + else do + contents <- blockToHaddock opts $ OrderedList (1,DefaultStyle,DefaultDelim) notes + return $ text "#notes#" <> blankline <> contents -- | Escape special characters for Haddock. escapeString :: String -> String @@ -354,4 +343,4 @@ inlineToHaddock opts (Note contents) = do modify (\st -> st{ stNotes = contents : stNotes st }) st <- get let ref = text $ writerIdentifierPrefix opts ++ show (length $ stNotes st) - return $ "[" <> ref <> "]" + return $ "<#notes [" <> ref <> "]>" |