aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Text/Pandoc/Writers/RTF.hs14
-rw-r--r--tests/writer.rtf64
2 files changed, 39 insertions, 39 deletions
diff --git a/Text/Pandoc/Writers/RTF.hs b/Text/Pandoc/Writers/RTF.hs
index c95c24b2f..d9b3cfd60 100644
--- a/Text/Pandoc/Writers/RTF.hs
+++ b/Text/Pandoc/Writers/RTF.hs
@@ -86,7 +86,7 @@ codeStringToRTF str = joinWithSep "\\line\n" $ lines (stringToRTF str)
-- | Deal with raw LaTeX.
latexToRTF :: String -> String
-latexToRTF str = "{\\cf1 " ++ (stringToRTF str) ++ "\\cf0 } "
+latexToRTF str = "{\\cf1 " ++ (stringToRTF str) ++ "\\cf0 }"
-- | Make a paragraph with first-line indent, block indent, and space after.
rtfParSpaced :: Int -- ^ space after (in twips)
@@ -260,11 +260,11 @@ inlineListToRTF lst = concatMap inlineToRTF lst
-- | Convert inline item to RTF.
inlineToRTF :: Inline -- ^ inline to convert
-> String
-inlineToRTF (Emph lst) = "{\\i " ++ (inlineListToRTF lst) ++ "} "
-inlineToRTF (Strong lst) = "{\\b " ++ (inlineListToRTF lst) ++ "} "
-inlineToRTF (Strikeout lst) = "{\\strike " ++ (inlineListToRTF lst) ++ "} "
-inlineToRTF (Superscript lst) = "{\\super " ++ (inlineListToRTF lst) ++ "} "
-inlineToRTF (Subscript lst) = "{\\sub " ++ (inlineListToRTF lst) ++ "} "
+inlineToRTF (Emph lst) = "{\\i " ++ (inlineListToRTF lst) ++ "}"
+inlineToRTF (Strong lst) = "{\\b " ++ (inlineListToRTF lst) ++ "}"
+inlineToRTF (Strikeout lst) = "{\\strike " ++ (inlineListToRTF lst) ++ "}"
+inlineToRTF (Superscript lst) = "{\\super " ++ (inlineListToRTF lst) ++ "}"
+inlineToRTF (Subscript lst) = "{\\sub " ++ (inlineListToRTF lst) ++ "}"
inlineToRTF (Quoted SingleQuote lst) =
"\\u8216'" ++ (inlineListToRTF lst) ++ "\\u8217'"
inlineToRTF (Quoted DoubleQuote lst) =
@@ -273,7 +273,7 @@ inlineToRTF Apostrophe = "\\u8217'"
inlineToRTF Ellipses = "\\u8230?"
inlineToRTF EmDash = "\\u8212-"
inlineToRTF EnDash = "\\u8211-"
-inlineToRTF (Code str) = "{\\f1 " ++ (codeStringToRTF str) ++ "} "
+inlineToRTF (Code str) = "{\\f1 " ++ (codeStringToRTF str) ++ "}"
inlineToRTF (Str str) = stringToRTF str
inlineToRTF (Math str) = inlineListToRTF $ readTeXMath str
inlineToRTF (TeX str) = ""
diff --git a/tests/writer.rtf b/tests/writer.rtf
index f25303256..603cfb4c8 100644
--- a/tests/writer.rtf
+++ b/tests/writer.rtf
@@ -13,11 +13,11 @@
embedded link
}}}
\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 Level 3 with {\i emphasis} \par}
+{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 Level 3 with {\i emphasis}\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 Level 4\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs20 Level 5\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Level 1\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Level 2 with {\i emphasis} \par}
+{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Level 2 with {\i emphasis}\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 Level 3\par}
{\pard \ql \f0 \sa180 \li0 \fi0 with no blank line\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Level 2\par}
@@ -174,10 +174,10 @@ These should not be escaped: \\$ \\\\ \\> \\[ \\\{\par}
{\pard \ql \f0 \sa0 \li0 \fi0 banana\par}
{\pard \ql \f0 \sa180 \li360 \fi0 yellow fruit\sa180\par}
{\pard \ql \f0 \sa180 \li0 \fi0 Multiple blocks with italics:\par}
-{\pard \ql \f0 \sa0 \li0 \fi0 {\i apple} \par}
+{\pard \ql \f0 \sa0 \li0 \fi0 {\i apple}\par}
{\pard \ql \f0 \sa180 \li360 \fi0 red fruit\par}
{\pard \ql \f0 \sa180 \li360 \fi0 contains seeds, crisp, pleasant to taste\par}
-{\pard \ql \f0 \sa0 \li0 \fi0 {\i orange} \par}
+{\pard \ql \f0 \sa0 \li0 \fi0 {\i orange}\par}
{\pard \ql \f0 \sa180 \li360 \fi0 orange fruit\par}
{\pard \ql \f0 \sa180 \li360 \fi0 \f1 \{ orange code block \}\par}
{\pard \ql \f0 \sa180 \li1080 \fi0 orange block quote\sa180\par}
@@ -188,8 +188,8 @@ These should not be escaped: \\$ \\\\ \\> \\[ \\\{\par}
{\pard \ql \f0 \sa0 \li0 \fi0 foo\par}
{\pard \ql \f0 \sa0 \li0 \fi0 bar\par}
{\pard \ql \f0 \sa180 \li0 \fi0 Interpreted markdown in a table:\par}
-{\pard \ql \f0 \sa0 \li0 \fi0 This is {\i emphasized} \par}
-{\pard \ql \f0 \sa0 \li0 \fi0 And this is {\b strong} \par}
+{\pard \ql \f0 \sa0 \li0 \fi0 This is {\i emphasized}\par}
+{\pard \ql \f0 \sa0 \li0 \fi0 And this is {\b strong}\par}
{\pard \ql \f0 \sa180 \li0 \fi0 Here\u8217's a simple block:\par}
{\pard \ql \f0 \sa0 \li0 \fi0 foo\par}
{\pard \ql \f0 \sa180 \li0 \fi0 This should be a code block, though:\par}
@@ -210,20 +210,20 @@ These should not be escaped: \\$ \\\\ \\> \\[ \\\{\par}
{\pard \ql \f0 \sa180 \li0 \fi0 Hr\u8217's:\par}
{\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Inline Markup\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 This is {\i emphasized} , and so {\i is this} .\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 This is {\b strong} , and so {\b is this} .\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 This is {\i emphasized}, and so {\i is this}.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 This is {\b strong}, and so {\b is this}.\par}
{\pard \ql \f0 \sa180 \li0 \fi0 An {\i {\field{\*\fldinst{HYPERLINK "/url"}}{\fldrslt{\ul
emphasized link
}}}
-} .\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 {\b {\i This is strong and em.} } \par}
-{\pard \ql \f0 \sa180 \li0 \fi0 So is {\b {\i this} } word.\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 {\b {\i This is strong and em.} } \par}
-{\pard \ql \f0 \sa180 \li0 \fi0 So is {\b {\i this} } word.\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 This is code: {\f1 >} , {\f1 $} , {\f1 \\} , {\f1 \\$} , {\f1 <html>} .\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 {\strike This is {\i strikeout} .} \par}
-{\pard \ql \f0 \sa180 \li0 \fi0 Superscripts: a{\super bc} d a{\super {\i hello} } a{\super hello there} .\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 Subscripts: H{\sub 2} O, H{\sub 23} O, H{\sub many of them} O.\par}
+}.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 {\b {\i This is strong and em.}}\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 So is {\b {\i this}} word.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 {\b {\i This is strong and em.}}\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 So is {\b {\i this}} word.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 This is code: {\f1 >}, {\f1 $}, {\f1 \\}, {\f1 \\$}, {\f1 <html>}.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 {\strike This is {\i strikeout}.}\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Superscripts: a{\super bc}d a{\super {\i hello}} a{\super hello there}.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Subscripts: H{\sub 2}O, H{\sub 23}O, H{\sub many of them}O.\par}
{\pard \ql \f0 \sa180 \li0 \fi0 These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.\par}
{\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Smart quotes, ellipses, dashes\par}
@@ -231,7 +231,7 @@ emphasized link
{\pard \ql \f0 \sa180 \li0 \fi0 \u8216'A\u8217', \u8216'B\u8217', and \u8216'C\u8217' are letters.\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \u8216'Oak,\u8217' \u8216'elm,\u8217' and \u8216'beech\u8217' are names of trees. So is \u8216'pine.\u8217'\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \u8216'He said, \u8220"I want to go.\u8221"\u8217' Were you alive in the 70\u8217's?\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 Here is some quoted \u8216'{\f1 code} \u8217' and a \u8220"{\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul
+{\pard \ql \f0 \sa180 \li0 \fi0 Here is some quoted \u8216'{\f1 code}\u8217' and a \u8220"{\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul
quoted link
}}}
\u8221".\par}
@@ -243,16 +243,16 @@ quoted link
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 2+2=4\par}
-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x} \u8201?\u8712?\u8201?{\i y} \par}
+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x}\u8201?\u8712?\u8201?{\i y}\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \u945?\u8201?\u8743?\u8201?\u969?\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 223\par}
-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p} -Tree\par}
-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \\frac\{{\i d} \}\{{\i dx} \}{\i f} ({\i x} )=\\lim{\sub {\i h} \u8201?\u8594?\u8201?0} \\frac\{{\i f} ({\i x} +{\i h} )-{\i f} ({\i x} )\}\{{\i h} \}\par}
-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?+\u969?\u8201?\u215?\u8201?{\i x} {\super 2} .\sa180\par}
+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p}-Tree\par}
+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \\frac\{{\i d}\}\{{\i dx}\}{\i f}({\i x})=\\lim{\sub {\i h}\u8201?\u8594?\u8201?0}\\frac\{{\i f}({\i x}+{\i h})-{\i f}({\i x})\}\{{\i h}\}\par}
+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?+\u969?\u8201?\u215?\u8201?{\i x}{\super 2}.\sa180\par}
{\pard \ql \f0 \sa180 \li0 \fi0 These shouldn\u8217't be math:\par}
-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$} .\par}
-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab $22,000 is a {\i lot} of money. So is $34,000. (It worked if \u8220"lot\u8221" is emphasized.)\par}
-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Escaped {\f1 $} : $73 {\i this should be emphasized} 23$.\sa180\par}
+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$}.\par}
+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab $22,000 is a {\i lot} of money. So is $34,000. (It worked if \u8220"lot\u8221" is emphasized.)\par}
+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Escaped {\f1 $}: $73 {\i this should be emphasized} 23$.\sa180\par}
{\pard \ql \f0 \sa180 \li0 \fi0 Here\u8217's a LaTeX table:\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \par}
{\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
@@ -385,24 +385,24 @@ inline link in pointy braces
.\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Autolinks\par}
{\pard \ql \f0 \sa180 \li0 \fi0 With an ampersand: {\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul
-{\f1 http://example.com/?foo=1&bar=2}
+{\f1 http://example.com/?foo=1&bar=2}
}}}
\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab In a list?\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\field{\*\fldinst{HYPERLINK "http://example.com/"}}{\fldrslt{\ul
-{\f1 http://example.com/}
+{\f1 http://example.com/}
}}}
\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab It should.\sa180\par}
{\pard \ql \f0 \sa180 \li0 \fi0 An e-mail address: {\field{\*\fldinst{HYPERLINK "mailto:nobody@nowhere.net"}}{\fldrslt{\ul
-{\f1 nobody@nowhere.net}
+{\f1 nobody@nowhere.net}
}}}
\par}
{\pard \ql \f0 \sa180 \li720 \fi0 Blockquoted: {\field{\*\fldinst{HYPERLINK "http://example.com/"}}{\fldrslt{\ul
-{\f1 http://example.com/}
+{\f1 http://example.com/}
}}}
\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 Auto-links should not occur here: {\f1 <http://example.com/>} \par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Auto-links should not occur here: {\f1 <http://example.com/>}\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \f1 or here: <http://example.com/>\par}
{\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Images\par}
@@ -416,10 +416,10 @@ inline link in pointy braces
{\pard \ql \f0 \sa180 \li0 \fi0 Subsequent blocks are indented to show that they belong to the footnote (as with list items).\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \f1 \{ <code> \}\par}
{\pard \ql \f0 \sa180 \li0 \fi0 If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.\par}
-} This should {\i not} be a footnote reference, because it contains a space.[^my note] Here is an inline note.{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \ql \f0 \sa180 \li0 \fi0 This is {\i easier} to type. Inline notes may contain {\field{\*\fldinst{HYPERLINK "http://google.com"}}{\fldrslt{\ul
+} This should {\i not} be a footnote reference, because it contains a space.[^my note] Here is an inline note.{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \ql \f0 \sa180 \li0 \fi0 This is {\i easier} to type. Inline notes may contain {\field{\*\fldinst{HYPERLINK "http://google.com"}}{\fldrslt{\ul
links
}}}
- and {\f1 ]} verbatim characters, as well as [bracketed text].\par}
+ and {\f1 ]} verbatim characters, as well as [bracketed text].\par}
}\par}
{\pard \ql \f0 \sa180 \li720 \fi0 Notes can go in quotes.{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \ql \f0 \sa180 \li0 \fi0 In quote.\par}
}\par}