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.
This commit is contained in:
John MacFarlane 2015-12-13 08:56:22 -08:00
parent 44120ea716
commit 3e079a25bc

View file

@ -253,7 +253,10 @@ blockToAsciiDoc opts (OrderedList (_start, sty, _delim) items) = do
blockToAsciiDoc opts (DefinitionList items) = do blockToAsciiDoc opts (DefinitionList items) = do
contents <- mapM (definitionListItemToAsciiDoc opts) items contents <- mapM (definitionListItemToAsciiDoc opts) items
return $ cat contents <> blankline return $ cat contents <> blankline
blockToAsciiDoc opts (Div _ bs) = blockListToAsciiDoc opts bs blockToAsciiDoc opts (Div (ident,_,_) bs) = do
let identifier = if (null ident) then empty else ("[[" <> text ident <> "]]")
contents <- blockListToAsciiDoc opts bs
return $ identifier $$ contents
-- | Convert bullet list item (list of blocks) to asciidoc. -- | Convert bullet list item (list of blocks) to asciidoc.
bulletListItemToAsciiDoc :: WriterOptions -> [Block] -> State WriterState Doc bulletListItemToAsciiDoc :: WriterOptions -> [Block] -> State WriterState Doc