diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-10-19 00:33:12 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-10-19 00:33:12 +0000 |
commit | 66d459a545b0ddfa372a5abd200fb8916677785b (patch) | |
tree | 42445fae4c6167ba050fde361754703307d631ea /Text | |
parent | a2422504ff5c3ad40255cbefb86f5e48012e9de9 (diff) | |
download | pandoc-66d459a545b0ddfa372a5abd200fb8916677785b.tar.gz |
Don't print a line break between a footnote and immediately following nonspace
in LaTeX and ConTeXt output, as it is interpreted as a space.
This is problematic for cases like "text^[note]---".
Modified wrappedTeX (in Text.Pandoc.Shared). Resolves Issue #93.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1469 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text')
-rw-r--r-- | Text/Pandoc/Shared.hs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Text/Pandoc/Shared.hs b/Text/Pandoc/Shared.hs index b3682e4b8..6485372db 100644 --- a/Text/Pandoc/Shared.hs +++ b/Text/Pandoc/Shared.hs @@ -243,13 +243,22 @@ wrappedTeX includePercent listWriter sect = do if null rest then return firstpartWrapped else do let (note:rest') = rest - restWrapped <- if null rest' - then return empty - else wrappedTeX includePercent listWriter rest' + let (rest1, rest2) = break (== Space) rest' + -- rest1 is whatever comes between the note and a Space. + -- if the note is followed directly by a Space, rest1 is null. + -- rest1 is printed after the note but before the line break, + -- to avoid spurious blank space the note and immediately + -- following punctuation. + rest1Out <- if null rest1 + then return empty + else listWriter rest1 + rest2Wrapped <- if null rest2 + then return empty + else wrappedTeX includePercent listWriter (tail rest2) noteText <- listWriter [note] - return $ firstpartWrapped <> - (if includePercent then PP.char '%' else empty) $$ - noteText $$ restWrapped + return $ (firstpartWrapped <> if includePercent then PP.char '%' else empty) $$ + (noteText <> rest1Out) $$ + rest2Wrapped -- | Wrap inlines if the text wrap option is selected, specialized -- for LaTeX and ConTeXt. |