aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/RST.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-08-17 16:01:44 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-08-17 16:01:44 -0700
commitd1444b4ecdd7bc2f3b6180ceb2635d51382c4ab8 (patch)
tree516291b660fd34b98bb1ff825936310c6974ae1f /src/Text/Pandoc/Writers/RST.hs
parentb1f6fb4af5e6df40fe72d6224512f60be082a8cd (diff)
downloadpandoc-d1444b4ecdd7bc2f3b6180ceb2635d51382c4ab8.tar.gz
RST reader/writer: support unknown interpreted text roles...
...by parsing them as Span with "role" attributes. This way they can be manipulated in the AST. Closes #3407.
Diffstat (limited to 'src/Text/Pandoc/Writers/RST.hs')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 17f5b3f91..8c941f568 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -439,7 +439,12 @@ inlineListToRST lst =
-- | Convert Pandoc inline element to RST.
inlineToRST :: PandocMonad m => Inline -> RST m Doc
-inlineToRST (Span _ ils) = inlineListToRST ils
+inlineToRST (Span (_,_,kvs) ils) = do
+ contents <- inlineListToRST ils
+ return $
+ case lookup "role" kvs of
+ Just role -> ":" <> text role <> ":`" <> contents <> "`"
+ Nothing -> contents
inlineToRST (Emph lst) = do
contents <- inlineListToRST lst
return $ "*" <> contents <> "*"