diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2006-12-21 19:33:57 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2006-12-21 19:33:57 +0000 |
commit | d2105f66930f4d14bbeabe2bbbe4f764bb9cb10f (patch) | |
tree | b214e05ce9ddb0fe3330174946318fb56f7e884d /src/Text/Pandoc/Writers | |
parent | 48b8267126fc82aadf289762718b8c01e5331e4c (diff) | |
download | pandoc-d2105f66930f4d14bbeabe2bbbe4f764bb9cb10f.tar.gz |
+ Added regression tests with footnotes in quote blocks and lists.
+ This uncovered an existing bug in the RTF writer, which got indentation
wrong on footnotes occuring in indented blocks like lists. Fixed
this bug.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@263 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/RTF.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs index 6ae32df8b..19b4a5934 100644 --- a/src/Text/Pandoc/Writers/RTF.hs +++ b/src/Text/Pandoc/Writers/RTF.hs @@ -32,6 +32,7 @@ module Text.Pandoc.Writers.RTF ( ) where import Text.Pandoc.Definition import Text.Pandoc.Shared +import Text.Regex ( matchRegexAll, mkRegex ) import List ( isSuffixOf ) import Char ( ord, chr ) @@ -189,9 +190,12 @@ listItemToRTF notes indent marker [] = (marker ++ "\\tx" ++ (show listIncrement) ++ "\\tab ") listItemToRTF notes indent marker list = let (first:rest) = map (blockToRTF notes (indent + listIncrement)) list in - let modFirst = gsub "\\\\fi-?[0-9]+" ("\\\\fi" ++ - (show (0 - listIncrement)) ++ " " ++ marker ++ - "\\\\tx" ++ (show listIncrement) ++ "\\\\tab") first in + -- insert the list marker into the (processed) first block + let modFirst = case matchRegexAll (mkRegex "\\\\fi-?[0-9]+") first of + Just (before, matched, after, _) -> before ++ "\\fi" ++ + show (0 - listIncrement) ++ " " ++ marker ++ "\\tx" ++ + show listIncrement ++ "\\tab" ++ after + Nothing -> first in modFirst ++ (concat rest) -- | Convert list of inline items to RTF. |