git.iko.soy/typeable/pandoc
on master help sign in
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

commit66d459a545b0ddfa372a5abd200fb8916677785b authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSun 19 Oct 2008, 00:33 (18 years ago) parenta242250
1 file changed+15−6
Text/Pandoc/Shared.hs+15−6
Text/Pandoc/Shared.hs+15−6
@@ -243,13 +243,22 @@ wrappedTeX includePercent listWriter sect = do
243243 if null rest
244244 then return firstpartWrapped
245245 else do let (note:rest') = rest
246− restWrapped <- if null rest'
247− then return empty
248− else wrappedTeX includePercent listWriter rest'
246+ let (rest1, rest2) = break (== Space) rest'
247+ -- rest1 is whatever comes between the note and a Space.
248+ -- if the note is followed directly by a Space, rest1 is null.
249+ -- rest1 is printed after the note but before the line break,
250+ -- to avoid spurious blank space the note and immediately
251+ -- following punctuation.
252+ rest1Out <- if null rest1
253+ then return empty
254+ else listWriter rest1
255+ rest2Wrapped <- if null rest2
256+ then return empty
257+ else wrappedTeX includePercent listWriter (tail rest2)
249258 noteText <- listWriter [note]
250− return $ firstpartWrapped <>
251− (if includePercent then PP.char '%' else empty) $$
252− noteText $$ restWrapped
259+ return $ (firstpartWrapped <> if includePercent then PP.char '%' else empty) $$
260+ (noteText <> rest1Out) $$
261+ rest2Wrapped
253262
254263-- | Wrap inlines if the text wrap option is selected, specialized
255264-- for LaTeX and ConTeXt.