packages feed

pandoc 1.9.0.5 → 1.9.1

raw patch · 13 files changed

+99/−34 lines, 13 filesdep ~highlighting-katedep ~texmathPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: highlighting-kate, texmath

API changes (from Hackage documentation)

+ Text.Pandoc: stateMaxNestingLevel :: ParserState -> Int
+ Text.Pandoc.Parsing: stateMaxNestingLevel :: ParserState -> Int
- Text.Pandoc: ParserState :: Bool -> ParserContext -> QuoteContext -> Maybe SourcePos -> KeyTable -> [String] -> NoteTable -> Int -> Bool -> [Inline] -> [[Inline]] -> [Inline] -> Bool -> Bool -> Bool -> Bool -> Int -> [HeaderType] -> [String] -> Int -> Map String Int -> Bool -> Bool -> [Macro] -> ParserState
+ Text.Pandoc: ParserState :: Bool -> ParserContext -> QuoteContext -> Int -> Maybe SourcePos -> KeyTable -> [String] -> NoteTable -> Int -> Bool -> [Inline] -> [[Inline]] -> [Inline] -> Bool -> Bool -> Bool -> Bool -> Int -> [HeaderType] -> [String] -> Int -> Map String Int -> Bool -> Bool -> [Macro] -> ParserState
- Text.Pandoc.Parsing: ParserState :: Bool -> ParserContext -> QuoteContext -> Maybe SourcePos -> KeyTable -> [String] -> NoteTable -> Int -> Bool -> [Inline] -> [[Inline]] -> [Inline] -> Bool -> Bool -> Bool -> Bool -> Int -> [HeaderType] -> [String] -> Int -> Map String Int -> Bool -> Bool -> [Macro] -> ParserState
+ Text.Pandoc.Parsing: ParserState :: Bool -> ParserContext -> QuoteContext -> Int -> Maybe SourcePos -> KeyTable -> [String] -> NoteTable -> Int -> Bool -> [Inline] -> [[Inline]] -> [Inline] -> Bool -> Bool -> Bool -> Bool -> Int -> [HeaderType] -> [String] -> Int -> Map String Int -> Bool -> Bool -> [Macro] -> ParserState

Files

README view
@@ -442,7 +442,7 @@     By default, pandoc will include the following metadata elements:     `<dc:title>` (from the document title), `<dc:creator>` (from the     document authors), `<dc:date>` (from the document date, which should-    be is in [ISO 8601 format]), `<dc:language>` (from the `lang`+    be in [ISO 8601 format]), `<dc:language>` (from the `lang`     variable, or, if is not set, the locale), and `<dc:identifier     id="BookId">` (a randomly generated UUID). Any of these may be     overridden by elements in the metadata file.@@ -1275,10 +1275,9 @@      <!-- --> -    a.  uno-    b.  dos-    c.  tres-+    1.  uno+    2.  dos+    3.  tres  Horizontal rules ----------------
changelog view
@@ -1,3 +1,32 @@+pandoc (1.9.1)++  * LaTeX reader:+  +    + Fixed regression in 1.9; properly handle escaped $ in latex math.+    + Put LaTeX verse environments in blockquotes.++  * Markdown reader:+  +    + Limit nesting of strong/emph.  This avoids exponential lookahead+      in parasitic cases, like `a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**`.+    + Improved attributes syntax (inn code blocks/spans):+      (1) Attributes can contain line breaks. (2) Values in key-value+      attributes can be surrounded by either double or single quotes, or+      left unquoted if they contain no spaces.++  * Don't wrap headers in markdown or RST writers.++  * Added `stateMaxNestingLevel` to `ParserState`.+    We set this to 6, so you can still have `Emph` inside `Emph`,+    just not indefinitely.++  * More efficient implementation of `nowrap` in `Text.Pandoc.Pretty`.++  * `Text.Pandoc.PDF`:  Only run latex twice if `\tableofcontents`+    is present.++  * Require highlighting-kate >= 0.5.0.2, texmath >= 0.6.0.2.+ pandoc (1.9.0.5)    * Changed cabal file so that build-depends for the test program@@ -196,6 +225,15 @@         </sidebar>      will not be wrapped in `<para>` tags.+  +  * The LaTeX parser has been completely rewritten; it is now much more+    accurate, robust, and extensible. However, there are two important+    changes in how it treats unknown LaTeX. (1) Previously, unknown+    environments became BlockQuote elements; now, they are treated+    as "transparent", so `\begin{unknown}xyz\end{unknown}` is the+    same as `xyz`.  (2) Previously, arguments of unknown commands+    were passed through with their braces; now the braces are stripped+    off.    * `--smart` is no longer selected automatically with `man` output. @@ -378,9 +416,6 @@   * Removed dependency on dlist.    * New slidy directory for "self-contained."--  * LaTeX parser completely rewritten; it is now much more accurate,-    robust, and extensible.    * TeXMath writer:  Use unicode thin spaces for thin spaces. 
man/man1/pandoc.1 view
@@ -613,7 +613,7 @@ By default, pandoc will include the following metadata elements: \f[C]<dc:title>\f[] (from the document title), \f[C]<dc:creator>\f[] (from the document authors), \f[C]<dc:date>\f[] (from the document date,-which should be is in ISO 8601 format), \f[C]<dc:language>\f[] (from the+which should be in ISO 8601 format), \f[C]<dc:language>\f[] (from the \f[C]lang\f[] variable, or, if is not set, the locale), and \f[C]<dc:identifier\ id="BookId">\f[] (a randomly generated UUID). Any of these may be overridden by elements in the metadata file.
man/man5/pandoc_markdown.5 view
@@ -726,9 +726,9 @@  <!--\ --> -a.\ \ uno-b.\ \ dos-c.\ \ tres+1.\ \ uno+2.\ \ dos+3.\ \ tres \f[] .fi .SH HORIZONTAL RULES
pandoc.cabal view
@@ -1,5 +1,5 @@ Name:            pandoc-Version:         1.9.0.5+Version:         1.9.1 Cabal-Version:   >= 1.10 Build-Type:      Custom License:         GPL@@ -203,7 +203,7 @@                  old-locale >= 1 && < 1.1,                  time >= 1.2 && < 1.5,                  HTTP >= 4000.0.5 && < 4000.3,-                 texmath >= 0.6 && < 0.7,+                 texmath >= 0.6.0.2 && < 0.7,                  xml >= 1.3.12 && < 1.4,                  random >= 1 && < 1.1,                  extensible-exceptions >= 0.1 && < 0.2,@@ -213,7 +213,7 @@                  tagsoup >= 0.12.5 && < 0.13,                  base64-bytestring >= 0.1 && < 0.2,                  zlib >= 0.5 && <= 0.6,-                 highlighting-kate >= 0.5.0.1 && < 0.6,+                 highlighting-kate >= 0.5.0.2 && < 0.6,                  temporary >= 1.1 && < 1.2   if impl(ghc >= 6.10)     Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4@@ -301,7 +301,7 @@                  old-locale >= 1 && < 1.1,                  time >= 1.2 && < 1.5,                  HTTP >= 4000.0.5 && < 4000.3,-                 texmath >= 0.6 && < 0.7,+                 texmath >= 0.6.0.2 && < 0.7,                  xml >= 1.3.12 && < 1.4,                  random >= 1 && < 1.1,                  extensible-exceptions >= 0.1 && < 0.2,@@ -311,7 +311,7 @@                  tagsoup >= 0.12.5 && < 0.13,                  base64-bytestring >= 0.1 && < 0.2,                  zlib >= 0.5 && <= 0.6,-                 highlighting-kate >= 0.5.0.1 && < 0.6,+                 highlighting-kate >= 0.5.0.2 && < 0.6,                  temporary >= 1.1 && < 1.2   if impl(ghc >= 6.10)     Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4@@ -359,7 +359,7 @@                  old-locale >= 1 && < 1.1,                  time >= 1.2 && < 1.5,                  HTTP >= 4000.0.5 && < 4000.3,-                 texmath >= 0.6 && < 0.7,+                 texmath >= 0.6.0.2 && < 0.7,                  xml >= 1.3.12 && < 1.4,                  random >= 1 && < 1.1,                  extensible-exceptions >= 0.1 && < 0.2,@@ -369,7 +369,7 @@                  tagsoup >= 0.12.5 && < 0.13,                  base64-bytestring >= 0.1 && < 0.2,                  zlib >= 0.5 && <= 0.6,-                 highlighting-kate >= 0.5.0.1 && < 0.6,+                 highlighting-kate >= 0.5.0.2 && < 0.6,                  temporary >= 1.1 && < 1.2   if impl(ghc >= 6.10)     Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4
src/Tests/Readers/LaTeX.hs view
@@ -41,6 +41,11 @@               header 1 ("text" <> space <> link "/url" "" "link")           ] +        , testGroup "math"+          [ "escaped $" =:+            "$x=\\$4$" =?> para (math "x=\\$4")+          ]+         , testGroup "space and comments"           [ "blank lines + space at beginning" =:             "\n  \n  hi" =?> para "hi"
src/Text/Pandoc/PDF.hs view
@@ -43,6 +43,7 @@ import Control.Concurrent (putMVar, takeMVar, newEmptyMVar, forkIO) import Text.Pandoc.UTF8 as UTF8 import Control.Monad (unless)+import Data.List (isInfixOf)  tex2pdf :: String       -- ^ tex program (pdflatex, lualatex, xelatex)         -> String       -- ^ latex source@@ -55,7 +56,9 @@          -> String                          -- ^ tex source          -> IO (Either ByteString ByteString) tex2pdf' tmpDir program source = do-  let numruns = 2 -- should suffice for toc and hyperrefs+  let numruns = if "\\tableofcontents" `isInfixOf` source+                   then 2+                   else 1   (exit, log', mbPdf) <- runTeXProgram program numruns tmpDir source   let msg = "Error producing PDF from TeX source."   case (exit, mbPdf) of
src/Text/Pandoc/Parsing.hs view
@@ -629,6 +629,7 @@     { stateParseRaw        :: Bool,          -- ^ Parse raw HTML and LaTeX?       stateParserContext   :: ParserContext, -- ^ Inside list?       stateQuoteContext    :: QuoteContext,  -- ^ Inside quoted environment?+      stateMaxNestingLevel :: Int,           -- ^ Max # of nested Strong/Emph       stateLastStrPos      :: Maybe SourcePos, -- ^ Position after last str parsed       stateKeys            :: KeyTable,      -- ^ List of reference keys       stateCitations       :: [String],      -- ^ List of available citations@@ -660,6 +661,7 @@     ParserState { stateParseRaw        = False,                   stateParserContext   = NullState,                   stateQuoteContext    = NoQuote,+                  stateMaxNestingLevel = 6,                   stateLastStrPos      = Nothing,                   stateKeys            = M.empty,                   stateCitations       = [],
src/Text/Pandoc/Pretty.hs view
@@ -72,7 +72,7 @@      )  where-import Data.Sequence (Seq, fromList, (<|), singleton)+import Data.Sequence (Seq, fromList, (<|), singleton, mapWithIndex) import Data.Foldable (toList) import Data.List (intercalate) import Data.Monoid@@ -408,9 +408,9 @@  -- | Makes a 'Doc' non-reflowable. nowrap :: Doc -> Doc-nowrap doc = Doc $ fromList $ map replaceSpace $ toList $ unDoc doc-  where replaceSpace BreakingSpace = Text 1 " "-        replaceSpace x = x+nowrap doc = Doc $ mapWithIndex replaceSpace $ unDoc doc+  where replaceSpace _ BreakingSpace = Text 1 " "+        replaceSpace _ x = x  -- | Returns the width of a 'Doc'. offset :: Doc -> Int
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -136,6 +136,12 @@ mathInline :: LP String -> LP Inlines mathInline p = math <$> (try p >>= applyMacros') +mathChars :: LP String+mathChars = concat <$>+  many (   many1 (satisfy (\c -> c /= '$' && c /='\\'))+      <|> (\c -> ['\\',c]) <$> (try $ char '\\' *> anyChar)+       )+ double_quote :: LP Inlines double_quote = (doubleQuoted . mconcat) <$>   (try $ string "``" *> manyTill inline (try $ string "''"))@@ -158,8 +164,8 @@      <|> single_quote      <|> (str "’" <$ char '\'')      <|> (str "\160" <$ char '~')-     <|> (mathDisplay $ string "$$" *> manyTill anyChar (try $ string "$$"))-     <|> (mathInline  $ char '$' *> manyTill anyChar (char '$'))+     <|> (mathDisplay $ string "$$" *> mathChars <* string "$$")+     <|> (mathInline  $ char '$' *> mathChars <* char '$')      <|> (superscript <$> (char '^' *> tok))      <|> (subscript <$> (char '_' *> tok))      <|> (failUnlessLHS *> char '|' *> doLHSverb)@@ -667,6 +673,7 @@   , ("tabular", env "tabular" simpTable)   , ("quote", blockQuote <$> env "quote" blocks)   , ("quotation", blockQuote <$> env "quotation" blocks)+  , ("verse", blockQuote <$> env "verse" blocks)   , ("itemize", bulletList <$> listenv "itemize" (many item))   , ("description", definitionList <$> listenv "description" (many descItem))   , ("enumerate", ordered_list)
src/Text/Pandoc/Readers/Markdown.hs view
@@ -390,8 +390,8 @@ attributes :: GenParser Char st ([Char], [[Char]], [([Char], [Char])]) attributes = try $ do   char '{'-  many spaceChar-  attrs <- many (attribute >>~ many spaceChar)+  spnl+  attrs <- many (attribute >>~ spnl)   char '}'   let (ids, classes, keyvals) = unzip3 attrs   let firstNonNull [] = ""@@ -424,8 +424,9 @@ keyValAttr = try $ do   key <- identifier   char '='-  char '"'-  val <- manyTill (satisfy (/='\n')) (char '"')+  val <- enclosed (char '"') (char '"') anyChar+     <|> enclosed (char '\'') (char '\'') anyChar+     <|> many nonspaceChar   return ("",[],[(key,val)])  codeBlockDelimited :: GenParser Char st Block@@ -1041,8 +1042,20 @@     where inner      = innerSpace <|> (notFollowedBy' whitespace >> inline)           innerSpace = try $ whitespace >>~ notFollowedBy' end +-- This is used to prevent exponential blowups for things like:+-- a**a*a**a*a**a*a**a*a**a*a**a*a**+nested :: GenParser Char ParserState a+       -> GenParser Char ParserState a+nested p = do+  nestlevel <- stateMaxNestingLevel `fmap` getState+  guard $ nestlevel > 0+  updateState $ \st -> st{ stateMaxNestingLevel = stateMaxNestingLevel st - 1 }+  res <- p+  updateState $ \st -> st{ stateMaxNestingLevel = nestlevel }+  return res+ emph :: GenParser Char ParserState Inline-emph = Emph `liftM`+emph = Emph `fmap` nested   (inlinesBetween starStart starEnd <|> inlinesBetween ulStart ulEnd)     where starStart = char '*' >> lookAhead nonspaceChar           starEnd   = notFollowedBy' strong >> char '*'@@ -1050,7 +1063,7 @@           ulEnd     = notFollowedBy' strong >> char '_'  strong :: GenParser Char ParserState Inline-strong = Strong `liftM`+strong = Strong `liftM` nested   (inlinesBetween starStart starEnd <|> inlinesBetween ulStart ulEnd)     where starStart = string "**" >> lookAhead nonspaceChar           starEnd   = try $ string "**"
src/Text/Pandoc/Writers/Markdown.hs view
@@ -234,7 +234,8 @@   contents <- inlineListToMarkdown opts inlines   st <- get   let setext = writerSetextHeaders opts-  return $ case level of+  return $ nowrap+         $ case level of             1 | setext ->                   contents <> cr <> text (replicate (offset contents) '=') <>                   blankline
src/Text/Pandoc/Writers/RST.hs view
@@ -157,7 +157,7 @@   contents <- inlineListToRST inlines   let headerChar = if level > 5 then ' ' else "=-~^'" !! (level - 1)   let border = text $ replicate (offset contents) headerChar-  return $ contents $$ border $$ blankline+  return $ nowrap $ contents $$ border $$ blankline blockToRST (CodeBlock (_,classes,_) str) = do   opts <- stOptions <$> get   let tabstop = writerTabStop opts