aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/RST.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-22 16:05:38 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-22 16:05:38 +0000
commit6bb6dd2bfd526fff9a469fddd9515aec268bfe15 (patch)
tree0a6fc064c44a055e86714473b202d1d64a7d5fe6 /src/Text/Pandoc/Writers/RST.hs
parentd03ec5a4a243a80856b53fa0cdf222d8dfdb1dd7 (diff)
downloadpandoc-6bb6dd2bfd526fff9a469fddd9515aec268bfe15.tar.gz
+ Added support for superscript, subscript, and
strikeout to all writers. (Thanks to Bradley Kuhn for the patches for strikeout, here slightly modified.) + Refactored character escaping using the new functions escapeStringUsing and backslashEscapes. + Added state to LaTeX writer, which now keeps track of what packages need to be included in the preamble, based on the content of the document. (Thus, e.g., ulem is only required if you use strikeout.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@755 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers/RST.hs')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index b79ce1d94..479d40b00 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -122,7 +122,7 @@ wrappedRSTSection opts sect = do
-- | Escape special characters for RST.
escapeString :: String -> String
-escapeString = backslashEscape "`\\|*_"
+escapeString = escapeStringUsing (backslashEscapes "`\\|*_")
-- | Convert bibliographic information into RST header.
metaToRST :: WriterOptions -> Meta -> State WriterState Doc
@@ -266,6 +266,15 @@ inlineToRST opts (Emph lst) = do
inlineToRST opts (Strong lst) = do
contents <- inlineListToRST opts lst
return $ text "**" <> contents <> text "**"
+inlineToRST opts (Strikeout lst) = do
+ contents <- inlineListToRST opts lst
+ return $ text "[STRIKEOUT:" <> contents <> text "]"
+inlineToRST opts (Superscript lst) = do
+ contents <- inlineListToRST opts lst
+ return $ text "\\ :sup:`" <> contents <> text "`\\ "
+inlineToRST opts (Subscript lst) = do
+ contents <- inlineListToRST opts lst
+ return $ text "\\ :sub:`" <> contents <> text "`\\ "
inlineToRST opts (Quoted SingleQuote lst) = do
contents <- inlineListToRST opts lst
return $ char '\'' <> contents <> char '\''