git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1803 from mpickering/bugfixes
d5c7d66John MacFarlane
src/Text/Pandoc/Parsing.hs+3−1
@@ -314,12 +314,14 @@ stringAnyCase (x:xs) = do
314 return (firstChar:rest)
314 return (firstChar:rest)
315
315
316-- | Parse contents of 'str' using 'parser' and return result.
316-- | Parse contents of 'str' using 'parser' and return result.
317−parseFromString :: Stream s m t => ParserT s st m a -> s -> ParserT s st m a
317+parseFromString :: Monad m => ParserT String st m a -> String -> ParserT String st m a
318parseFromString parser str = do
318parseFromString parser str = do
319 oldPos <- getPosition
319 oldPos <- getPosition
320 oldInput <- getInput
320 oldInput <- getInput
321 setInput str
321 setInput str
322 result <- parser
322 result <- parser
323+ spaces
324+ eof
323 setInput oldInput
325 setInput oldInput
324 setPosition oldPos
326 setPosition oldPos
325 return result
327 return result
src/Text/Pandoc/Writers/HTML.hs+4−2
@@ -60,7 +60,7 @@ import qualified Text.Blaze.XHtml1.Transitional.Attributes as A
60import Text.Blaze.Renderer.String (renderHtml)
60import Text.Blaze.Renderer.String (renderHtml)
61import Text.TeXMath
61import Text.TeXMath
62import Text.XML.Light.Output
62import Text.XML.Light.Output
63−import Text.XML.Light (unode, elChildren, add_attr, unqual)
63+import Text.XML.Light (unode, elChildren, unqual)
64import qualified Text.XML.Light as XML
64import qualified Text.XML.Light as XML
65import System.FilePath (takeExtension)
65import System.FilePath (takeExtension)
66import Data.Monoid
66import Data.Monoid
@@ -639,7 +639,9 @@ annotateMML e tex = math (unode "semantics" [cs, unode "annotation" (annotAttrs,
639 [] -> unode "mrow" ()
639 [] -> unode "mrow" ()
640 [x] -> x
640 [x] -> x
641 xs -> unode "mrow" xs
641 xs -> unode "mrow" xs
642− math = add_attr (XML.Attr (unqual "xmlns") "http://www.w3.org/1998/Math/MathML") . unode "math"
642+ math childs = XML.Element q as [XML.Elem childs] l
643+ where
644+ (XML.Element q as _ l) = e
643 annotAttrs = [XML.Attr (unqual "encoding") "application/x-tex"]
645 annotAttrs = [XML.Attr (unqual "encoding") "application/x-tex"]
644
646
645
647
src/Text/Pandoc/Writers/RTF.hs+3−1
@@ -106,7 +106,9 @@ writeRTF options (Pandoc meta@(Meta metamap) blocks) =
106 $ metadata
106 $ metadata
107 in if writerStandalone options
107 in if writerStandalone options
108 then renderTemplate' (writerTemplate options) context
108 then renderTemplate' (writerTemplate options) context
109+ else case reverse body of
109− else body
110+ ('\n':_) -> body
111+ _ -> body ++ "\n"
110
112
111-- | Construct table of contents from list of header blocks.
113-- | Construct table of contents from list of header blocks.
112tableOfContents :: [Block] -> String
114tableOfContents :: [Block] -> String