pandoc 1.11 → 1.11.1
raw patch · 11 files changed
+86/−20 lines, 11 filesdep ~QuickCheck
Dependency ranges changed: QuickCheck
Files
- changelog +42/−0
- pandoc.cabal +2/−2
- pandoc.hs +3/−3
- src/Text/Pandoc/Readers/Markdown.hs +15/−6
- src/Text/Pandoc/Readers/RST.hs +1/−1
- src/Text/Pandoc/Writers/HTML.hs +2/−1
- src/Text/Pandoc/Writers/Markdown.hs +3/−3
- src/Text/Pandoc/Writers/ODT.hs +2/−2
- tests/Tests/Old.hs +1/−1
- tests/markdown-reader-more.native +5/−1
- tests/markdown-reader-more.txt +10/−0
changelog view
@@ -1,3 +1,45 @@+pandoc (1.11.1)++ * Markdown reader:++ + Fixed regression in which parentheses were lost in link URLs.+ Added tests. Closes #786.+ + Better handling of unmatched double quotes in `--smart` mode.+ These occur frequently in fiction, since it is customary not to+ close quotes in dialogue if the speaker does not change between+ paragraphs. The unmatched quotes now get turned into literal+ left double quotes. (No `Quoted` inline is generated, however.)+ Closes #99 (again).+ + * HTML writer: Fixed numbering mismatch between TOC and sections.+ `--number-offset` now affects TOC numbering as well+ as section numbering, as it should have all along. Closes #789.++ * Markdown writer: Reverted 1.11 change that caused citations to be rendered+ as markdown citations, even if `--bibliography` was specified, unless+ `citation` extension is disabled. Now, formatted citations are always+ printed if `--bibliography` was specified. If you want to reformat+ markdown keeping pandoc markdown citations intact, don't use+ `--bibliography`. Note that citations parsed from LaTeX documents will+ be rendered as pandoc markdown citations when `--bibliography` is not+ specified.++ * ODT writer: Fixed regression leading to corrupt ODTs.+ This was due to a change in the `Show` instance for+ `Text.Pandoc.Pretty.Doc`. Closes #780.++ * Fixed spacing bugs involving code block attributes in+ RST reader and Markdown writer. Closes #763.++ * Windows package: Various improvements due to Fyodor Sheremetyev.++ + Automatically set installation path (Program Files or Local App Data).+ + Set system PATH environment variable when installing for all users.+ + Pandoc can installed for all users using the following command.+ `msiexec /i pandoc-1.11.msi ALLUSERS=1`.++ * Bumped QuickCheck version bound.+ pandoc (1.11) * Added `--number-offset` option. (See README for description.)
pandoc.cabal view
@@ -1,5 +1,5 @@ Name: pandoc-Version: 1.11+Version: 1.11.1 Cabal-Version: >= 1.10 Build-Type: Custom License: GPL@@ -380,7 +380,7 @@ test-framework >= 0.3 && < 0.9, test-framework-hunit >= 0.2 && < 0.4, test-framework-quickcheck2 >= 0.2.9 && < 0.4,- QuickCheck >= 2.4 && < 2.6,+ QuickCheck >= 2.4 && < 2.7, HUnit >= 1.2 && < 1.3, containers >= 0.1 && < 0.6, ansi-terminal >= 0.5 && < 0.7
pandoc.hs view
@@ -100,7 +100,7 @@ , optVariables :: [(String,String)] -- ^ Template variables to set , optOutputFile :: String -- ^ Name of output file , optNumberSections :: Bool -- ^ Number sections in LaTeX- , optNumberOffset :: [Int] -- ^ Starting number for sections+ , optNumberOffset :: [Int] -- ^ Starting number for sections , optSectionDivs :: Bool -- ^ Put sections in div tags in HTML , optIncremental :: Bool -- ^ Use incremental lists in Slidy/Slideous/S5 , optSelfContained :: Bool -- ^ Make HTML accessible offline@@ -157,7 +157,7 @@ , optVariables = [] , optOutputFile = "-" -- "-" means stdout , optNumberSections = False- , optNumberOffset = [1,1,1,1,1,1]+ , optNumberOffset = [0,0,0,0,0,0] , optSectionDivs = False , optIncremental = False , optSelfContained = False@@ -1035,7 +1035,7 @@ writerBiblioFiles = reffiles, writerIgnoreNotes = False, writerNumberSections = numberSections,- writerNumberOffset = numberFrom,+ writerNumberOffset = numberFrom, writerSectionDivs = sectionDivs, writerReferenceLinks = referenceLinks, writerWrapText = wrap,
src/Text/Pandoc/Readers/Markdown.hs view
@@ -287,8 +287,7 @@ referenceTitle :: MarkdownParser String referenceTitle = try $ do skipSpaces >> optional newline >> skipSpaces- let parenTit = charsInBalanced '(' ')' litChar- quotedTitle '"' <|> quotedTitle '\'' <|> parenTit+ quotedTitle '"' <|> quotedTitle '\'' <|> charsInBalanced '(' ')' litChar -- A link title in quotes quotedTitle :: Char -> MarkdownParser String@@ -1494,13 +1493,18 @@ reference = do notFollowedBy' (string "[^") -- footnote reference withRaw $ trimInlinesF <$> inlinesInBalancedBrackets +parenthesizedChars :: MarkdownParser [Char]+parenthesizedChars = do+ result <- charsInBalanced '(' ')' litChar+ return $ '(' : result ++ ")"+ -- source for a link, with optional title source :: MarkdownParser (String, String) source = do char '(' skipSpaces let urlChunk = try $ notFollowedBy (oneOf "\"')") >>- (charsInBalanced '(' ')' litChar <|> count 1 litChar)+ (parenthesizedChars <|> count 1 litChar) let sourceURL = (unwords . words . concat) <$> many urlChunk let betweenAngles = try $ char '<' >> manyTill litChar (char '>')@@ -1748,9 +1752,14 @@ fmap B.singleQuoted . trimInlinesF . mconcat <$> many1Till inline singleQuoteEnd +-- doubleQuoted will handle regular double-quoted sections, as well+-- as dialogues with an open double-quote without a close double-quote+-- in the same paragraph. doubleQuoted :: MarkdownParser (F Inlines) doubleQuoted = try $ do doubleQuoteStart- withQuoteContext InDoubleQuote $- fmap B.doubleQuoted . trimInlinesF . mconcat <$>- many1Till inline doubleQuoteEnd+ contents <- mconcat <$> many (try $ notFollowedBy doubleQuoteEnd >> inline)+ (withQuoteContext InDoubleQuote $ doubleQuoteEnd >> return+ (fmap B.doubleQuoted . trimInlinesF $ contents))+ <|> (return $ return (B.str "\8220") <> contents)+
src/Text/Pandoc/Readers/RST.hs view
@@ -611,7 +611,7 @@ kvs = case numberLines of Just "" -> [] Nothing -> []- Just n -> [("startFrom",n)]+ Just n -> [("startFrom",trim n)] --- --- note block
src/Text/Pandoc/Writers/HTML.hs view
@@ -252,10 +252,11 @@ elementToListItem :: WriterOptions -> Element -> State WriterState (Maybe Html) elementToListItem opts (Sec lev num (id',classes,_) headerText subsecs) | lev <= writerTOCDepth opts = do+ let num' = zipWith (+) num (writerNumberOffset opts ++ repeat 0) let sectnum = if writerNumberSections opts && not (null num) && "unnumbered" `notElem` classes then (H.span ! A.class_ "toc-section-number"- $ toHtml $ showSecNum num) >> preEscapedString " "+ $ toHtml $ showSecNum num') >> preEscapedString " " else mempty txt <- liftM (sectnum >>) $ inlineListToHtml opts headerText subHeads <- mapM (elementToListItem opts) subsecs >>= return . catMaybes
src/Text/Pandoc/Writers/Markdown.hs view
@@ -328,7 +328,7 @@ | otherwise -> replicate (n+1) '~' backticks = text "```" attrs = if isEnabled Ext_fenced_code_attributes opts- then attrsToMarkdown attribs+ then nowrap $ attrsToMarkdown attribs else empty blockToMarkdown opts (BlockQuote blocks) = do st <- get@@ -643,7 +643,7 @@ | isEnabled Ext_escaped_line_breaks opts = return $ "\\" <> cr | otherwise = return $ " " <> cr inlineToMarkdown _ Space = return space-inlineToMarkdown opts (Cite (c:cs) lst)+inlineToMarkdown opts (Cite (c:cs) lst@[RawInline "latex" _]) | not (isEnabled Ext_citations opts) = inlineListToMarkdown opts lst | citationMode c == AuthorInText = do suffs <- inlineListToMarkdown opts $ citationSuffix c@@ -670,7 +670,7 @@ return $ pdoc <+> r modekey SuppressAuthor = "-" modekey _ = ""-inlineToMarkdown _ (Cite _ _) = return $ text ""+inlineToMarkdown opts (Cite _ lst) = inlineListToMarkdown opts lst inlineToMarkdown opts (Link txt (src, tit)) = do linktext <- inlineListToMarkdown opts txt let linktitle = if null tit
src/Text/Pandoc/Writers/ODT.hs view
@@ -78,7 +78,7 @@ ] let files = [ ent | ent <- filesInArchive archive, not ("META-INF" `isPrefixOf` ent) ] let manifestEntry = toEntry "META-INF/manifest.xml" epochtime- $ fromStringLazy $ show+ $ fromStringLazy $ render Nothing $ text "<?xml version=\"1.0\" encoding=\"utf-8\"?>" $$ ( inTags True "manifest:manifest"@@ -92,7 +92,7 @@ ) let archive' = addEntryToArchive manifestEntry archive let metaEntry = toEntry "meta.xml" epochtime- $ fromStringLazy $ show+ $ fromStringLazy $ render Nothing $ text "<?xml version=\"1.0\" encoding=\"utf-8\"?>" $$ ( inTags True "office:document-meta"
tests/Tests/Old.hs view
@@ -186,7 +186,7 @@ ++ [test "natbib" wopts "markdown-citations.txt" "markdown-citations.txt"] where- ropts = ["-r", "markdown", "-w", "markdown-citations", "--bibliography",+ ropts = ["-r", "markdown", "-w", "markdown", "--bibliography", "biblio.bib", "--no-wrap"] wopts = ["-r", "markdown", "-w", "markdown", "--no-wrap", "--natbib"] styleToTest style = test style (ropts ++ ["--csl", style ++ ".csl"])
tests/markdown-reader-more.native view
@@ -130,4 +130,8 @@ ,Para [Link [Str "link"] ("/\252rl","\246\246!")] ,Para [Link [Str "http://g\246\246gle.com"] ("http://g\246\246gle.com","")] ,Para [Link [Str "me@ex\228mple.com"] ("mailto:me@ex\228mple.com","")]-,Para [Link [Str "foobar"] ("/\252rl","\246\246!")]]+,Para [Link [Str "foobar"] ("/\252rl","\246\246!")]+,Header 2 ("parentheses-in-urls",[],[]) [Str "Parentheses",Space,Str "in",Space,Str "URLs"]+,Para [Link [Str "link"] ("/hi(there)","")]+,Para [Link [Str "link"] ("/hithere)","")]+,Para [Link [Str "linky"] ("hi_(there_(nested))","")]]
tests/markdown-reader-more.txt view
@@ -221,3 +221,13 @@ [foobar] [foobar]: /ürl "öö!"++## Parentheses in URLs++[link](/hi(there))++[link](/hithere\))++[linky]++[linky]: hi_(there_(nested))