pandoc 2.14.0.3 → 2.14.1
raw patch · 53 files changed
+637/−196 lines, 53 filesdep ~citeprocdep ~commonmark-pandocdep ~doctemplatesPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: citeproc, commonmark-pandoc, doctemplates, skylighting, skylighting-core
API changes (from Hackage documentation)
+ Text.Pandoc.ImageSize: Tiff :: ImageType
Files
- MANUAL.txt +7/−1
- cabal.project +4/−0
- changelog.md +136/−0
- data/templates/default.latex +29/−29
- data/templates/styles.html +2/−1
- man/pandoc.1 +11/−2
- pandoc.cabal +8/−7
- src/Text/Pandoc/Citeproc.hs +62/−38
- src/Text/Pandoc/Citeproc/BibTeX.hs +4/−2
- src/Text/Pandoc/Class/IO.hs +1/−1
- src/Text/Pandoc/Error.hs +3/−3
- src/Text/Pandoc/ImageSize.hs +5/−1
- src/Text/Pandoc/PDF.hs +3/−3
- src/Text/Pandoc/Readers/DocBook.hs +8/−4
- src/Text/Pandoc/Readers/HTML.hs +3/−8
- src/Text/Pandoc/Readers/HTML/Parsing.hs +3/−1
- src/Text/Pandoc/Readers/LaTeX.hs +3/−6
- src/Text/Pandoc/Readers/LaTeX/Lang.hs +2/−2
- src/Text/Pandoc/Readers/LaTeX/Parsing.hs +34/−5
- src/Text/Pandoc/Readers/LaTeX/Table.hs +1/−0
- src/Text/Pandoc/Readers/Markdown.hs +4/−1
- src/Text/Pandoc/Readers/RST.hs +5/−1
- src/Text/Pandoc/Writers/Docx.hs +19/−3
- src/Text/Pandoc/Writers/Docx/Table.hs +28/−3
- src/Text/Pandoc/Writers/Docx/Types.hs +4/−0
- src/Text/Pandoc/Writers/EPUB.hs +2/−1
- src/Text/Pandoc/Writers/HTML.hs +36/−36
- src/Text/Pandoc/Writers/Markdown.hs +3/−0
- src/Text/Pandoc/Writers/Powerpoint/Output.hs +1/−0
- stack.yaml +5/−2
- test/Tests/Readers/HTML.hs +6/−0
- test/Tests/Writers/OOXML.hs +3/−1
- test/command/4465.md +15/−0
- test/command/6890.md +2/−2
- test/command/7394.md +85/−0
- test/command/7416.md +19/−0
- test/command/7434.md +15/−0
- test/command/7436.md +14/−0
- test/command/pandoc-citeproc-322.md +1/−1
- test/command/pandoc-citeproc-chicago-author-date.md +7/−7
- test/command/pandoc-citeproc-chicago-fullnote-bibliography.md +6/−7
- test/command/three.txt +3/−0
- test/docbook-reader.docbook +3/−0
- test/docbook-reader.native +1/−0
- test/docx/golden/image.docx binary
- test/lhs-test.html +2/−1
- test/lhs-test.html+lhs +2/−1
- test/lhs-test.latex +3/−3
- test/lhs-test.latex+lhs +3/−3
- test/writer.html4 +2/−1
- test/writer.html5 +2/−1
- test/writer.latex +4/−4
- test/writers-lang-and-dir.latex +3/−3
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: June 20, 2021+date: July 18, 2021 --- # Synopsis@@ -6176,6 +6176,12 @@ data-external="1" type="audio/mpeg"> </source> </audio>++If the input format already is HTML then `data-external="1"` will work+as expected for `<img>` elements. Similarly, for Markdown, external+images can be declared with `{external=1}`. Note that this+only works for images; the other media elements have no native+representation in pandoc's AST and requires the use of raw HTML. # Jupyter notebooks
cabal.project view
@@ -2,3 +2,7 @@ tests: True flags: +embed_data_files +-- source-repository-package+-- type: git+-- location: https://github.com/jgm/citeproc+-- tag: 4ce0501cd6f9c86eee087afcf878c256e49b9615
changelog.md view
@@ -1,5 +1,141 @@ # Revision history for pandoc +## pandoc 2.14.1 (2021-07-18)++ * Text.Pandoc.ImageSize: Add Tiff constructor for ImageType (#7405)+ [Minor API change]. This allows pandoc to get size information from+ tiff images.++ * Markdown reader: don't try to read contents in self-closing HTML tag.+ Previously we had problems parsing raw HTML with self-closing+ tags like `<col/>`. The problem was that pandoc would look+ for a closing tag to close the markdown contents, but the+ closing tag had, in effect, already been parsed by `htmlTag`.++ * LaTeX reader:++ + Avoid trailing hyphen in translating languages (#7447).+ Previously `\foreignlanguage{english}` turned into `<span lang="en-">`.+ The same issue affected Arabic.+ + Support `\cline` in LaTeX tables (#7442).+ + Improved parsing of raw LaTeX from Text streams (`rawLaTeXParser`,+ used to read LaTeX in Markdown files, #7434). We now use source+ positions from the token stream to tell us how much of the text stream+ to consume. Getting this to work required a few other changes to+ make token source positions accurate.++ * DocBook reader:++ + Handle images with imageobjectco elements (#7440).+ + Add support for citerefentry (#7437, Jan Tojnar).++ * RST reader: fix regression with code includes (#7436).+ With the recent changes to include infrastructure,+ included code blocks were getting an extra newline.++ * HTML reader:++ + Recognize data-external when reading HTML img tags (#7429,+ Michael Hoffmann). Preserve all attributes in img tags. If attributes+ have a `data-` prefix, it will be stripped. In particular, this+ preserves a `data-external` attribute as an `external` attribute in+ the pandoc AST.+ + Add col, colgroup to 'closes' definitions++ * HTML writer:++ + Remove duplicated alt text in HTML output (Aner Lucero).+ + Remove `aria-hidden` when explicit alt text is provided (Aner Lucero).+ + Set boolean values for reveal.js variables.++ * Docx writer:++ + Add table numbering for captioned tables.+ The numbers are added using fields, so that Word can+ create a list of tables that will update automatically.+ + Support figure numbers. These are set up in such a way that they+ will work with Word's automatic table of figures (#7392).++ * Markdown writer: put space between Plain and following fenced Div+ (#4465).++ * EPUB writer: Don't incorporate externally linked images in EPUB documents+ (#7430, Michael Hoffmann). Just as it is possible to avoid incorporating+ an image in EPUB by passing `data-external="1"` to a raw HTML snippet,+ this makes the same possible for native Images, by looking for an+ associated `external` attribute.++ * Text.Pandoc.PDF:++ + Fix `svgIn` path error (#7431). We were duplicating+ the temp directory; this didn't cause problems on macOS or linux+ because there we use absolute paths for the temp directory.+ But on Windows it caused errors converting SVG files.+ + `convertImage`: normalize paths (#7431). This will avoid paths+ on Windows with mixed path separators.++ * Text.Pandoc.Class: Always use / when adding directory to image destination+ with `extractMedia`, even on Windows.++ * Text.Pandoc.Citeproc:++ + Allow `$` characters in bibtex keys (#7409).+ + Set proper initial source name in parsing BibTeX (for better error+ messages.)+ + Revamp note citation handling (#7394). Use latest+ citeproc, which uses a Span with a class rather than a Note for notes.+ This helps us distinguish between user notes and citation notes. Don't+ put citations at the beginning of a note in parentheses. Fix small bug+ in handling of citations in notes, which led to commas at the end of+ sentences in some cases.+ + Cleanup and efficiency improvement in `deNote`.+ + Improve punctuation moving with `--citeproc`. Previously, using+ `--citeproc` could cause punctuation to move in quotes even when+ there aer no citations. This has been changed; punctuation moving+ is now limited to citations. In addition, we only move footnotes+ around punctuation if the style is a note style, even if+ `notes-after-punctuation` is `true`.++ * Use citeproc 0.10. This helps improve note citations (see above)+ and eliminates double hyperlinks in author-in-text citations.+ Author-only citations are no longer hyperlinked. See jgm/citeproc#77.+ It also fixes moving of punctuation inside quotes to conform to+ the CSL spec: only comma and period are moved, not question+ mark or exclamation point.++ * Text.Pandoc.Error: fix line calculations in reporting parsec errors.+ Also remove a spurious initial newline in the error report.++ * Use doctemplates 0.4.1, which gives us better support for boolean+ variable values. Previously `$if(foo)$` would evaluate to true+ for variables with boolean `false` values, because it cared only+ about the string rendering (#7402).++ * Require commonmark-pandoc >= 0.2.2.1.+ This fixes task lists with multiple paragraphs.++ * Use skylighting 0.11.++ * CSS in HTML template: reset overflow-wrap on code blocks+ (Mauro Bieg, #7423).++ * LaTeX template: Revert change in PR #7295: "move title, author, date up+ to top of preamble." The change caused problem for people who used+ LaTeX commands defined defined later in the preamble in the title+ or author fields (#7422).++ * Add `doc/faqs.md`. This is imported from the website; in the future the+ website version will be drawn from here.+ Added a FAQ on the use of `\AtEndPreamble` for cases when the contents of+ `header-includes` need to refer to definitions that come later in the+ preamble. See #7422.++ * Upgrade Debian 10 AMI for build-arm.sh.++ * CircleCI: change to using xcode 11.1.0 (macOS 10.14.4).+ We previously built on 10.13, but 10.13 no longer gets+ security updates and CirclCI is deprecating.+ ## pandoc 2.14.0.3 (2021-06-22) * Text.Pandoc.MediaBag `insertMediaBag`: ensure we get a sane mediaPath
data/templates/default.latex view
@@ -36,36 +36,7 @@ $classoption$$sep$, $endfor$ ]{$documentclass$}-$if(title)$-\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}-$endif$-$if(subtitle)$ $if(beamer)$-$else$-\usepackage{etoolbox}-\makeatletter-\providecommand{\subtitle}[1]{% add subtitle to \maketitle- \apptocmd{\@title}{\par {\large #1 \par}}{}{}-}-\makeatother-$endif$-\subtitle{$subtitle$}-$endif$-\author{$for(author)$$author$$sep$ \and $endfor$}-\date{$date$}-$if(beamer)$-$if(institute)$-\institute{$for(institute)$$institute$$sep$ \and $endfor$}-$endif$-$if(titlegraphic)$-\titlegraphic{\includegraphics{$titlegraphic$}}-$endif$-$if(logo)$-\logo{\includegraphics{$logo$}}-$endif$-$endif$--$if(beamer)$ $if(background-image)$ \usebackgroundtemplate{% \includegraphics[width=\paperwidth]{$background-image$}%@@ -450,6 +421,35 @@ $endif$ $if(csquotes)$ \usepackage{csquotes}+$endif$++$if(title)$+\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}+$endif$+$if(subtitle)$+$if(beamer)$+$else$+\usepackage{etoolbox}+\makeatletter+\providecommand{\subtitle}[1]{% add subtitle to \maketitle+ \apptocmd{\@title}{\par {\large #1 \par}}{}{}+}+\makeatother+$endif$+\subtitle{$subtitle$}+$endif$+\author{$for(author)$$author$$sep$ \and $endfor$}+\date{$date$}+$if(beamer)$+$if(institute)$+\institute{$for(institute)$$institute$$sep$ \and $endfor$}+$endif$+$if(titlegraphic)$+\titlegraphic{\includegraphics{$titlegraphic$}}+$endif$+$if(logo)$+\logo{\includegraphics{$logo$}}+$endif$ $endif$ \begin{document}
data/templates/styles.html view
@@ -14,7 +14,7 @@ padding-top: $if(margin-top)$$margin-top$$else$50px$endif$; padding-bottom: $if(margin-bottom)$$margin-bottom$$else$50px$endif$; hyphens: auto;- word-wrap: break-word;+ overflow-wrap: break-word; text-rendering: optimizeLegibility; font-kerning: normal; }@@ -93,6 +93,7 @@ pre code { padding: 0; overflow: visible;+ overflow-wrap: normal; } .sourceCode { background-color: transparent;
man/pandoc.1 view
@@ -1,7 +1,7 @@ '\" t-.\" Automatically generated by Pandoc 2.14.0.1+.\" Automatically generated by Pandoc 2.14.1 .\"-.TH "Pandoc User\[cq]s Guide" "" "June 20, 2021" "pandoc 2.14.0.3" ""+.TH "Pandoc User\[cq]s Guide" "" "July 18, 2021" "pandoc 2.14.1" "" .hy .SH NAME pandoc - general markup converter@@ -7343,6 +7343,15 @@ </audio> \f[R] .fi+.PP+If the input format already is HTML then+\f[C]data-external=\[dq]1\[dq]\f[R] will work as expected for+\f[C]<img>\f[R] elements.+Similarly, for Markdown, external images can be declared with+\f[C]{external=1}\f[R].+Note that this only works for images; the other media elements have no+native representation in pandoc\[cq]s AST and requires the use of raw+HTML. .SH JUPYTER NOTEBOOKS .PP When creating a Jupyter notebook, pandoc will try to infer the notebook
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: pandoc-version: 2.14.0.3+version: 2.14.1 build-type: Simple license: GPL-2.0-or-later license-file: COPYING.md@@ -213,6 +213,7 @@ test/command/B.txt test/command/C.txt test/command/D.txt+ test/command/three.txt test/command/01.csv test/command/chap1/spider.png test/command/chap2/spider.png@@ -450,17 +451,17 @@ blaze-markup >= 0.8 && < 0.9, bytestring >= 0.9 && < 0.12, case-insensitive >= 1.2 && < 1.3,- citeproc >= 0.4.0.1 && < 0.4.1,+ citeproc >= 0.4.1 && < 0.4.2, commonmark >= 0.2.1 && < 0.3, commonmark-extensions >= 0.2.1.2 && < 0.3,- commonmark-pandoc >= 0.2.1 && < 0.3,+ commonmark-pandoc >= 0.2.1.1 && < 0.3, connection >= 0.3.1, containers >= 0.4.2.1 && < 0.7, data-default >= 0.4 && < 0.8, deepseq >= 1.3 && < 1.5, directory >= 1.2.3 && < 1.4, doclayout >= 0.3.0.1 && < 0.4,- doctemplates >= 0.9 && < 0.10,+ doctemplates >= 0.10 && < 0.11, emojis >= 0.1 && < 0.2, exceptions >= 0.8 && < 0.11, file-embed >= 0.0 && < 0.1,@@ -484,8 +485,8 @@ random >= 1 && < 1.3, safe >= 0.3.18 && < 0.4, scientific >= 0.3 && < 0.4,- skylighting >= 0.10.5.2 && < 0.10.6,- skylighting-core >= 0.10.5.2 && < 0.10.6,+ skylighting >= 0.11 && < 0.12,+ skylighting-core >= 0.11 && < 0.12, split >= 0.2 && < 0.3, syb >= 0.1 && < 0.8, tagsoup >= 0.14.6 && < 0.15,@@ -755,7 +756,7 @@ bytestring >= 0.9 && < 0.12, containers >= 0.4.2.1 && < 0.7, directory >= 1.2.3 && < 1.4,- doctemplates >= 0.9 && < 0.10,+ doctemplates >= 0.10 && < 0.11, exceptions >= 0.8 && < 0.11, filepath >= 1.1 && < 1.5, hslua >= 1.1 && < 1.4,
src/Text/Pandoc/Citeproc.hs view
@@ -27,7 +27,7 @@ import Text.Pandoc.Extensions (pandocExtensions) import Text.Pandoc.Logging (LogMessage(..)) import Text.Pandoc.Options (ReaderOptions(..))-import Text.Pandoc.Shared (stringify, ordNub, blocksToInlines, tshow)+import Text.Pandoc.Shared (stringify, ordNub, tshow) import qualified Text.Pandoc.UTF8 as UTF8 import Text.Pandoc.Walk (query, walk, walkM) import Control.Applicative ((<|>))@@ -49,6 +49,7 @@ import System.FilePath (takeExtension) import Safe (lastMay, initSafe) + processCitations :: PandocMonad m => Pandoc -> m Pandoc processCitations (Pandoc meta bs) = do style <- getStyle (Pandoc meta bs)@@ -90,22 +91,18 @@ walk (convertQuotes locale) . insertSpace $ out) (resultBibliography result)- let moveNotes = maybe True truish $- lookupMeta "notes-after-punctuation" meta+ let moveNotes = styleIsNoteStyle sopts &&+ maybe True truish (lookupMeta "notes-after-punctuation" meta) let cits = map (walk (convertQuotes locale)) $ resultCitations result - let fixQuotes = case localePunctuationInQuote locale of- Just True ->- B.toList . movePunctuationInsideQuotes . B.fromList- _ -> id- let metanocites = lookupMeta "nocite" meta let Pandoc meta'' bs' = maybe id (setMeta "nocite") metanocites .- walk (map capitalizeNoteCitation .- fixQuotes . mvPunct moveNotes locale) .- walk deNote .+ walk (mvPunct moveNotes locale) .+ (if styleIsNoteStyle sopts+ then walk addNote . walk deNote+ else id) . evalState (walkM insertResolvedCitations $ Pandoc meta' bs) $ cits return $ Pandoc meta''@@ -375,7 +372,6 @@ isNote :: Inline -> Bool-isNote (Note _) = True isNote (Cite _ [Note _]) = True -- the following allows citation styles that are "in-text" but use superscript -- references to be treated as if they are "notes" for the purposes of moving@@ -388,6 +384,12 @@ isSpacy SoftBreak = True isSpacy _ = False +movePunctInsideQuotes :: Locale -> [Inline] -> [Inline]+movePunctInsideQuotes locale+ | localePunctuationInQuote locale == Just True+ = B.toList . movePunctuationInsideQuotes . B.fromList+ | otherwise+ = id mvPunct :: Bool -> Locale -> [Inline] -> [Inline] mvPunct moveNotes locale (x : xs)@@ -400,7 +402,8 @@ in if moveNotes then if T.null spunct then q : x : mvPunct moveNotes locale ys- else q : Str spunct : x : mvPunct moveNotes locale+ else movePunctInsideQuotes locale+ [q , Str spunct , x] ++ mvPunct moveNotes locale (B.toList (dropTextWhile isPunctuation (B.fromList ys))) else q : x : mvPunct moveNotes locale ys@@ -412,9 +415,10 @@ , moveNotes = let s = stringify ys spunct = T.takeWhile isPunctuation s- in Cite cs (init ils- ++ [Str spunct | not (endWithPunct False (init ils))]- ++ [last ils]) :+ in Cite cs (movePunctInsideQuotes locale $+ init ils+ ++ [Str spunct | not (endWithPunct False (init ils))]+ ++ [last ils]) : mvPunct moveNotes locale (B.toList (dropTextWhile isPunctuation (B.fromList ys))) mvPunct moveNotes locale (s : x : ys) | isSpacy s, isNote x =@@ -560,42 +564,62 @@ extractText (NumVal n) = T.pack (show n) extractText _ = mempty -capitalizeNoteCitation :: Inline -> Inline-capitalizeNoteCitation (Cite cs [Note [Para ils]]) =- Cite cs- [Note [Para $ B.toList $ addTextCase Nothing CapitalizeFirst- $ B.fromList ils]]-capitalizeNoteCitation x = x+-- Here we take the Spans with class csl-note that are left+-- after deNote has removed nested ones, and convert them+-- into real notes.+addNote :: Inline -> Inline+addNote (Span ("",["csl-note"],[]) ils) =+ Note [Para $+ B.toList . addTextCase Nothing CapitalizeFirst . B.fromList $ ils]+addNote x = x -deNote :: [Inline] -> [Inline]-deNote [] = []-deNote (Note bs:rest) =- Note (walk go bs) : deNote rest+-- Here we handle citation notes that occur inside footnotes+-- or other citation notes, in a note style. We don't want+-- notes inside notes, so we convert these to parenthesized+-- or comma-separated citations.+deNote :: Inline -> Inline+deNote (Note bs) =+ case bs of+ [Para (cit@(Cite (c:_) _) : ils)]+ | citationMode c /= AuthorInText ->+ -- if citation is first in note, no need to parenthesize.+ Note [Para (walk removeNotes $ cit : walk addParens ils)]+ _ -> Note (walk removeNotes . walk addParens $ bs)+ where- go [] = []- go (Cite (c:cs) ils : zs)+ addParens [] = []+ addParens (Cite (c:cs) ils : zs) | citationMode c == AuthorInText- = Cite (c:cs) (concatMap (noteAfterComma (needsPeriod zs)) ils) : go zs+ = Cite (c:cs) (concatMap (noteAfterComma (needsPeriod zs)) ils) :+ addParens zs | otherwise- = Cite (c:cs) (concatMap noteInParens ils) : go zs- go (x:xs) = x : go xs+ = Cite (c:cs) (concatMap noteInParens ils) : addParens zs+ addParens (x:xs) = x : addParens xs++ removeNotes (Span ("",["csl-note"],[]) ils) = Span ("",[],[]) ils+ removeNotes x = x+ needsPeriod [] = True needsPeriod (Str t:_) = case T.uncons t of Nothing -> False Just (c,_) -> isUpper c needsPeriod (Space:zs) = needsPeriod zs needsPeriod _ = False- noteInParens (Note bs')++ noteInParens (Span ("",["csl-note"],[]) ils) = Space : Str "(" :- removeFinalPeriod (blocksToInlines bs') ++ [Str ")"]+ removeFinalPeriod ils ++ [Str ")"] noteInParens x = [x]- noteAfterComma needsPer (Note bs')++ noteAfterComma needsPer (Span ("",["csl-note"],[]) ils)+ | not (null ils) = Str "," : Space :- (if needsPer- then id- else removeFinalPeriod) (blocksToInlines bs')+ if needsPer+ then ils+ else removeFinalPeriod ils noteAfterComma _ x = [x]-deNote (x:xs) = x : deNote xs++deNote x = x -- Note: we can't use dropTextWhileEnd indiscriminately, -- because this would remove the final period on abbreviations like Ibid.
src/Text/Pandoc/Citeproc/BibTeX.hs view
@@ -71,9 +71,11 @@ filter (\item -> idpred (identifier item) && entryType item /= "xdata")) (fromMaybe defaultLang $ localeLanguage locale, Map.empty)- "" (toSources contents) of+ (initialSourceName sources) sources of Left err -> Left err Right xs -> return xs+ where+ sources = toSources contents -- | Write BibTeX or BibLaTeX given given a 'Reference'. writeBibtexString :: WriterOptions -- ^ options (for writing LaTex)@@ -866,7 +868,7 @@ isBibtexKeyChar :: Char -> Bool isBibtexKeyChar c =- isAlphaNum c || c `elem` (".:;?!`'()/*@_+=-[]*&" :: [Char])+ isAlphaNum c || c `elem` (".:;?!`'()$/*@_+=-[]*&" :: [Char]) bibItem :: BibParser Item bibItem = do
src/Text/Pandoc/Class/IO.hs view
@@ -226,6 +226,6 @@ case lookupMedia (T.unpack src) mediabag of Nothing -> Image attr lab (src, tit) Just item ->- let fullpath = dir </> mediaPath item+ let fullpath = dir <> "/" <> mediaPath item in Image attr lab (T.pack fullpath, tit) adjustImagePath _ _ x = x
src/Text/Pandoc/Error.hs view
@@ -97,13 +97,13 @@ [] -> "" ((pos,txt):_) -> let ls = T.lines txt <> [""]- ln = errLine - sourceLine pos- in if length ls > ln - 1+ ln = (errLine - sourceLine pos) + 1+ in if length ls > ln && ln >= 1 then T.concat ["\n", ls !! (ln - 1) ,"\n", T.replicate (errColumn - 1) " " ,"^"] else ""- in "\nError at " <> tshow err' <> errorInFile+ in "Error at " <> tshow err' <> errorInFile PandocMakePDFError s -> s PandocOptionError s -> s PandocSyntaxMapError s -> s
src/Text/Pandoc/ImageSize.hs view
@@ -57,7 +57,8 @@ -- quick and dirty functions to get image sizes -- algorithms borrowed from wwwis.pl -data ImageType = Png | Gif | Jpeg | Svg | Pdf | Eps | Emf deriving Show+data ImageType = Png | Gif | Jpeg | Svg | Pdf | Eps | Emf | Tiff+ deriving Show data Direction = Width | Height instance Show Direction where show Width = "width"@@ -100,6 +101,8 @@ imageType img = case B.take 4 img of "\x89\x50\x4e\x47" -> return Png "\x47\x49\x46\x38" -> return Gif+ "\x49\x49\x2a\x00" -> return Tiff+ "\x4D\x4D\x00\x2a" -> return Tiff "\xff\xd8\xff\xe0" -> return Jpeg -- JFIF "\xff\xd8\xff\xe1" -> return Jpeg -- Exif "%PDF" -> return Pdf@@ -124,6 +127,7 @@ Just Png -> getSize img Just Gif -> getSize img Just Jpeg -> getSize img+ Just Tiff -> getSize img Just Svg -> mbToEither "could not determine SVG size" $ svgSize opts img Just Eps -> mbToEither "could not determine EPS size" $ epsSize img Just Pdf -> mbToEither "could not determine PDF size" $ pdfSize img
src/Text/Pandoc/PDF.hs view
@@ -215,9 +215,9 @@ E.catch (Right pngOut <$ JP.savePngImage pngOut img) $ \(e :: E.SomeException) -> return (Left (tshow e)) where- pngOut = replaceDirectory (replaceExtension fname ".png") tmpdir- pdfOut = replaceDirectory (replaceExtension fname ".pdf") tmpdir- svgIn = tmpdir </> fname+ pngOut = normalise $ replaceDirectory (replaceExtension fname ".png") tmpdir+ pdfOut = normalise $ replaceDirectory (replaceExtension fname ".pdf") tmpdir+ svgIn = normalise fname mime = getMimeType fname doNothing = return (Right fname)
src/Text/Pandoc/Readers/DocBook.hs view
@@ -97,7 +97,7 @@ [x] chapterinfo - Meta-information for a Chapter [ ] citation - An inline bibliographic reference to another published work [ ] citebiblioid - A citation of a bibliographic identifier-[ ] citerefentry - A citation to a reference page+[x] citerefentry - A citation to a reference page [ ] citetitle - The title of a cited work [ ] city - The name of a city in an address [x] classname - The name of a class, in the object-oriented programming sense@@ -741,9 +741,9 @@ figTitle <- gets dbFigureTitle ident <- gets dbFigureId (imageUrl, attr) <-- case filterChild (named "imageobject") e of- Nothing -> return (mempty, nullAttr)- Just z -> case filterChild (named "imagedata") z of+ case filterElements (named "imageobject") e of+ [] -> return (mempty, nullAttr)+ (z:_) -> case filterChild (named "imagedata") z of Nothing -> return (mempty, nullAttr) Just i -> let atVal a = attrValue a i w = case atVal "width" of@@ -1112,6 +1112,10 @@ "segmentedlist" -> segmentedList "classname" -> codeWithLang "code" -> codeWithLang+ "citerefentry" -> do+ let title = maybe mempty strContent $ filterChild (named "refentrytitle") e+ let manvolnum = maybe mempty (\el -> "(" <> strContent el <> ")") $ filterChild (named "manvolnum") e+ return $ codeWith ("",["citerefentry"],[]) (title <> manvolnum) "filename" -> codeWithLang "envar" -> codeWithLang "literal" -> codeWithLang
src/Text/Pandoc/Readers/HTML.hs view
@@ -722,17 +722,12 @@ pImage :: PandocMonad m => TagParser m Inlines pImage = do- tag <- pSelfClosing (=="img") (isJust . lookup "src")+ tag@(TagOpen _ attr') <- pSelfClosing (=="img") (isJust . lookup "src") url <- canonicalizeUrl $ fromAttrib "src" tag let title = fromAttrib "title" tag let alt = fromAttrib "alt" tag- let uid = fromAttrib "id" tag- let cls = T.words $ fromAttrib "class" tag- let getAtt k = case fromAttrib k tag of- "" -> []- v -> [(k, v)]- let kvs = concatMap getAtt ["width", "height", "sizes", "srcset"]- return $ B.imageWith (uid, cls, kvs) (escapeURI url) title (B.text alt)+ let attr = toAttr $ filter (\(k,_) -> k /= "alt" && k /= "title" && k /= "src") attr'+ return $ B.imageWith attr (escapeURI url) title (B.text alt) pSvg :: PandocMonad m => TagParser m Inlines pSvg = do
src/Text/Pandoc/Readers/HTML/Parsing.hs view
@@ -161,10 +161,12 @@ "li" `closes` "li" = True "th" `closes` t | t `elem` ["th","td"] = True "td" `closes` t | t `elem` ["th","td"] = True-"tr" `closes` t | t `elem` ["th","td","tr"] = True+"tr" `closes` t | t `elem` ["th","td","tr","colgroup"] = True "dd" `closes` t | t `elem` ["dt", "dd"] = True "dt" `closes` t | t `elem` ["dt","dd"] = True "rt" `closes` t | t `elem` ["rb", "rt", "rtc"] = True+"col" `closes` "col" = True+"colgroup" `closes` "col" = True "optgroup" `closes` "optgroup" = True "optgroup" `closes` "option" = True "option" `closes` "option" = True
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -136,8 +136,7 @@ => ParserT Sources s m Text rawLaTeXBlock = do lookAhead (try (char '\\' >> letter))- inp <- getInput- let toks = tokenizeSources inp+ toks <- getInputTokens snd <$> (rawLaTeXParser toks False (macroDef (const mempty)) blocks <|> rawLaTeXParser toks True (do choice (map controlSeq@@ -167,8 +166,7 @@ => ParserT Sources s m Text rawLaTeXInline = do lookAhead (try (char '\\' >> letter))- inp <- getInput- let toks = tokenizeSources inp+ toks <- getInputTokens raw <- snd <$> ( rawLaTeXParser toks True (mempty <$ (controlSeq "input" >> skipMany rawopt >> braced))@@ -182,8 +180,7 @@ inlineCommand :: PandocMonad m => ParserT Sources ParserState m Inlines inlineCommand = do lookAhead (try (char '\\' >> letter))- inp <- getInput- let toks = tokenizeSources inp+ toks <- getInputTokens fst <$> rawLaTeXParser toks True (inlineEnvironment <|> inlineCommand') inlines
src/Text/Pandoc/Readers/LaTeX/Lang.hs view
@@ -105,7 +105,7 @@ "locale=morocco" -> Lang "ar" Nothing (Just "MA") [] [] [] "locale=mauritania" -> Lang "ar" Nothing (Just "MR") [] [] [] "locale=tunisia" -> Lang "ar" Nothing (Just "TN") [] [] []- _ -> Lang "ar" Nothing (Just "") [] [] [])+ _ -> Lang "ar" Nothing Nothing [] [] []) , ("german", \o -> case T.filter (/=' ') o of "spelling=old" -> Lang "de" Nothing (Just "DE") ["1901"] [] [] "variant=austrian,spelling=old"@@ -126,7 +126,7 @@ "variant=british" -> Lang "en" Nothing (Just "GB") [] [] [] "variant=newzealand" -> Lang "en" Nothing (Just "NZ") [] [] [] "variant=american" -> Lang "en" Nothing (Just "US") [] [] []- _ -> Lang "en" Nothing (Just "") [] [] [])+ _ -> Lang "en" Nothing Nothing [] [] []) , ("usorbian", \_ -> Lang "hsb" Nothing Nothing [] [] []) , ("latin", \o -> case T.filter (/=' ') o of "variant=classic" -> Lang "la" Nothing Nothing ["x-classic"] [] []
src/Text/Pandoc/Readers/LaTeX/Parsing.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-}@@ -28,6 +29,7 @@ , applyMacros , tokenize , tokenizeSources+ , getInputTokens , untokenize , untoken , totoks@@ -246,18 +248,23 @@ updateState $ \st -> st{ sVerbatimMode = False } return result -rawLaTeXParser :: (PandocMonad m, HasMacros s, HasReaderOptions s)+rawLaTeXParser :: (PandocMonad m, HasMacros s, HasReaderOptions s, Show a) => [Tok] -> Bool -> LP m a -> LP m a -> ParserT Sources s m (a, Text) rawLaTeXParser toks retokenize parser valParser = do pstate <- getState let lstate = def{ sOptions = extractReaderOptions pstate } let lstate' = lstate { sMacros = extractMacros pstate }+ let setStartPos = case toks of+ Tok pos _ _ : _ -> setPosition pos+ _ -> return ()+ let preparser = setStartPos >> parser let rawparser = (,) <$> withRaw valParser <*> getState- res' <- lift $ runParserT (snd <$> withRaw parser) lstate "chunk" toks+ res' <- lift $ runParserT (withRaw (preparser >> getPosition))+ lstate "chunk" toks case res' of Left _ -> mzero- Right toks' -> do+ Right (endpos, toks') -> do res <- lift $ runParserT (do when retokenize $ do -- retokenize, applying macros ts <- many (satisfyTok (const True))@@ -268,7 +275,13 @@ Left _ -> mzero Right ((val, raw), st) -> do updateState (updateMacros (sMacros st <>))- void $ count (T.length (untokenize toks')) anyChar+ let skipTilPos stopPos = do+ anyChar+ pos <- getPosition+ if pos >= stopPos+ then return ()+ else skipTilPos stopPos+ skipTilPos endpos let result = untokenize raw -- ensure we end with space if input did, see #4442 let result' =@@ -306,6 +319,17 @@ where tokenizeSource (pos, t) = totoks pos t +-- Return tokens from input sources. Ensure that starting position is+-- correct.+getInputTokens :: PandocMonad m => ParserT Sources s m [Tok]+getInputTokens = do+ pos <- getPosition+ ss <- getInput+ return $+ case ss of+ Sources [] -> []+ Sources ((_,t):rest) -> tokenizeSources $ Sources ((pos,t):rest)+ tokenize :: SourceName -> Text -> [Tok] tokenize sourcename = totoks (initialPos sourcename) @@ -433,8 +457,13 @@ parseFromToks parser toks = do oldInput <- getInput setInput toks+ oldpos <- getPosition+ case toks of+ Tok pos _ _ : _ -> setPosition pos+ _ -> return () result <- disablingWithRaw parser setInput oldInput+ setPosition oldpos return result disablingWithRaw :: PandocMonad m => LP m a -> LP m a@@ -458,7 +487,7 @@ | otherwise = Nothing updatePos :: SourcePos -> Tok -> [Tok] -> SourcePos updatePos _spos _ (Tok pos _ _ : _) = pos- updatePos spos _ [] = incSourceColumn spos 1+ updatePos spos (Tok _ _ t) [] = incSourceColumn spos (T.length t) doMacros :: PandocMonad m => LP m () doMacros = do
src/Text/Pandoc/Readers/LaTeX/Table.hs view
@@ -41,6 +41,7 @@ hline = try $ do spaces controlSeq "hline" <|>+ (controlSeq "cline" <* braced) <|> -- booktabs rules: controlSeq "toprule" <|> controlSeq "bottomrule" <|>
src/Text/Pandoc/Readers/Markdown.hs view
@@ -1121,6 +1121,7 @@ rawHtmlBlocks :: PandocMonad m => MarkdownParser m (F Blocks) rawHtmlBlocks = do (TagOpen tagtype _, raw) <- htmlTag isBlockTag+ let selfClosing = "/>" `T.isSuffixOf` raw -- we don't want '<td> text' to be a code block: skipMany spaceChar indentlevel <- (blankline >> length <$> many (char ' ')) <|> return 0@@ -1134,7 +1135,9 @@ gobbleAtMostSpaces indentlevel notFollowedBy' closer block- contents <- mconcat <$> many block'+ contents <- if selfClosing+ then return mempty+ else mconcat <$> many block' result <- try (do gobbleAtMostSpaces indentlevel
src/Text/Pandoc/Readers/RST.hs view
@@ -474,6 +474,7 @@ case lookup "literal" fields of Just _ -> B.rawBlock "rst" . sourcesToText <$> getInput Nothing -> parseBlocks+ let isLiteral = isJust (lookup "code" fields `mplus` lookup "literal" fields) let selectLines = (case trim <$> lookup "end-before" fields of Just patt -> takeWhile (not . (patt `T.isInfixOf`))@@ -482,8 +483,11 @@ Just patt -> drop 1 . dropWhile (not . (patt `T.isInfixOf`)) Nothing -> id)+ let toStream t =- toSources [(f, T.unlines . selectLines . T.lines $ t)]+ Sources [(initialPos f,+ (T.unlines . selectLines . T.lines $ t) <>+ if isLiteral then mempty else "\n")] -- see #7436 currentDir <- takeDirectory . sourceName <$> getPosition insertIncludedFile parser toStream [currentDir] f startLine endLine
src/Text/Pandoc/Writers/Docx.hs view
@@ -36,7 +36,8 @@ import Data.Digest.Pure.SHA (sha1, showDigest) import Skylighting import Text.Collate.Lang (renderLang)-import Text.Pandoc.Class.PandocMonad (PandocMonad, report, toLang)+import Text.Pandoc.Class.PandocMonad (PandocMonad, report, toLang, translateTerm)+import qualified Text.Pandoc.Translations as Term import qualified Text.Pandoc.Class.PandocMonad as P import Data.Time import Text.Pandoc.UTF8 (fromTextLazy)@@ -854,14 +855,28 @@ -- title beginning with fig: indicates that the image is a figure blockToOpenXML' opts (Para [Image attr alt (src,T.stripPrefix "fig:" -> Just tit)]) = do setFirstPara+ fignum <- gets stNextFigureNum+ unless (null alt) $ modify $ \st -> st{ stNextFigureNum = fignum + 1 }+ let figid = "fig" <> tshow fignum+ figname <- translateTerm Term.Figure prop <- pStyleM $ if null alt then "Figure" else "Captioned Figure" paraProps <- local (\env -> env { envParaProperties = EnvProps (Just prop) [] <> envParaProperties env }) (getParaProps False) contents <- inlinesToOpenXML opts [Image attr alt (src,tit)]- captionNode <- withParaPropM (pStyleM "Image Caption")- $ blockToOpenXML opts (Para alt)+ captionNode <- if null alt+ then return []+ else withParaPropM (pStyleM "Image Caption")+ $ blockToOpenXML opts+ (Para $ Span (figid,[],[])+ [Str (figname <> "\160"),+ RawInline (Format "openxml")+ ("<w:fldSimple w:instr=\"SEQ Figure"+ <> " \\* ARABIC \"><w:r><w:t>"+ <> tshow fignum+ <> "</w:t></w:r></w:fldSimple>"),+ Str ":", Space] : alt) return $ Elem (mknode "w:p" [] (map Elem paraProps ++ contents)) : captionNode@@ -1289,6 +1304,7 @@ Just Eps -> ".eps" Just Svg -> ".svg" Just Emf -> ".emf"+ Just Tiff -> ".tiff" Nothing -> "" imgpath = "media/" <> ident <> imgext mbMimeType = mt <|> getMimeType (T.unpack imgpath)
src/Text/Pandoc/Writers/Docx/Table.hs view
@@ -17,7 +17,7 @@ import Data.Array import Data.Text (Text) import Text.Pandoc.Definition-import Text.Pandoc.Class.PandocMonad (PandocMonad)+import Text.Pandoc.Class.PandocMonad (PandocMonad, translateTerm) import Text.Pandoc.Writers.Docx.Types import Text.Pandoc.Shared import Text.Printf (printf)@@ -25,6 +25,7 @@ import Text.Pandoc.Writers.OOXML import Text.Pandoc.XML.Light as XML hiding (Attr) import qualified Data.Text as T+import qualified Text.Pandoc.Translations as Term import qualified Text.Pandoc.Writers.GridTable as Grid tableToOpenXML :: PandocMonad m@@ -33,15 +34,23 @@ -> WS m [Content] tableToOpenXML blocksToOpenXML gridTable = do setFirstPara- let (Grid.Table _attr caption colspecs _rowheads thead tbodies tfoot) =+ let (Grid.Table (ident,_,_) caption colspecs _rowheads thead tbodies tfoot) = gridTable let (Caption _maybeShortCaption captionBlocks) = caption+ tablenum <- gets stNextTableNum+ unless (null captionBlocks) $+ modify $ \st -> st{ stNextTableNum = tablenum + 1 }+ let tableid = if T.null ident+ then "table" <> tshow tablenum+ else ident+ tablename <- translateTerm Term.Table let captionStr = stringify captionBlocks let aligns = map fst $ elems colspecs captionXml <- if null captionBlocks then return [] else withParaPropM (pStyleM "Table Caption")- $ blocksToOpenXML captionBlocks+ $ blocksToOpenXML+ $ addLabel tableid tablename tablenum captionBlocks -- We set "in table" after processing the caption, because we don't -- want the "Table Caption" style to be overwritten with "Compact". modify $ \s -> s { stInTable = True }@@ -80,6 +89,22 @@ ) modify $ \s -> s { stInTable = False } return $ captionXml ++ [Elem tbl]++addLabel :: Text -> Text -> Int -> [Block] -> [Block]+addLabel tableid tablename tablenum bs =+ case bs of+ (Para ils : rest) -> Para (label : Space : ils) : rest+ (Plain ils : rest) -> Plain (label : Space : ils) : rest+ _ -> Para [label] : bs+ where+ label = Span (tableid,[],[])+ [Str (tablename <> "\160"),+ RawInline (Format "openxml")+ ("<w:fldSimple w:instr=\"SEQ Table"+ <> " \\* ARABIC \"><w:r><w:t>"+ <> tshow tablenum+ <> "</w:t></w:r></w:fldSimple>"),+ Str ":"] -- | Parts of a table data RowType = HeadRow | BodyRow | FootRow
src/Text/Pandoc/Writers/Docx/Types.hs view
@@ -117,6 +117,8 @@ , stDynamicParaProps :: Set.Set ParaStyleName , stDynamicTextProps :: Set.Set CharStyleName , stCurId :: Int+ , stNextFigureNum :: Int+ , stNextTableNum :: Int } defaultWriterState :: WriterState@@ -137,6 +139,8 @@ , stDynamicParaProps = Set.empty , stDynamicTextProps = Set.empty , stCurId = 20+ , stNextFigureNum = 1+ , stNextTableNum = 1 } setFirstPara :: PandocMonad m => WS m ()
src/Text/Pandoc/Writers/EPUB.hs view
@@ -1131,7 +1131,8 @@ => WriterOptions -> Inline -> E m Inline-transformInline _opts (Image attr lab (src,tit)) = do+transformInline _opts (Image attr@(_,_,kvs) lab (src,tit))+ | isNothing (lookup "external" kvs) = do newsrc <- modifyMediaRef $ T.unpack src return $ Image attr lab ("../" <> newsrc, tit) transformInline opts x@(Math t m)
src/Text/Pandoc/Writers/HTML.hs view
@@ -317,10 +317,6 @@ | otherwise -> mempty Nothing -> mempty let mCss :: Maybe [Text] = lookupContext "css" metadata- let true :: Text- true = "true"- let false :: Text- false = "false" let context = (if stHighlighting st then case writerHighlightStyle opts of Just sty -> defField "highlighting-css"@@ -351,43 +347,43 @@ (if slideVariant == RevealJsSlides then -- set boolean options explicitly, since -- template can't distinguish False/undefined- defField "controls" true .- defField "controlsTutorial" true .+ defField "controls" True .+ defField "controlsTutorial" True . defField "controlsLayout" ("bottom-right" :: Text) . defField "controlsBackArrows" ("faded" :: Text) .- defField "progress" true .- defField "slideNumber" false .+ defField "progress" True .+ defField "slideNumber" False . defField "showSlideNumber" ("all" :: Text) .- defField "hashOneBasedIndex" false .- defField "hash" false .- defField "respondToHashChanges" true .- defField "history" false .- defField "keyboard" true .- defField "overview" true .- defField "disableLayout" false .- defField "center" true .- defField "touch" true .- defField "loop" false .- defField "rtl" false .+ defField "hashOneBasedIndex" False .+ defField "hash" False .+ defField "respondToHashChanges" True .+ defField "history" False .+ defField "keyboard" True .+ defField "overview" True .+ defField "disableLayout" False .+ defField "center" True .+ defField "touch" True .+ defField "loop" False .+ defField "rtl" False . defField "navigationMode" ("default" :: Text) .- defField "shuffle" false .- defField "fragments" true .- defField "fragmentInURL" true .- defField "embedded" false .- defField "help" true .- defField "pause" true .- defField "showNotes" false .+ defField "shuffle" False .+ defField "fragments" True .+ defField "fragmentInURL" True .+ defField "embedded" False .+ defField "help" True .+ defField "pause" True .+ defField "showNotes" False . defField "autoPlayMedia" ("null" :: Text) . defField "preloadIframes" ("null" :: Text) . defField "autoSlide" ("0" :: Text) .- defField "autoSlideStoppable" true .+ defField "autoSlideStoppable" True . defField "autoSlideMethod" ("null" :: Text) . defField "defaultTiming" ("null" :: Text) .- defField "mouseWheel" false .+ defField "mouseWheel" False . defField "display" ("block" :: Text) .- defField "hideInactiveCursor" true .+ defField "hideInactiveCursor" True . defField "hideCursorTime" ("5000" :: Text) .- defField "previewLinks" false .+ defField "previewLinks" False . defField "transition" ("slide" :: Text) . defField "transitionSpeed" ("default" :: Text) . defField "backgroundTransition" ("fade" :: Text) .@@ -663,17 +659,20 @@ figure :: PandocMonad m => WriterOptions -> Attr -> [Inline] -> (Text, Text) -> StateT WriterState m Html-figure opts attr txt (s,tit) = do+figure opts attr@(_, _, attrList) txt (s,tit) = do html5 <- gets stHtml5 -- Screen-readers will normally read the @alt@ text and the figure; we -- want to avoid them reading the same text twice. With HTML5 we can -- use aria-hidden for the caption; with HTML4, we use an empty -- alt-text instead.+ -- When the alt text differs from the caption both should be read. let alt = if html5 then txt else [Str ""] let tocapt = if html5- then H5.figcaption !- H5.customAttribute (textTag "aria-hidden")- (toValue @Text "true")+ then (H5.figcaption !) $+ if isJust (lookup "alt" attrList)+ then mempty+ else H5.customAttribute (textTag "aria-hidden")+ (toValue @Text "true") else H.p ! A.class_ "caption" img <- inlineToHtml opts (Image attr alt (s,tit)) capt <- if null txt@@ -1437,7 +1436,7 @@ return $ if T.null tit then link' else link' ! A.title (toValue tit)- (Image attr txt (s,tit)) -> do+ (Image attr@(_, _, attrList) txt (s, tit)) -> do let alternate = stringify txt slideVariant <- gets stSlideVariant let isReveal = slideVariant == RevealJsSlides@@ -1450,7 +1449,8 @@ [A.title $ toValue tit | not (T.null tit)] ++ attrs imageTag = (if html5 then H5.img else H.img- , [A.alt $ toValue alternate | not (null txt)] )+ , [A.alt $ toValue alternate | not (null txt) &&+ isNothing (lookup "alt" attrList)] ) mediaTag tg fallbackTxt = let linkTxt = if null txt then fallbackTxt
src/Text/Pandoc/Writers/Markdown.hs view
@@ -791,6 +791,9 @@ b1 : commentSep : fixBlocks (b2:bs) fixBlocks (Plain ils : bs@(RawBlock{}:_)) = Plain ils : fixBlocks bs+ fixBlocks (Plain ils : bs@(Div{}:_))+ | isEnabled Ext_fenced_divs opts =+ Para ils : fixBlocks bs fixBlocks (Plain ils : bs) | inlist = Plain ils : fixBlocks bs fixBlocks (Plain ils : bs) =
src/Text/Pandoc/Writers/Powerpoint/Output.hs view
@@ -537,6 +537,7 @@ Just Eps -> Just ".eps" Just Svg -> Just ".svg" Just Emf -> Just ".emf"+ Just Tiff -> Just ".tiff" Nothing -> Nothing let newGlobalId = fromMaybe (maxGlobalId + 1) (M.lookup fp globalIds)
stack.yaml view
@@ -8,8 +8,11 @@ - '.' extra-deps: - commonmark-0.2.1-- skylighting-core-0.10.5.2-- skylighting-0.10.5.2+- commonmark-pandoc-0.2.1.1+- skylighting-core-0.11+- skylighting-0.11+- doctemplates-0.10+- citeproc-0.4.1 ghc-options: "$locals": -fhide-source-paths -Wno-missing-home-modules resolver: lts-18.0
test/Tests/Readers/HTML.hs view
@@ -74,6 +74,12 @@ [ test html "anchor without href" $ "<a name=\"anchor\"/>" =?> plain (spanWith ("anchor",[],[]) mempty) ]+ , testGroup "img"+ [ test html "data-external attribute" $ "<img data-external=\"1\" src=\"http://example.com/stickman.gif\">" =?>+ plain (imageWith ("", [], [("external", "1")]) "http://example.com/stickman.gif" "" "")+ , test html "title" $ "<img title=\"The title\" src=\"http://example.com/stickman.gif\">" =?>+ plain (imageWith ("", [], []) "http://example.com/stickman.gif" "The title" "")+ ] , testGroup "lang" [ test html "lang on <html>" $ "<html lang=\"es\">hola" =?> setMeta "lang" (text "es") (doc (plain (text "hola")))
test/Tests/Writers/OOXML.hs view
@@ -55,7 +55,9 @@ -> IO Archive testArchive writerFn opts fp = do txt <- T.readFile fp- bs <- runIOorExplode $ readNative def txt >>= writerFn opts+ bs <- runIOorExplode $ do+ setTranslations "en-US"+ readNative def txt >>= writerFn opts return $ toArchive bs compareFileList :: FilePath -> Archive -> Archive -> Maybe String
+ test/command/4465.md view
@@ -0,0 +1,15 @@+```+% pandoc -f html -t markdown+<ol>+ <li>An ordered list can contain block-level elements ind html, it means that divs are also allowed.</li>+ <li>Let's see the problem! <div class="example">This is an example.</div></li>+</ol>+^D+1. An ordered list can contain block-level elements ind html, it means+ that divs are also allowed.+2. Let\'s see the problem!++ ::: example+ This is an example.+ :::+```
test/command/6890.md view
@@ -23,12 +23,12 @@ @fruchtel-sozialer-2013a -Some text [^1].+Some text.[^1] [^1]: @fruchtel-sozialer-2013a ^D [Para [Cite [Citation {citationId = "fruchtel-sozialer-2013a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 1, citationHash = 0}] [Str "Fr\252chtel,",Space,Str "Budde,",Space,Str "and",Space,Str "Cyprian",Space,Str "(2013)"]]-,Para [Str "Some",Space,Str "text",Str ".",Note [Para [Cite [Citation {citationId = "fruchtel-sozialer-2013a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 2, citationHash = 0}] [Str "Fr\252chtel,",Space,Str "Budde,",Space,Str "and",Space,Str "Cyprian",Space,Str "(2013)"]]],Str ""]+,Para [Str "Some",Space,Str "text.",Note [Para [Cite [Citation {citationId = "fruchtel-sozialer-2013a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 2, citationHash = 0}] [Str "Fr\252chtel,",Space,Str "Budde,",Space,Str "and",Space,Str "Cyprian",Space,Str "(2013)"]]]] ,Div ("refs",["references","csl-bib-body","hanging-indent"],[]) [Div ("ref-fruchtel-sozialer-2013a",["csl-entry"],[]) [Para [Str "Fr\252chtel,",Space,Str "Frank,",Space,Str "Wolfgang",Space,Str "Budde,",Space,Str "and",Space,Str "Gudrun",Space,Str "Cyprian.",Space,Str "2013.",Space,Emph [Str "Sozialer",Space,Str "Raum",Space,Str "und",Space,Str "Soziale",Space,Str "Arbeit",Space,Str "Fieldbook:",Space,Str "Methoden",Space,Str "und",Space,Str "Techniken"],Str ".",Space,Str "3rd",Space,Str "ed.",Space,Str "Wiesbaden,",Space,Str "Germany:",Space,Str "Springer",Space,Str "VS."]]]]
+ test/command/7394.md view
@@ -0,0 +1,85 @@+```+% pandoc -f markdown -t plain --citeproc+---+csl: command/chicago-fullnote-bibliography.csl+references:+- author:+ - family: Wandt+ given: Manfred+ edition: 6+ id: wandt2014ges-sv+ issued: 2014+ publisher: Franz Vahlen+ publisher-place: München+ title: Gesetzliche schuldverhältnisse+ title-short: Gesetzl SV+ type: book+- author:+ - family: Smith+ given: Zenda+ edition: 6+ id: smith2015+ issued: 2015+ publisher: Macmillan+ publisher-place: New York+ title: A verb and a noun+ type: book+---++Hi^[@wandt2014ges-sv.].++Hi^[[@wandt2014ges-sv].].++Hi^[[See also @wandt2014ges-sv].].++Hi^[See also @wandt2014ges-sv.].++Hi^[@wandt2014ges-sv [@smith2015].].++Hi^[[@wandt2014ges-sv; @smith2015].].++Hi [@wandt2014ges-sv].++Hi [see also @wandt2014ges-sv].++^D+Hi[1].++Hi[2].++Hi[3].++Hi[4].++Hi[5].++Hi[6].++Hi.[7]++Hi.[8]++Smith, Zenda. A Verb and a Noun. 6th ed. New York: Macmillan, 2015.++Wandt, Manfred. Gesetzliche Schuldverhältnisse. 6th ed. München: Franz+Vahlen, 2014.++[1] Manfred Wandt, Gesetzliche Schuldverhältnisse, 6th ed. (München:+Franz Vahlen, 2014).++[2] Wandt.++[3] See also Wandt.++[4] See also Wandt.++[5] Wandt, Zenda Smith, A Verb and a Noun, 6th ed. (New York: Macmillan,+2015).++[6] Wandt, Gesetzl SV; Smith, A Verb and a Noun.++[7] Wandt, Gesetzl SV.++[8] See also Wandt.+```+
+ test/command/7416.md view
@@ -0,0 +1,19 @@+```+% pandoc -f markdown -t html+{alt="alt"}++^D+<figure>+<img src="../media/rId25.jpg" title="title" alt="alt" /><figcaption>caption</figcaption>+</figure>+```++```+% pandoc -f markdown -t html+++^D+<figure>+<img src="../media/rId25.jpg" title="title" alt="caption" /><figcaption aria-hidden="true">caption</figcaption>+</figure>+```
+ test/command/7434.md view
@@ -0,0 +1,15 @@+```+% pandoc -f markdown -t native+\begin{proof}+\newcommand{\x}{\left.\right.}+\x+\end{proof}++1234567890abcdefghi++[\*\a](x)+^D+[RawBlock (Format "tex") "\\begin{proof}\n\\newcommand{\\x}{\\left.\\right.}\n\\left.\\right.\n\\end{proof}"+,Para [Str "1234567890abcdefghi"]+,Para [Link ("",[],[]) [Str "*",RawInline (Format "tex") "\\a"] ("x","")]]+```
+ test/command/7436.md view
@@ -0,0 +1,14 @@+```+% pandoc -f rst -t native+.. include:: command/three.txt+ :code:++.. include:: command/three.txt+ :literal:++.. include:: command/three.txt+^D+[CodeBlock ("",[""],[("code","")]) "1st line.\n2nd line.\n3rd line.\n"+,RawBlock (Format "rst") "1st line.\n2nd line.\n3rd line.\n"+,Para [Str "1st",Space,Str "line.",SoftBreak,Str "2nd",Space,Str "line.",SoftBreak,Str "3rd",Space,Str "line."]]+```
test/command/pandoc-citeproc-322.md view
@@ -19,7 +19,7 @@ type: 'article-journal' --- -Foo[@timmory__justice_1950].+Foo [@timmory__justice_1950]. ^D Foo.[^1]
test/command/pandoc-citeproc-chicago-author-date.md view
@@ -54,14 +54,14 @@ ([**nonexistent?**](#ref-nonexistent)) -[Doe](#ref-item1) ([2005](#ref-item1)) says blah.+Doe ([2005](#ref-item1)) says blah. -[Doe](#ref-item1) ([2005, 30](#ref-item1)) says blah.+Doe ([2005, 30](#ref-item1)) says blah. -[Doe](#ref-item1) ([2005, 30](#ref-item1), with suffix) says blah.+Doe ([2005, 30](#ref-item1), with suffix) says blah. -[Doe](#ref-item1) ([2005](#ref-item1); [2006, 30](#ref-item2); see also-[Doe and Roe 2007](#ref-пункт3)) says blah.+Doe ([2005](#ref-item1); [2006, 30](#ref-item2); see also [Doe and Roe+2007](#ref-пункт3)) says blah. In a note.[^1] @@ -98,8 +98,8 @@ ::: ::: -[^1]: [Doe and Roe](#ref-пункт3) ([2007, 12](#ref-пункт3)) and a- citation without locators ([Doe and Roe 2007](#ref-пункт3)).+[^1]: Doe and Roe ([2007, 12](#ref-пункт3)) and a citation without+ locators ([Doe and Roe 2007](#ref-пункт3)). [^2]: Some citations (see [Doe 2005, chap. 3](#ref-item1); [2006](#ref-item2); [Doe and Roe 2007](#ref-пункт3)).
test/command/pandoc-citeproc-chicago-fullnote-bibliography.md view
@@ -55,13 +55,13 @@ [^2] -[John Doe](#ref-item1)[^3] says blah.+John Doe[^3] says blah. -[Doe](#ref-item1)[^4] says blah.+Doe[^4] says blah. -[Doe](#ref-item1)[^5] says blah.+Doe[^5] says blah. -[Doe](#ref-item1)[^6] says blah.+Doe[^6] says blah. In a note.[^7] @@ -112,9 +112,8 @@ Roe, "Why Water Is Wet," in *Third Book*, ed. Sam Smith (Oxford: Oxford University Press, 2007)](#ref-пункт3). -[^7]: [Doe and Roe](#ref-пункт3), ["Why Water Is Wet," 12](#ref-пункт3)- and a citation without locators ([Doe and Roe, "Why Water Is- Wet"](#ref-пункт3)).+[^7]: Doe and Roe, ["Why Water Is Wet," 12](#ref-пункт3) and a citation+ without locators ([Doe and Roe, "Why Water Is Wet"](#ref-пункт3)). [^8]: See [Doe, *First Book*, chap. 3](#ref-item1); also [Doe and Roe, "Why Water Is Wet," 34--35](#ref-пункт3).
+ test/command/three.txt view
@@ -0,0 +1,3 @@+1st line.+2nd line.+3rd line.
test/docbook-reader.docbook view
@@ -726,6 +726,9 @@ More code: <classname>Class</classname> and <type>Type</type> </para> <para>+ Referencing a man page: <citerefentry><refentrytitle>nix.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>+ </para>+ <para> <emphasis role="strikethrough">This is <emphasis>strikeout</emphasis>.</emphasis> </para>
test/docbook-reader.native view
@@ -188,6 +188,7 @@ ,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."] ,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",SoftBreak,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",SoftBreak,Code ("",[],[]) "<html>",Str "."] ,Para [Str "More",Space,Str "code:",Space,Code ("",[],[]) "Class",Space,Str "and",Space,Code ("",[],[]) "Type"]+,Para [Str "Referencing",Space,Str "a",Space,Str "man",Space,Str "page:",Space,Code ("",["citerefentry"],[]) "nix.conf(5)"] ,Para [Strikeout [Str "This",Space,Str "is",SoftBreak,Emph [Str "strikeout"],Str "."]] ,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",SoftBreak,Str "a",Superscript [Emph [Str "hello"]],SoftBreak,Str "a",Superscript [Str "hello\160there"],Str "."] ,Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",SoftBreak,Str "H",Subscript [Str "many\160of\160them"],Str "O."]
test/docx/golden/image.docx view
binary file changed (26647 → 26776 bytes)
test/lhs-test.html view
@@ -21,7 +21,7 @@ padding-top: 50px; padding-bottom: 50px; hyphens: auto;- word-wrap: break-word;+ overflow-wrap: break-word; text-rendering: optimizeLegibility; font-kerning: normal; }@@ -92,6 +92,7 @@ pre code { padding: 0; overflow: visible;+ overflow-wrap: normal; } .sourceCode { background-color: transparent;
test/lhs-test.html+lhs view
@@ -21,7 +21,7 @@ padding-top: 50px; padding-bottom: 50px; hyphens: auto;- word-wrap: break-word;+ overflow-wrap: break-word; text-rendering: optimizeLegibility; font-kerning: normal; }@@ -92,6 +92,7 @@ pre code { padding: 0; overflow: visible;+ overflow-wrap: normal; } .sourceCode { background-color: transparent;
test/lhs-test.latex view
@@ -4,9 +4,6 @@ % \documentclass[ ]{article}-\author{}-\date{}- \usepackage{amsmath,amssymb} \usepackage{lmodern} \usepackage{iftex}@@ -87,6 +84,9 @@ \ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi++\author{}+\date{} \begin{document}
test/lhs-test.latex+lhs view
@@ -4,9 +4,6 @@ % \documentclass[ ]{article}-\author{}-\date{}- \usepackage{amsmath,amssymb} \usepackage{lmodern} \usepackage{iftex}@@ -54,6 +51,9 @@ \ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi++\author{}+\date{} \begin{document}
test/writer.html4 view
@@ -24,7 +24,7 @@ padding-top: 50px; padding-bottom: 50px; hyphens: auto;- word-wrap: break-word;+ overflow-wrap: break-word; text-rendering: optimizeLegibility; font-kerning: normal; }@@ -95,6 +95,7 @@ pre code { padding: 0; overflow: visible;+ overflow-wrap: normal; } .sourceCode { background-color: transparent;
test/writer.html5 view
@@ -24,7 +24,7 @@ padding-top: 50px; padding-bottom: 50px; hyphens: auto;- word-wrap: break-word;+ overflow-wrap: break-word; text-rendering: optimizeLegibility; font-kerning: normal; }@@ -95,6 +95,7 @@ pre code { padding: 0; overflow: visible;+ overflow-wrap: normal; } .sourceCode { background-color: transparent;
test/writer.latex view
@@ -4,10 +4,6 @@ % \documentclass[ ]{article}-\title{Pandoc Test Suite}-\author{John MacFarlane \and Anonymous}-\date{July 17, 2006}- \usepackage{amsmath,amssymb} \usepackage{lmodern} \usepackage{iftex}@@ -70,6 +66,10 @@ \ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi++\title{Pandoc Test Suite}+\author{John MacFarlane \and Anonymous}+\date{July 17, 2006} \begin{document} \maketitle
test/writers-lang-and-dir.latex view
@@ -5,9 +5,6 @@ \documentclass[ english, ]{article}-\author{}-\date{}- \usepackage{amsmath,amssymb} \usepackage{lmodern} \usepackage{iftex}@@ -86,6 +83,9 @@ \newenvironment{RTL}{\beginR}{\endR} \newenvironment{LTR}{\beginL}{\endL} \fi++\author{}+\date{} \begin{document}