pandoc 1.16 → 1.16.0.1
raw patch · 20 files changed
+150/−62 lines, 20 files
Files
- README +1/−1
- changelog +57/−0
- man/pandoc.1 +1/−1
- pandoc.cabal +1/−1
- pandoc.hs +17/−19
- src/Text/Pandoc/PDF.hs +2/−2
- src/Text/Pandoc/Parsing.hs +5/−1
- src/Text/Pandoc/Readers/Markdown.hs +6/−1
- src/Text/Pandoc/Readers/Org.hs +4/−2
- src/Text/Pandoc/Readers/Textile.hs +2/−2
- src/Text/Pandoc/Writers/LaTeX.hs +15/−17
- src/Text/Pandoc/Writers/Markdown.hs +1/−1
- src/Text/Pandoc/Writers/RST.hs +1/−1
- src/Text/Pandoc/XML.hs +7/−2
- stack.yaml +4/−2
- tests/Tests/Readers/Markdown.hs +9/−0
- tests/Tests/Readers/Org.hs +10/−0
- tests/textile-reader.native +5/−4
- tests/textile-reader.textile +1/−4
- tests/writers-lang-and-dir.latex +1/−1
README view
@@ -1,6 +1,6 @@ % Pandoc User's Guide % John MacFarlane-% November 12, 2015+% January 9, 2016 Synopsis ========
changelog view
@@ -1,3 +1,60 @@+pandoc (1.16.0.1)++ * Fixed regression with `--latex-engine` (#2618). In 1.16 `--latex-engine`+ raises an error if a full path is given.++ * Org reader: Fix function dropping subtrees tagged `:noexport`+ (Albert Krewinkel, #2628):++ * Markdown reader: renormalize table column widths if they exceed 100%+ (#2626).++ * Textile reader: don't allow block HTML tags in inline contexts.+ The reader previously did allow this, following redcloth,+ which happily parses++ Html blocks can be <div>inlined</div> as well.++ as++ <p>Html blocks can be <div>inlined</div> as well.</p>++ This is invalid HTML. The above sample now produces;++ <p>Html blocks can be</p>+ <div>+ <p>inlined</p>+ </div>+ <p>as well.</p>++ * Improved default template lookup for custom lua scripts (#2625).+ Previously, if you tried to do `pandoc -s -t /path/to/lua/script.lua`,+ pandoc would look for the template in+ `~/.pandoc/templates/default./path/to/lua/script.lua`.+ With this change it will look in the more reasonable+ `~/.pandoc/templates/default.script.lua`. This makes it possible to+ store default templates for custom writers.++ * RST, Markdown writers: Fixed rendering of grid tables with blank rows+ (#2615).++ * LaTeX writer: restore old treatment of Span (#2624). A Span is+ now rendered with surrounding `{}`, as it was before 1.16.++ * Entity handling fixes: improved handling of entities like+ `⟨` that require a trailing semicolon. Allow uppercase+ `x` in numerical hexidecimal character references, working+ around a tagsoup bug.++ * `stack.yaml` - use lts-4.0, but with older aeson to avoid excessive+ memory use on compile. With aeson 0.10 we were getting an out of+ memory error on a 2GB Ubuntu 64-bit VM.++ * Improved deb package creation script. Made `DPKGVER` work.+ Renamed `COMMIT` to `TREE`. You should now be able to do+ `TREE=1.16.0.1 DPKGVER=2 make deb`.++ pandoc (1.16) * Added `Attr` field to `Link` and `Image` (Mauro Bieg, #261, API change).
man/pandoc.1 view
@@ -1,5 +1,5 @@ .\"t-.TH PANDOC 1 "November 12, 2015" "pandoc 1.16"+.TH PANDOC 1 "January 9, 2016" "pandoc 1.16.0.1" .SH NAME pandoc - general markup converter .SH SYNOPSIS
pandoc.cabal view
@@ -1,5 +1,5 @@ Name: pandoc-Version: 1.16+Version: 1.16.0.1 Cabal-Version: >= 1.10 Build-Type: Custom License: GPL
pandoc.hs view
@@ -110,8 +110,7 @@ wrap' cols (remaining - length x - 2) xs isTextFormat :: String -> Bool-isTextFormat s = takeWhile (`notElem` "+-") s `notElem` binaries- where binaries = ["odt","docx","epub","epub3"]+isTextFormat s = s `notElem` ["odt","docx","epub","epub3"] externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc externalFilter f args' d = do@@ -1162,23 +1161,24 @@ "epub2" -> "epub" "html4" -> "html" x -> x+ let format = takeWhile (`notElem` ['+','-'])+ $ takeFileName writerName' -- in case path to lua script let pdfOutput = map toLower (takeExtension outputFile) == ".pdf" - let laTeXOutput = "latex" `isPrefixOf` writerName' ||- "beamer" `isPrefixOf` writerName'- let conTeXtOutput = "context" `isPrefixOf` writerName'- let html5Output = "html5" `isPrefixOf` writerName'+ let laTeXOutput = format `elem` ["latex", "beamer"]+ let conTeXtOutput = format == "context"+ let html5Output = format == "html5" let laTeXInput = "latex" `isPrefixOf` readerName' || "beamer" `isPrefixOf` readerName' - writer <- if ".lua" `isSuffixOf` writerName'+ writer <- if ".lua" `isSuffixOf` format -- note: use non-lowercased version writerName then return $ IOStringWriter $ writeCustom writerName else case getWriter writerName' of Left e -> err 9 $- if writerName' == "pdf"+ if format == "pdf" then e ++ "\nTo create a pdf with pandoc, use " ++ "the latex or beamer writer and specify\n" ++@@ -1201,18 +1201,17 @@ "\nPandoc can convert from DOCX, but not from DOC.\nTry using Word to save your DOC file as DOCX, and convert that with pandoc." _ -> e - let standalone' = standalone || not (isTextFormat writerName') || pdfOutput+ let standalone' = standalone || not (isTextFormat format) || pdfOutput templ <- case templatePath of _ | not standalone' -> return "" Nothing -> do- deftemp <- getDefaultTemplate datadir writerName'+ deftemp <- getDefaultTemplate datadir format case deftemp of Left e -> throwIO e Right t -> return t Just tp -> do -- strip off extensions- let format = takeWhile (`notElem` "+-") writerName' let tp' = case takeExtension tp of "" -> tp <.> format _ -> tp@@ -1234,7 +1233,7 @@ return $ ("mathml-script", s) : variables _ -> return variables - variables'' <- if "dzslides" `isPrefixOf` writerName'+ variables'' <- if format == "dzslides" then do dztempl <- readDataFileUTF8 datadir ("dzslides" </> "template.html")@@ -1270,8 +1269,8 @@ , readerTrackChanges = trackChanges } - when (not (isTextFormat writerName') && outputFile == "-") $- err 5 $ "Cannot write " ++ writerName' ++ " output to stdout.\n" +++ when (not (isTextFormat format) && outputFile == "-") $+ err 5 $ "Cannot write " ++ format ++ " output to stdout.\n" ++ "Specify an output file using the -o option." let readSources [] = mapM readSource ["-"]@@ -1354,7 +1353,7 @@ doc' <- (maybe return (extractMedia media) mbExtractMedia >=> adjustMetadata metadata >=> applyTransforms transforms >=>- applyFilters filters' [writerName']) doc+ applyFilters filters' [format]) doc let writeBinary :: B.ByteString -> IO () writeBinary = B.writeFile (UTF8.encodePath outputFile)@@ -1370,7 +1369,7 @@ | pdfOutput -> do -- make sure writer is latex or beamer or context or html5 unless (laTeXOutput || conTeXtOutput || html5Output) $- err 47 $ "cannot produce pdf output with " ++ writerName' +++ err 47 $ "cannot produce pdf output with " ++ format ++ " writer" let pdfprog = case () of@@ -1393,9 +1392,8 @@ | otherwise -> selfcontain (f writerOptions doc' ++ ['\n' | not standalone']) >>= writerFn outputFile . handleEntities- where htmlFormat = writerName' `elem`- ["html","html+lhs","html5","html5+lhs",- "s5","slidy","slideous","dzslides","revealjs"]+ where htmlFormat = format `elem`+ ["html","html5","s5","slidy","slideous","dzslides","revealjs"] selfcontain = if selfContained && htmlFormat then makeSelfContained writerOptions else return
src/Text/Pandoc/PDF.hs view
@@ -99,9 +99,9 @@ doc' <- handleImages opts tmpdir doc let source = writer opts doc' args = writerLaTeXArgs opts- case program of+ case takeBaseName program of "context" -> context2pdf (writerVerbose opts) tmpdir source- _ | program `elem` ["pdflatex", "lualatex", "xelatex"]+ prog | prog `elem` ["pdflatex", "lualatex", "xelatex"] -> tex2pdf' (writerVerbose opts) args tmpdir program source _ -> return $ Left $ UTF8.fromStringLazy $ "Unknown program " ++ program
src/Text/Pandoc/Parsing.hs view
@@ -573,7 +573,11 @@ characterReference = try $ do char '&' ent <- many1Till nonspaceChar (char ';')- case lookupEntity ent of+ let ent' = case ent of+ '#':'X':xs -> '#':'x':xs -- workaround tagsoup bug+ '#':_ -> ent+ _ -> ent ++ ";"+ case lookupEntity ent' of Just c -> return c Nothing -> fail "entity not found"
src/Text/Pandoc/Readers/Markdown.hs view
@@ -1452,11 +1452,16 @@ caption <- case frontCaption of Nothing -> option (return mempty) tableCaption Just c -> return c+ -- renormalize widths if greater than 100%:+ let totalWidth = sum widths+ let widths' = if totalWidth < 1+ then widths+ else map (/ totalWidth) widths return $ do caption' <- caption heads' <- heads lns' <- lns- return $ B.table caption' (zip aligns widths) heads' lns'+ return $ B.table caption' (zip aligns widths') heads' lns' -- -- inline
src/Text/Pandoc/Readers/Org.hs view
@@ -87,8 +87,10 @@ -- | Drop COMMENT headers and the document tree below those headers. dropCommentTrees :: [Block] -> [Block] dropCommentTrees [] = []-dropCommentTrees blks@(b:bs) =- maybe blks (flip dropUntilHeaderAboveLevel bs) $ commentHeaderLevel b+dropCommentTrees (b:bs) =+ maybe (b:dropCommentTrees bs)+ (dropCommentTrees . flip dropUntilHeaderAboveLevel bs)+ (commentHeaderLevel b) -- | Return the level of a header starting a comment or :noexport: tree and -- Nothing otherwise.
src/Text/Pandoc/Readers/Textile.hs view
@@ -57,7 +57,7 @@ import qualified Text.Pandoc.Builder as B import Text.Pandoc.Options import Text.Pandoc.Parsing-import Text.Pandoc.Readers.HTML ( htmlTag, isBlockTag )+import Text.Pandoc.Readers.HTML ( htmlTag, isBlockTag, isInlineTag ) import Text.Pandoc.Shared (trim) import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock ) import Text.HTML.TagSoup (parseTags, innerText, fromAttrib, Tag(..))@@ -504,7 +504,7 @@ return B.linebreak rawHtmlInline :: Parser [Char] ParserState Inlines-rawHtmlInline = B.rawInline "html" . snd <$> htmlTag (const True)+rawHtmlInline = B.rawInline "html" . snd <$> htmlTag isInlineTag -- | Raw LaTeX Inline rawLaTeXInline' :: Parser [Char] ParserState Inlines
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -810,28 +810,26 @@ inlineToLaTeX :: Inline -- ^ Inline to convert -> State WriterState Doc inlineToLaTeX (Span (id',classes,kvs) ils) = do- let noEmph = "csl-no-emph" `elem` classes- let noStrong = "csl-no-strong" `elem` classes- let noSmallCaps = "csl-no-smallcaps" `elem` classes- let rtl = ("dir","rtl") `elem` kvs- let ltr = ("dir","ltr") `elem` kvs ref <- toLabel id' let linkAnchor = if null id' then empty else "\\protect\\hypertarget" <> braces (text ref) <> braces empty- fmap (linkAnchor <>)- ((if noEmph then inCmd "textup" else id) .- (if noStrong then inCmd "textnormal" else id) .- (if noSmallCaps then inCmd "textnormal" else id) .- (if rtl then inCmd "RL" else id) .- (if ltr then inCmd "LR" else id) .- (case lookup "lang" kvs of- Just lng -> let (l, o) = toPolyglossia $ splitBy (=='-') lng- ops = if null o then "" else brackets (text o)- in \c -> char '\\' <> "text" <> text l <> ops <> braces c- Nothing -> id)- ) `fmap` inlineListToLaTeX ils+ let cmds = ["textup" | "csl-no-emph" `elem` classes] +++ ["textnormal" | "csl-no-strong" `elem` classes ||+ "csl-no-smallcaps" `elem` classes] +++ ["RL" | ("dir", "rtl") `elem` kvs] +++ ["LR" | ("dir", "ltr") `elem` kvs] +++ (case lookup "lang" kvs of+ Just lng -> let (l, o) = toPolyglossia $ splitBy (=='-') lng+ ops = if null o then "" else ("[" ++ o ++ "]")+ in ["text" ++ l ++ ops]+ Nothing -> [])+ contents <- inlineListToLaTeX ils+ return $ linkAnchor <>+ if null cmds+ then braces contents+ else foldr inCmd contents cmds inlineToLaTeX (Emph lst) = inlineListToLaTeX lst >>= return . inCmd "emph" inlineToLaTeX (Strong lst) =
src/Text/Pandoc/Writers/Markdown.hs view
@@ -572,7 +572,7 @@ else widths let widthsInChars = map (floor . (fromIntegral (writerColumns opts) *)) widths' let hpipeBlocks blocks = hcat [beg, middle, end]- where h = maximum (map height blocks)+ where h = maximum (1 : map height blocks) sep' = lblock 3 $ vcat (map text $ replicate h " | ") beg = lblock 2 $ vcat (map text $ replicate h "| ") end = lblock 2 $ vcat (map text $ replicate h " |")
src/Text/Pandoc/Writers/RST.hs view
@@ -267,7 +267,7 @@ then map ((+2) . numChars) $ transpose (headers' : rawRows) else map (floor . (fromIntegral (writerColumns opts) *)) widths let hpipeBlocks blocks = hcat [beg, middle, end]- where h = maximum (map height blocks)+ where h = maximum (1 : map height blocks) sep' = lblock 3 $ vcat (map text $ replicate h " | ") beg = lblock 2 $ vcat (map text $ replicate h "| ") end = lblock 2 $ vcat (map text $ replicate h " |")
src/Text/Pandoc/XML.hs view
@@ -100,11 +100,16 @@ -- Unescapes XML entities fromEntities :: String -> String fromEntities ('&':xs) =- case lookupEntity ent of+ case lookupEntity ent' of Just c -> c : fromEntities rest Nothing -> '&' : fromEntities xs where (ent, rest) = case break (\c -> isSpace c || c == ';') xs of (zs,';':ys) -> (zs,ys)- _ -> ("",xs)+ (zs, ys) -> (zs,ys)+ ent' = case ent of+ '#':'X':ys -> '#':'x':ys -- workaround tagsoup bug+ '#':_ -> ent+ _ -> ent ++ ";"+ fromEntities (x:xs) = x : fromEntities xs fromEntities [] = []
stack.yaml view
@@ -10,5 +10,7 @@ extra-deps: - 'cmark-0.5.0' - 'pandoc-citeproc-0.9'-- 'pandoc-types-1.16'-resolver: lts-3.20+- 'pandoc-types-1.16.0.1'+# Use older aeson to avoid excessive memory use in compilation:+- 'aeson-0.8.0.2'+resolver: lts-4.0
tests/Tests/Readers/Markdown.hs view
@@ -371,6 +371,15 @@ , plain "b" , plain "c" <> bulletList [plain "d"] ] ]+ , testGroup "entities"+ [ "character references" =:+ "⟨ ö" =?> para (text "\10216 ö")+ , "numeric" =:+ ",DD" =?> para (text ",DD")+ , "in link title" =:+ "[link](/url \"title ⟨ ö ,\")" =?>+ para (link "/url" "title \10216 ö ," (text "link"))+ ] , testGroup "citations" [ "simple" =: "@item1" =?> para (cite [
tests/Tests/Readers/Org.hs view
@@ -569,6 +569,16 @@ ] =?> (mempty::Blocks) + , "Subtree with :noexport:" =:+ unlines [ "* Exported"+ , "** This isn't exported :noexport:"+ , "*** This neither"+ , "** But this is"+ ] =?>+ mconcat [ headerWith ("exported", [], []) 1 "Exported"+ , headerWith ("but-this-is", [], []) 2 "But this is"+ ]+ , "Paragraph starting with an asterisk" =: "*five" =?> para "*five"
tests/textile-reader.native view
@@ -150,10 +150,11 @@ ,RawBlock (Format "html") "<div class=\"foobar\">" ,Para [Str "any",Space,Strong [Str "Raw",Space,Str "HTML",Space,Str "Block"],Space,Str "with",Space,Str "bold"] ,RawBlock (Format "html") "</div>"-,Para [Str "Html",Space,Str "blocks",Space,Str "can",Space,Str "be",Space,RawInline (Format "html") "<div>",Str "inlined",RawInline (Format "html") "</div>",Space,Str "as",Space,Str "well."]-,BulletList- [[Plain [Str "this",Space,RawInline (Format "html") "<div>",Space,Str "won't",Space,Str "produce",Space,Str "raw",Space,Str "html",Space,Str "blocks",Space,RawInline (Format "html") "</div>"]]- ,[Plain [Str "but",Space,Str "this",Space,RawInline (Format "html") "<strong>",Space,Str "will",Space,Str "produce",Space,Str "inline",Space,Str "html",Space,RawInline (Format "html") "</strong>"]]]+,Para [Str "Html",Space,Str "blocks",Space,Str "can"]+,RawBlock (Format "html") "<div>"+,Para [Str "interrupt",Space,Str "paragraphs"]+,RawBlock (Format "html") "</div>"+,Para [Str "as",Space,Str "well."] ,Para [Str "Can",Space,Str "you",Space,Str "prove",Space,Str "that",Space,Str "2",Space,Str "<",Space,Str "3",Space,Str "?"] ,Header 1 ("acronyms-and-marks",[],[]) [Str "Acronyms",Space,Str "and",Space,Str "marks"] ,Para [Str "PBS (Public Broadcasting System)"]
tests/textile-reader.textile view
@@ -228,10 +228,7 @@ any *Raw HTML Block* with bold </div> -Html blocks can be <div>inlined</div> as well. --* this <div> won't produce raw html blocks </div>-* but this <strong> will produce inline html </strong>+Html blocks can <div>interrupt paragraphs</div> as well. Can you prove that 2 < 3 ?
tests/writers-lang-and-dir.latex view
@@ -89,7 +89,7 @@ and more text. -Next paragraph with a span and a word-thatincludesaspanright?+Next paragraph with a {span} and a word-thatincludesa{span}right? \section{Directionality}\label{directionality}