git.iko.soy/typeable/pandoc
on master help sign in
AsciiDoc writers: Add anchors on Div elements.

This partially addresses jgm/pandoc-citeproc#143. It does not use the native asciidoc syntax for citations, but it does get the links to individual citations working.

commit3e079a25bce7165a618f01d2e7625bab4ca33b6b authorJohn MacFarlane <jgm@berkeley.edu> dateSun 13 Dec 2015, 08:56 (11 years ago) parent44120ea
1 file changed+4−1
src/Text/Pandoc/Writers/AsciiDoc.hs+4−1
src/Text/Pandoc/Writers/AsciiDoc.hs+4−1
@@ -253,7 +253,10 @@ blockToAsciiDoc opts (OrderedList (_start, sty, _delim) items) = do
253253blockToAsciiDoc opts (DefinitionList items) = do
254254 contents <- mapM (definitionListItemToAsciiDoc opts) items
255255 return $ cat contents <> blankline
256−blockToAsciiDoc opts (Div _ bs) = blockListToAsciiDoc opts bs
256+blockToAsciiDoc opts (Div (ident,_,_) bs) = do
257+ let identifier = if (null ident) then empty else ("[[" <> text ident <> "]]")
258+ contents <- blockListToAsciiDoc opts bs
259+ return $ identifier $$ contents
257260
258261-- | Convert bullet list item (list of blocks) to asciidoc.
259262bulletListItemToAsciiDoc :: WriterOptions -> [Block] -> State WriterState Doc