git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1803 from mpickering/bugfixes

Bugfixes

commitd5c7d66735006070fd1bfd1289d526380ea10d14 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 15 Dec 2014, 20:15 (12 years ago) parenta5cac0ae6bd29e
3 files changed+10−4
src/Text/Pandoc/Parsing.hs+3−1 src/Text/Pandoc/Writers/HTML.hs+4−2 src/Text/Pandoc/Writers/RTF.hs+3−1
src/Text/Pandoc/Parsing.hs+3−1
@@ -314,12 +314,14 @@ stringAnyCase (x:xs) = do
314314 return (firstChar:rest)
315315
316316-- | 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
318318parseFromString parser str = do
319319 oldPos <- getPosition
320320 oldInput <- getInput
321321 setInput str
322322 result <- parser
323+ spaces
324+ eof
323325 setInput oldInput
324326 setPosition oldPos
325327 return result
src/Text/Pandoc/Writers/HTML.hs+4−2
@@ -60,7 +60,7 @@ import qualified Text.Blaze.XHtml1.Transitional.Attributes as A
6060import Text.Blaze.Renderer.String (renderHtml)
6161import Text.TeXMath
6262import Text.XML.Light.Output
63−import Text.XML.Light (unode, elChildren, add_attr, unqual)
63+import Text.XML.Light (unode, elChildren, unqual)
6464import qualified Text.XML.Light as XML
6565import System.FilePath (takeExtension)
6666import Data.Monoid
@@ -639,7 +639,9 @@ annotateMML e tex = math (unode "semantics" [cs, unode "annotation" (annotAttrs,
639639 [] -> unode "mrow" ()
640640 [x] -> x
641641 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
643645 annotAttrs = [XML.Attr (unqual "encoding") "application/x-tex"]
644646
645647
src/Text/Pandoc/Writers/RTF.hs+3−1
@@ -106,7 +106,9 @@ writeRTF options (Pandoc meta@(Meta metamap) blocks) =
106106 $ metadata
107107 in if writerStandalone options
108108 then renderTemplate' (writerTemplate options) context
109− else body
109+ else case reverse body of
110+ ('\n':_) -> body
111+ _ -> body ++ "\n"
110112
111113-- | Construct table of contents from list of header blocks.
112114tableOfContents :: [Block] -> String