aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-11-15 22:29:15 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2018-11-15 22:29:15 -0800
commite61d1d0da9692b4695c03b7e9f67028d25181ccc (patch)
tree589814e9da3834c500ac12070b2d8d1c8fe4a16f /src
parent2347babbf0d93d1025cb822d55255dfcd8cb3e57 (diff)
downloadpandoc-e61d1d0da9692b4695c03b7e9f67028d25181ccc.tar.gz
Asciidoc writer: Render Spans using `[#id .class]#contents#`.
See #5080.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/AsciiDoc.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs
index 2f92e93ad..6005187d5 100644
--- a/src/Text/Pandoc/Writers/AsciiDoc.hs
+++ b/src/Text/Pandoc/Writers/AsciiDoc.hs
@@ -479,7 +479,11 @@ inlineToAsciiDoc opts (Note [Plain inlines]) = do
return $ text "footnote:[" <> contents <> "]"
-- asciidoc can't handle blank lines in notes
inlineToAsciiDoc _ (Note _) = return "[multiblock footnote omitted]"
-inlineToAsciiDoc opts (Span (ident,_,_) ils) = do
- let identifier = if null ident then empty else "[[" <> text ident <> "]]"
+inlineToAsciiDoc opts (Span (ident,classes,_) ils) = do
contents <- inlineListToAsciiDoc opts ils
- return $ identifier <> contents
+ if null ident && null classes
+ then return contents
+ else do
+ let modifier = brackets $ text $ unwords $
+ [ '#':ident | not (null ident)] ++ map ('.':) classes
+ return $ modifier <> "#" <> contents <> "#"