pandoc 3.1.6.2 → 3.1.7
raw patch · 44 files changed
+537/−276 lines, 44 filesdep ~skylightingdep ~skylighting-coredep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: skylighting, skylighting-core, text
API changes (from Hackage documentation)
Files
- AUTHORS.md +1/−0
- MANUAL.txt +1/−4
- changelog.md +81/−4
- data/templates/default.latex +25/−14
- data/templates/default.man +0/−19
- man/pandoc.1 +2/−5
- pandoc.cabal +7/−7
- src/Text/Pandoc/Readers/JATS.hs +48/−1
- src/Text/Pandoc/Readers/Markdown.hs +26/−15
- src/Text/Pandoc/Readers/Org/BlockStarts.hs +18/−11
- src/Text/Pandoc/Readers/Org/Blocks.hs +1/−4
- src/Text/Pandoc/Readers/Org/Inlines.hs +2/−1
- src/Text/Pandoc/Writers/JATS.hs +11/−1
- src/Text/Pandoc/Writers/LaTeX.hs +51/−48
- src/Text/Pandoc/Writers/LaTeX/Types.hs +2/−0
- src/Text/Pandoc/Writers/LaTeX/Util.hs +18/−15
- src/Text/Pandoc/Writers/Man.hs +10/−8
- src/Text/Pandoc/Writers/Roff.hs +5/−3
- test/Tests/Readers/Org/Inline.hs +5/−0
- test/command/1710.md +1/−1
- test/command/2874.md +1/−1
- test/command/3568.md +2/−2
- test/command/4016.md +3/−3
- test/command/4690.md +1/−1
- test/command/5340.md +3/−3
- test/command/5620.md +2/−2
- test/command/6030.md +2/−2
- test/command/6107.md +2/−2
- test/command/6360.md +1/−1
- test/command/7016.md +1/−0
- test/command/7278.md +4/−4
- test/command/7857.md +1/−1
- test/command/8254.md +20/−0
- test/command/8853.md +6/−0
- test/command/9017.md +53/−0
- test/command/9038.md +6/−0
- test/command/9042.md +30/−0
- test/command/9043.md +13/−0
- test/jats-reader.native +24/−0
- test/jats-reader.xml +9/−0
- test/lhs-test.html +1/−1
- test/lhs-test.html+lhs +1/−1
- test/writer.man +29/−84
- test/writer.ms +7/−7
AUTHORS.md view
@@ -17,6 +17,7 @@ - Alfred Wechselberger - Amar Al-Zubaidi - Amir Dekel+- Amneesh Singh - Amogh Rathore - Amy de Buitléir - Anabra
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: August 22, 2023+date: August 31, 2023 --- # Synopsis@@ -3145,9 +3145,6 @@ `header` : header in man pages--`hyphenate`-: if `true` (the default), hyphenation will be used `section` : section number in man pages
changelog.md view
@@ -1,5 +1,82 @@ # Revision history for pandoc +## pandoc 3.1.7 (2023-08-31)++ * Org reader:++ + Don't parse alphabetical lists unless the `fancy_lists` extension is+ enabled (#9042).+ + Allow escaping commas in macro arguments (Amneesh Singh).++ * JATS reader:++ + Support for `<permissions>` metadata (#9037, Julia Diaz).+ metadata objects with multiple fields are created, matching the+ structure in JATS.+ + Correct name of JATS element `attrib`.++ * Markdown reader:++ + Support images with wikilink syntax, e.g. `![[foo|bar]]`, when+ one of the `wikilinks` extension is enabled (#8853).+ + Allow a citation or reference link to be parsed after a `!` (#8254).+ + Fix dropped `!` before nonexistent reference (#9038).++ * LaTeX writer:++ + Fix regression in escaping URLs (#9043).+ + Use `\cite` and `\bibitem` to link up citations, even with citeproc.+ (#9031). This will give us better accessibility; when tagging is+ enabled, the citation can be linked to the bibliography entry.+ This changes some of the details of the layout and the default+ template. We now make `CSLReferences` a special enumitem list+ that will contain `\bibitem`s. Internal links inside citations to+ ids beginning in `ref-` are creating using `\cite` instead of+ `\hyperref`.+ + Use `\phantomsection` and `\label` instead of `\hypertarget` (#9022).+ + Use `\hyperref` for LaTeX internal links, `\hyperlink` for+ beamer (since `\hyperref` doesn't seem to work) (#9022).+ + Backslash-escape `%` and `#` in URLs (#9014).++ * JATS writer:++ + Fix placement of ref-list when no title is specified for the+ reference section (#9017). (In this case we place it in `back`+ with an empty title.)++ * Man writer:++ + Avoid a `.PP` right after a section heading (#9020).+ This is at best a no-op (in groff man and mandoc) and at worst+ (in some formatters) may create extra whitespace.+ + We revert the fanciness introduced in #7506, which employs a+ custom font name `V` and a macro that makes this act like boldface+ in a terminal and monospace in other formats. Unfortunately,+ this code uses a mechanism that is not portable (and does not+ work in mandoc) (#9020).+ + Instead of using `V` for inline code, we simply use `CR`.+ Note that `\f[CR]` is emitted instead of plain `\f[C]`,+ because there is no `C` font in man. (This produces warnings+ in recent versions of groff, #9020.)+ + For code blocks, we now use the `.EX` and `.EE` macros,+ together with `.IP` for spacing and indentation. This gives+ more standard code that can be better interpreted e.g. by mandoc+ (#9020).++ * Man template: don't emit `.hy`, regardless of setting of+ `hyphenate` variable (#9020).++ * LaTeX template: special redefinition of `\st` for CJK (#9019).+ soul's version raises on error on CJK text.++ * Use latest skylighting-format-blaze-html (#7248).+ This works around a longstanding iOS Safari bug that caused long+ lines to be displayed in a different font size in highlighted code.++ * Allow skylighting 0.14 (and require it in pandoc core).++ * Allow text 2.1.+ ## pandoc 3.1.6.2 (2023-08-22) * Org reader: allow example lines to end immediately after the colon@@ -163,7 +240,7 @@ (#8947, #8955). With ghc 9.4+, we were getting AVX instructions in the amd64 binary, which aren't supported on older hardware. For maximum compatibility we switch back to ghc 9.2, which doesn't- cause the problem. (As documented, ghc should not be emiting these+ cause the problem. (As documented, ghc should not be emitting these instructions, so we aren't clear on the diagnosis, but the cure has been tested.) @@ -209,7 +286,7 @@ The AsciiDoc community now regards the dialect parsed by `asciidoctor` as the official AsciiDoc syntax, so it should be the target of our `asciidoc` format. The `asciidoc` output format now behaves like- `asciidoctor` used to. `asciidoctor` is a deprecated synonynm. For+ `asciidoctor` used to. `asciidoctor` is a deprecated synonym. For the old `asciidoc` behavior (targeting the Python script), use `asciidoc_legacy`. The templates have been consolidated. Instead of separate `default.asciidoctor` and `default.asciidoc` templates, there@@ -3808,7 +3885,7 @@ + Implement siunitx v3 commands (#7614). We support `\unit`, `\qty`, `\qtyrange`, and `\qtylist`- as synonynms of `\si`, `\SI`, `\SIrange`, and `\SIlist`.+ as synonyms of `\si`, `\SI`, `\SIrange`, and `\SIlist`. + Properly handle `\^` followed by group closing (#7615). + Recognize that `\vadjust` sometimes takes "pre" (#7531). + Ignore (and gobble parameters of) CSLReferences environment (#7531).@@ -9880,7 +9957,7 @@ not have a `startFrom` attribute; with a blank value, the writers can produce extra whitespace. + Removed superfluous `sourceCode` class on code blocks (#5047).- + Handle `sourcecode` directive as synonynm for `code` (#5204).+ + Handle `sourcecode` directive as synonym for `code` (#5204). * Markdown reader:
data/templates/default.latex view
@@ -297,6 +297,13 @@ \usepackage[soul]{lua-ul} \else \usepackage{soul}+$if(CJKmainfont)$+ \ifXeTeX+ % soul's \st doesn't work for CJK:+ \usepackage{xeCJKfntef}+ \renewcommand{\st}[1]{\sout{#1}}+ \fi+$endif$ \fi $endif$ \setlength{\emergencystretch}{3em} % prevent overfull lines@@ -328,24 +335,28 @@ \pagestyle{$pagestyle$} $endif$ $if(csl-refs)$+% definitions for citeproc citations+\NewDocumentCommand\citeproctext{}{}+\NewDocumentCommand\citeproc{mm}{%+ \begingroup\def\citeproctext{#2}\cite{#1}\endgroup}+% avoid brackets around text for \cite:+\makeatletter+ \def\@biblabel#1{}+ \def\@cite#1#2{{#1\if@tempswa , #2\fi}}+\makeatother \newlength{\cslhangindent} \setlength{\cslhangindent}{1.5em} \newlength{\csllabelwidth} \setlength{\csllabelwidth}{3em}-\newlength{\cslentryspacingunit} % times entry-spacing-\setlength{\cslentryspacingunit}{\parskip}-\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing- {% don't indent paragraphs- \setlength{\parindent}{0pt}- % turn on hanging indent if param 1 is 1- \ifodd #1- \let\oldpar\par- \def\par{\hangindent=\cslhangindent\oldpar}- \fi- % set entry spacing- \setlength{\parskip}{#2\cslentryspacingunit}- }%- {}+\newlength{\cslentryspacing}+\setlength{\cslentryspacing}{0em}+\usepackage{enumitem}+\newlist{CSLReferences}{itemize}{1}+\setlist[CSLReferences]{label={},+ leftmargin=\cslhangindent,+ itemindent=-1\cslhangindent,+ parsep=\parskip,+ itemsep=\cslentryspacing} \usepackage{calc} \newcommand{\CSLBlock}[1]{#1\hfill\break} \newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
data/templates/default.man view
@@ -5,29 +5,10 @@ .\" Automatically generated by Pandoc $pandoc-version$ .\" $endif$-.\" Define V font for inline verbatim, using C font in formats-.\" that render this, and otherwise B font.-.ie "\f[CB]x\f[]"x" \{\-. ftr V B-. ftr VI BI-. ftr VB B-. ftr VBI BI-.\}-.el \{\-. ftr V CR-. ftr VI CI-. ftr VB CB-. ftr VBI CBI-.\} $if(adjusting)$ .ad $adjusting$ $endif$ .TH "$title/nowrap$" "$section/nowrap$" "$date/nowrap$" "$footer/nowrap$" "$header/nowrap$"-$if(hyphenate)$-.hy-$else$-.nh-$endif$ $for(header-includes)$ $header-includes$ $endfor$
man/pandoc.1 view
@@ -1,4 +1,4 @@-.\" Automatically generated by Pandoc 3.1.5+.\" Automatically generated by Pandoc 3.1.6.2 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font.@@ -14,7 +14,7 @@ . ftr VB CB . ftr VBI CBI .\}-.TH "Pandoc User\[cq]s Guide" "" "August 22, 2023" "pandoc 3.1.6.2" ""+.TH "Pandoc User\[cq]s Guide" "" "August 31, 2023" "pandoc 3.1.7" "" .hy .SH NAME pandoc - general markup converter@@ -3240,9 +3240,6 @@ .TP \f[V]header\f[R] header in man pages-.TP-\f[V]hyphenate\f[R]-if \f[V]true\f[R] (the default), hyphenation will be used .TP \f[V]section\f[R] section number in man pages
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: pandoc-version: 3.1.6.2+version: 3.1.7 build-type: Simple license: GPL-2.0-or-later license-file: COPYING.md@@ -450,7 +450,7 @@ xml-conduit >= 1.9.1.1 && < 1.10, xml-types >= 0.3 && < 0.4, containers >= 0.6.0.1 && < 0.7,- text >= 1.1.1.0 && < 2.1+ text >= 1.1.1.0 && < 2.2 hs-source-dirs: xml-light exposed-modules: Text.Pandoc.XML.Light,@@ -508,14 +508,14 @@ random >= 1 && < 1.3, safe >= 0.3.18 && < 0.4, scientific >= 0.3 && < 0.4,- skylighting >= 0.13.4.1 && < 0.14,- skylighting-core >= 0.13.4.1 && < 0.14,+ skylighting >= 0.14 && < 0.15,+ skylighting-core >= 0.14 && < 0.15, split >= 0.2 && < 0.3, syb >= 0.1 && < 0.8, tagsoup >= 0.14.6 && < 0.15, temporary >= 1.1 && < 1.4, texmath >= 0.12.8.1 && < 0.13,- text >= 1.1.1.0 && < 2.1,+ text >= 1.1.1.0 && < 2.2, text-conversions >= 0.3 && < 0.4, time >= 1.5 && < 1.14, unicode-collation >= 0.1.1 && < 0.2,@@ -765,7 +765,7 @@ tasty-golden >= 2.3 && < 2.4, tasty-hunit >= 0.9 && < 0.11, tasty-quickcheck >= 0.8 && < 0.11,- text >= 1.1.1.0 && < 2.1,+ text >= 1.1.1.0 && < 2.2, temporary >= 1.1 && < 1.4, time >= 1.5 && < 1.14, xml >= 1.3.12 && < 1.4,@@ -835,7 +835,7 @@ build-depends: bytestring, tasty-bench >= 0.2 && <= 0.4, mtl >= 2.2 && < 2.4,- text >= 1.1.1.0 && < 2.1,+ text >= 1.1.1.0 && < 2.2, deepseq -- we increase heap size to avoid benchmarking garbage collection: ghc-options: -rtsopts -with-rtsopts=-A8m -threaded
src/Text/Pandoc/Readers/JATS.hs view
@@ -242,7 +242,7 @@ return $ codeBlockWith (attrValue "id" e, classes', []) $ trimNl $ strContentRecursive e parseBlockquote = do- attrib <- case filterChild (named "attribution") e of+ attrib <- case filterChild (named "attrib") e of Nothing -> return mempty Just z -> para . (str "— " <>) . mconcat <$>@@ -393,6 +393,7 @@ getAffiliations e getAbstract e getPubDate e+ getPermissions e return mempty getTitle :: PandocMonad m => Element -> JATS m ()@@ -445,6 +446,47 @@ addMeta "date" $ text $ T.intercalate "-" $ catMaybes [yr, mon, day] Nothing -> pure () +getPermissions :: PandocMonad m => Element -> JATS m ()+getPermissions e = do+ copyright <- getCopyright e+ license <- case filterElement (named "license") e of+ Just s -> getLicense s+ Nothing -> return mempty+ when (copyright /= mempty) $ addMeta "copyright" copyright+ when (license /= mempty) $ addMeta "license" license++getCopyright :: PandocMonad m => Element -> JATS m (Map.Map Text MetaValue)+getCopyright e = do+ let holder = metaElement e "copyright-holder" "holder"+ let statement = metaElement e "copyright-statement" "statement"+ let year = metaElement e "copyright-year" "year"+ return $ Map.fromList (catMaybes $ [holder, statement, year])++getLicense :: PandocMonad m => Element -> JATS m (Map.Map Text MetaValue)+getLicense e = do+ let licenseType = metaAttribute e "license-type" "type"+ let licenseLink = metaElementAliRef e "link"+ let licenseText = metaElement e "license-p" "text"+ return $ Map.fromList (catMaybes $ [licenseType, licenseLink, licenseText])++metaElement :: Element -> Text -> Text -> Maybe (Text, MetaValue)+metaElement e child key =+ case filterElement (named child) e of+ Just content -> Just (key, toMetaValue $ strContent content)+ Nothing -> Nothing++metaElementAliRef :: Element -> Text -> Maybe (Text, MetaValue)+metaElementAliRef e key =+ case filterElement isAliLicenseRef e of+ Just content -> Just (key, toMetaValue $ strContent content)+ Nothing -> Nothing++metaAttribute :: Element -> Text -> Text -> Maybe (Text, MetaValue)+metaAttribute e attr key =+ case maybeAttrValue attr e of+ Just content -> Just (key, toMetaValue content)+ Nothing -> Nothing+ getContrib :: PandocMonad m => Element -> JATS m Inlines getContrib x = do given <- maybe (return mempty) getInlines@@ -664,3 +706,8 @@ hasFormulaChild :: Element -> Bool hasFormulaChild x = length (formulaChildren x) > 0++isAliLicenseRef :: Element -> Bool+isAliLicenseRef x = qName (elName x) == "license_ref" &&+ qURI (elName x) ==+ Just "http://www.niso.org/schemas/ali/1.0/"
src/Text/Pandoc/Readers/Markdown.hs view
@@ -1527,7 +1527,7 @@ '_' -> strongOrEmph '*' -> strongOrEmph '^' -> superscript <|> inlineNote -- in this order bc ^[link](/foo)^- '[' -> note <|> cite <|> bracketedSpan <|> wikilink <|> link+ '[' -> note <|> cite <|> bracketedSpan <|> wikilink B.linkWith <|> link '!' -> image '$' -> math '~' -> strikeout <|> subscript@@ -1844,8 +1844,10 @@ linkTitle :: PandocMonad m => MarkdownParser m Text linkTitle = quotedTitle '"' <|> quotedTitle '\'' -wikilink :: PandocMonad m => MarkdownParser m (F Inlines)-wikilink =+wikilink :: PandocMonad m+ => (Attr -> Text -> Text -> Inlines -> Inlines)+ -> MarkdownParser m (F Inlines)+wikilink constructor = (guardEnabled Ext_wikilinks_title_after_pipe *> wikilink' swap) <|> (guardEnabled Ext_wikilinks_title_before_pipe *> wikilink' id) where@@ -1857,7 +1859,7 @@ let (title, url) = case T.break (== '|') raw of (before, "") -> (before, before) (before, after) -> order (before, T.drop 1 after)- return . pure . B.link url "wikilink" $ B.str title+ return . pure . constructor nullAttr url "wikilink" $ B.str title link :: PandocMonad m => MarkdownParser m (F Inlines) link = try $ do@@ -1931,15 +1933,23 @@ try ((guardDisabled Ext_spaced_reference_links <|> spnl) >> reference) when (raw' == "") $ guardEnabled Ext_shortcut_reference_links let !labIsRef = raw' == "" || raw' == "[]"- let !key = toKey $ if labIsRef then raw else raw'+ let (exclam, rawsuffix) =+ case T.uncons raw of+ Just ('!', rest) -> (True, rest)+ _ -> (False, raw)+ let !key = toKey $ if labIsRef then rawsuffix else raw' parsedRaw <- parseFromString' inlines raw'- fallback <- parseFromString' inlines $ dropBrackets raw+ fallback <- parseFromString' inlines $ if exclam+ then rawsuffix+ else dropBrackets rawsuffix implicitHeaderRefs <- option False $ True <$ guardEnabled Ext_implicit_header_references let makeFallback = do parsedRaw' <- parsedRaw fallback' <- fallback- return $ B.str "[" <> fallback' <> B.str "]" <>+ return $ (if exclam+ then "!" <> fallback'+ else B.str "[" <> fallback' <> B.str "]") <> (if sp && not (T.null raw) then B.space else mempty) <> parsedRaw' return $ do@@ -2007,14 +2017,15 @@ image :: PandocMonad m => MarkdownParser m (F Inlines) image = try $ do char '!'- (lab,raw) <- reference- defaultExt <- getOption readerDefaultImageExtension- let constructor attr' src =- case takeExtension (T.unpack src) of- "" -> B.imageWith attr' (T.pack $ addExtension (T.unpack src)- $ T.unpack defaultExt)- _ -> B.imageWith attr' src- regLink constructor lab <|> referenceLink constructor (lab,raw)+ wikilink B.imageWith <|>+ do (lab,raw) <- reference+ defaultExt <- getOption readerDefaultImageExtension+ let constructor attr' src =+ case takeExtension (T.unpack src) of+ "" -> B.imageWith attr' (T.pack $ addExtension (T.unpack src)+ $ T.unpack defaultExt)+ _ -> B.imageWith attr' src+ regLink constructor lab <|> referenceLink constructor (lab, "!" <> raw) note :: PandocMonad m => MarkdownParser m (F Inlines) note = try $ do
src/Text/Pandoc/Readers/Org/BlockStarts.hs view
@@ -29,6 +29,7 @@ import Text.Pandoc.Definition as Pandoc import Text.Pandoc.Shared (safeRead) import Text.Pandoc.Parsing (lowerAlpha, upperAlpha)+import Text.Pandoc.Extensions import Data.Functor (($>)) -- | Horizontal Line (five -- dashes or more)@@ -69,8 +70,7 @@ <* char ']' <* (skipSpaces <|> lookAhead eol) where parseNum = (safeRead =<< many1Char digit)- <|> snd <$> lowerAlpha- <|> snd <$> upperAlpha+ <|> snd <$> (lowerAlpha <|> upperAlpha) bulletListStart :: Monad m => OrgParser m Int bulletListStart = try $ do@@ -87,20 +87,27 @@ orderedListStart :: Monad m => OrgParser m (Int, ListAttributes) orderedListStart = try $ do ind <- length <$> many spaceChar+ fancy <- option False $ True <$ guardEnabled Ext_fancy_lists+ -- Ordered list markers allowed in org-mode+ let styles = (many1Char digit $> (if fancy+ then Decimal+ else DefaultStyle))+ : if fancy+ then [ fst <$> lowerAlpha+ , fst <$> upperAlpha ]+ else []+ let delims = [ char '.' $> (if fancy+ then Period+ else DefaultDelim)+ , char ')' $> (if fancy+ then OneParen+ else DefaultDelim)+ ] style <- choice styles delim <- choice delims skipSpaces1 <|> lookAhead eol start <- option 1 listCounterCookie return (ind + 1, (start, style, delim))- -- Ordered list markers allowed in org-mode- where- styles = [ many1Char digit $> Decimal- , fst <$> lowerAlpha- , fst <$> upperAlpha- ]- delims = [ char '.' $> Period- , char ')' $> OneParen- ] drawerStart :: Monad m => OrgParser m Text drawerStart = try $ skipSpaces *> drawerName <* skipSpaces <* newline
src/Text/Pandoc/Readers/Org/Blocks.hs view
@@ -853,11 +853,8 @@ orderedList :: PandocMonad m => OrgParser m (F Blocks) orderedList = try $ do (indent, attr) <- lookAhead orderedListStart- attr' <- option (fst3 attr, DefaultStyle, DefaultDelim) $- guardEnabled Ext_fancy_lists $> attr- fmap (B.orderedListWith attr' . compactify) . sequence+ fmap (B.orderedListWith attr . compactify) . sequence <$> many1 (listItem ((fst <$> orderedListStart) `indented` indent))- where fst3 (x,_,_) = x definitionListItem :: PandocMonad m => OrgParser m Int
src/Text/Pandoc/Readers/Org/Inlines.hs view
@@ -892,7 +892,8 @@ updateState $ \s -> s { orgStateMacroDepth = recursionDepth } return res where- argument = manyChar $ notFollowedBy eoa *> noneOf ","+ argument = manyChar $ notFollowedBy eoa *> (escapedComma <|> noneOf ",")+ escapedComma = try $ char '\\' *> oneOf ",\\" eoa = string ")}}}" smart :: PandocMonad m => OrgParser m (F Inlines)
src/Text/Pandoc/Writers/JATS.hs view
@@ -91,6 +91,15 @@ runReaderT (evalStateT (docToJATS opts d) initialState) environment +-- see #9017 for motivation+ensureReferenceHeader :: [Block] -> [Block]+ensureReferenceHeader [] = []+ensureReferenceHeader (h@(Header{}):refs@(Div ("refs",_,_) _) : xs) =+ h:refs:xs+ensureReferenceHeader (refs@(Div ("refs",_,_) _) : xs) =+ Header 1 nullAttr mempty : refs : xs+ensureReferenceHeader (x:xs) = x :ensureReferenceHeader xs+ -- | Convert Pandoc document to string in JATS format. docToJATS :: PandocMonad m => WriterOptions -> Pandoc -> JATS m Text docToJATS opts (Pandoc meta blocks') = do@@ -100,7 +109,8 @@ TopLevelChapter -> 0 TopLevelSection -> 1 TopLevelDefault -> 1- let blocks = makeSections (writerNumberSections opts) (Just startLvl) blocks'+ let blocks = makeSections (writerNumberSections opts) (Just startLvl)+ $ ensureReferenceHeader blocks' let splitBackBlocks b@(Div ("refs",_,_) _) (fs, bs) = (fs, b:bs) splitBackBlocks (Div (ident,("section":_),_) [ Header lev (_,hcls,hkvs) hils
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -281,11 +281,9 @@ | "example" `elem` dclasses = "exampleblock" | "alert" `elem` dclasses = "alertblock" | otherwise = "block"- ref <- toLabel identifier- let anchor = if T.null identifier- then empty- else cr <> "\\protect\\hypertarget" <>- braces (literal ref) <> braces empty+ anchor <- if T.null identifier+ then pure empty+ else (cr <>) <$> hypertarget identifier title' <- inlineListToLaTeX ils contents <- blockListToLaTeX bs wrapDiv attr $ ("\\begin" <> braces blockname <> braces title' <> anchor) $$@@ -318,11 +316,9 @@ slideTitle <- if ils == [Str "\0"] -- marker for hrule then return empty else braces <$> inlineListToLaTeX ils- ref <- toLabel identifier- let slideAnchor = if T.null identifier- then empty- else cr <> "\\protect\\hypertarget" <>- braces (literal ref) <> braces empty+ slideAnchor <- if T.null identifier+ then pure empty+ else (cr <>) <$> hypertarget identifier contents <- blockListToLaTeX bs >>= wrapDiv (identifier,classes,kvs) return $ ("\\begin{frame}" <> options <> slideTitle <> slideAnchor) $$ contents $$ "\\end{frame}"@@ -343,30 +339,30 @@ then do modify $ \st -> st{ stHasCslRefs = True } inner <- blockListToLaTeX bs- return $ "\\begin{CSLReferences}" <>- (if "hanging-indent" `elem` classes- then braces "1"- else braces "0") <>- (case lookup "entry-spacing" kvs of- Nothing -> braces "0"- Just s -> braces (literal s))+ return $ (if "hanging-indent" `notElem` classes+ then "\\setlength{\\cslhangindent}{0em}"+ else mempty)+ $$ ("\\setlength{\\cslentryspacing}" <> braces+ (case lookup "entry-spacing" kvs of+ Nothing -> "0em"+ Just s -> (literal s <> "\\baselineskip")))+ $$ "\\begin{CSLReferences}" $$ inner $+$ "\\end{CSLReferences}" else blockListToLaTeX bs modify $ \st -> st{ stIncremental = oldIncremental }- linkAnchor' <- hypertarget True identifier empty- -- see #2704 for the motivation for adding \leavevmode- -- and #7078 for \vadjust pre- let linkAnchor =- case bs of- Para _ : _- | not (isEmpty linkAnchor')- -> "\\leavevmode\\vadjust pre{" <> linkAnchor' <> "}%"- _ -> linkAnchor'- wrapNotes txt = if beamer && "notes" `elem` classes- then "\\note" <> braces txt -- speaker notes- else linkAnchor $$ txt- wrapNotes <$> wrapDiv (identifier,classes,kvs) result+ let wrap txt+ | beamer && "notes" `elem` classes+ = pure ("\\note" <> braces txt) -- speaker notes+ | "ref-" `T.isPrefixOf` identifier+ = do+ lab <- toLabel identifier+ pure $ ("\\bibitem" <> brackets "\\citeproctext"+ <> braces (literal lab)) $$ txt+ | otherwise = do+ linkAnchor <- hypertarget identifier+ pure $ linkAnchor $$ txt+ wrapDiv (identifier,classes,kvs) result >>= wrap blockToLaTeX (Plain lst) = inlineListToLaTeX lst -- . . . indicates pause in beamer slides@@ -396,12 +392,10 @@ return $ "\\begin{quote}" $$ contents $$ "\\end{quote}" blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do opts <- gets stOptions- lab <- labelFor identifier inNote <- stInNote <$> get- linkAnchor' <- hypertarget True identifier lab- let linkAnchor = if isEmpty linkAnchor'- then empty- else linkAnchor' <> "%"+ linkAnchor <- if T.null identifier+ then pure empty+ else ((<> cr) . (<> "%")) <$> hypertarget identifier let lhsCodeBlock = do modify $ \s -> s{ stLHS = True } return $ flush (linkAnchor $$ "\\begin{code}" $$ literal str $$@@ -575,8 +569,8 @@ [b] -> blockToLaTeX b bs -> mconcat . intersperse (cr <> "\\hfill") <$> mapM (toSubfigure (length bs)) bs- innards <- hypertarget True ident $- "\\centering" $$ contents $$ caption <> cr+ target <- hypertarget ident+ let innards = target $$ "\\centering" $$ contents $$ caption <> cr modify $ \st -> st{ stInFigure = isSubfigure , stSubfigure = stSubfigure st || isSubfigure@@ -777,7 +771,7 @@ modify $ \st -> st{ stStrikeout = True } -- this gives us the soul package inCmd "hl" <$> inlineListToLaTeX lst inlineToLaTeX (Span (id',classes,kvs) ils) = do- linkAnchor <- hypertarget False id' empty+ linkAnchor <- hypertarget id' lang <- toLang $ lookup "lang" kvs let classToCmd "csl-no-emph" = Just "textup" classToCmd "csl-no-strong" = Just "textnormal"@@ -806,7 +800,7 @@ else id) $ (if T.null id' then empty- else "\\protect" <> linkAnchor) <>+ else linkAnchor) <> (if null cmds then braces contents else foldr inCmd contents cmds)@@ -830,12 +824,14 @@ inlineToLaTeX (SmallCaps lst) = inCmd "textsc"<$> inlineListToLaTeX lst inlineToLaTeX (Cite cits lst) = do- st <- get- let opts = stOptions st- case writerCiteMethod opts of- Natbib -> citationsToNatbib inlineListToLaTeX cits- Biblatex -> citationsToBiblatex inlineListToLaTeX cits- _ -> inlineListToLaTeX lst+ opts <- gets stOptions+ modify $ \st -> st{ stInCite = True }+ res <- case writerCiteMethod opts of+ Natbib -> citationsToNatbib inlineListToLaTeX cits+ Biblatex -> citationsToBiblatex inlineListToLaTeX cits+ _ -> inlineListToLaTeX lst+ modify $ \st -> st{ stInCite = False }+ pure res inlineToLaTeX (Code (_,classes,kvs) str) = do opts <- gets stOptions@@ -959,7 +955,14 @@ Just ('#', ident) -> do contents <- inlineListToLaTeX txt lab <- toLabel ident- return $ text "\\hyperref" <> brackets (literal lab) <> braces contents+ inCite <- gets stInCite+ beamer <- gets stBeamer+ return $+ if inCite && "#ref-" `T.isPrefixOf` src+ then "\\citeproc" <> braces (literal lab) <> braces contents+ else if beamer+ then "\\hyperlink" <> braces (literal lab) <> braces contents+ else "\\hyperref" <> brackets (literal lab) <> braces contents _ -> case txt of [Str x] | unEscapeString (T.unpack x) == unEscapeString (T.unpack src) -> -- autolink do modify $ \s -> s{ stUrl = True }@@ -979,8 +982,8 @@ >>= (if T.null id' then return else \x -> do- linkAnchor <- hypertarget False id' x- return ("\\protect" <> linkAnchor))+ linkAnchor <- hypertarget id'+ return (linkAnchor <> x)) inlineToLaTeX il@(Image _ _ (src, _)) | Just _ <- T.stripPrefix "data:" src = do report $ InlineNotRendered il
src/Text/Pandoc/Writers/LaTeX/Types.hs view
@@ -26,6 +26,7 @@ , stInHeading :: Bool -- ^ true if in a section heading , stInItem :: Bool -- ^ true if in \item[..] , stInFigure :: Bool -- ^ true if in figure environment+ , stInCite :: Bool -- ^ true if in a Cite , stNotes :: [Doc Text] -- ^ notes in a minipage , stOLLevel :: Int -- ^ level of ordered list nesting , stOptions :: WriterOptions -- ^ writer options, so they don't have to@@ -61,6 +62,7 @@ , stInMinipage = False , stInItem = False , stInFigure = False+ , stInCite = False , stNotes = [] , stOLLevel = 1 , stOptions = options
src/Text/Pandoc/Writers/LaTeX/Util.hs view
@@ -29,7 +29,6 @@ import Text.Pandoc.Writers.LaTeX.Lang (toBabel) import Text.Pandoc.Highlighting (toListingsLanguage) import Text.DocLayout-import Network.URI (escapeURIString) import Text.Pandoc.Definition import Text.Pandoc.ImageSize (showFl) import Control.Monad.State.Strict (gets, modify)@@ -92,11 +91,19 @@ '\'':_ -> cs <> "\\," <> xs -- add thin space _ -> cs <> xs in case x of- '\\'| isUrl -> emitc '/' -- NB. / works as path sep even on Windows- c | isUrl ->- if c `elem` ['{', '}', '|', '^', '~', '[', ']', '`']- then emits (escapeURIString (const False) [c])- else emitc c+ _ | isUrl ->+ case x of+ '\\' -> emitc '/' -- NB / works as path sep even on Windows+ '#' -> emits "\\#" -- #9014+ '%' -> emits "\\%" -- #9014+ '{' -> emits "\\%7B"+ '}' -> emits "\\%7D"+ '|' -> emits "\\%7C"+ '^' -> emits "\\%5E"+ '[' -> emits "\\%5B"+ ']' -> emits "\\%5D"+ '`' -> emits "\\%60"+ _ -> emitc x '{' -> emits "\\{" '}' -> emits "\\}" '?' | ligatures -> -- avoid ?` ligature@@ -250,15 +257,11 @@ Nothing -> txt return $ wrapColumns . wrapColumn . wrapDir . wrapLang $ t -hypertarget :: PandocMonad m => Bool -> Text -> Doc Text -> LW m (Doc Text)-hypertarget _ "" x = return x-hypertarget addnewline ident x = do- ref <- literal `fmap` toLabel ident- return $ text "\\hypertarget"- <> braces ref- <> braces ((if addnewline && not (isEmpty x)- then "%" <> cr- else empty) <> x)+hypertarget :: PandocMonad m => Text -> LW m (Doc Text)+hypertarget "" = return mempty+hypertarget ident = do+ label <- labelFor ident+ return $ text "\\phantomsection" <> label labelFor :: PandocMonad m => Text -> LW m (Doc Text) labelFor "" = return empty
src/Text/Pandoc/Writers/Man.hs view
@@ -75,7 +75,6 @@ let context = defField "body" main $ setFieldsFromTitle $ defField "has-tables" hasTables- $ defField "hyphenate" True metadata return $ render colwidth $ case writerTemplate opts of@@ -132,14 +131,12 @@ return $ nowrap $ literal heading <> contents blockToMan opts (CodeBlock _ str) = return $ literal ".IP" $$- literal ".nf" $$- literal "\\f[C]" $$+ literal ".EX" $$ ((case T.uncons str of Just ('.',_) -> literal "\\&" _ -> mempty) <> literal (escString opts str)) $$- literal "\\f[R]" $$- literal ".fi"+ literal ".EE" blockToMan opts (BlockQuote blocks) = do contents <- blockListToMan opts blocks return $ literal ".RS" $$ contents $$ literal ".RE"@@ -257,7 +254,13 @@ -> [Block] -- ^ List of block elements -> StateT WriterState m (Doc Text) blockListToMan opts blocks =- vcat <$> mapM (blockToMan opts) blocks+ vcat <$> mapM (blockToMan opts) (go blocks)+ where+ -- Avoid .PP right after .SH; this is a no-op in groff man and mandoc+ -- but may cause unwanted extra space in some renderers (see #9020)+ go [] = []+ go (h@Header{} : Para ils : rest) = h : Plain ils : go rest+ go (x : xs) = x : go xs -- | Convert list of Pandoc inline elements to man. inlineListToMan :: PandocMonad m => WriterOptions -> [Inline] -> StateT WriterState m (Doc Text)@@ -292,8 +295,7 @@ inlineToMan opts (Cite _ lst) = inlineListToMan opts lst inlineToMan opts (Code _ str) =- -- note that the V font is specially defined in the default man template- withFontFeature 'V' (return (literal $ escString opts str))+ withFontFeature 'C' (return (literal $ escString opts str)) inlineToMan opts (Str str@(T.uncons -> Just ('.',_))) = return $ afterBreak "\\&" <> literal (escString opts str) inlineToMan opts (Str str) = return $ literal $ escString opts str
src/Text/Pandoc/Writers/Roff.hs view
@@ -112,9 +112,11 @@ fromMaybe False (Map.lookup 'B' features)] ++ ['I' | fromMaybe False $ Map.lookup 'I' features] return $- if null filling- then text "\\f[R]"- else text $ "\\f[" ++ filling ++ "]"+ case filling of+ [] -> text "\\f[R]"+ -- see #9020. C is not a font, use CR.+ ['C'] -> text "\\f[CR]"+ _ -> text $ "\\f[" ++ filling ++ "]" withFontFeature :: (HasChars a, IsString a, PandocMonad m) => Char -> MS m (Doc a) -> MS m (Doc a)
test/Tests/Readers/Org/Inline.hs view
@@ -393,6 +393,11 @@ , "{{{HELLO()}}}" ] =?> para "Foo Bar"+ , "Macro called with an escaped comma" =:+ T.unlines [ "#+MACRO: HELLO Foo $1"+ , "{{{HELLO(moin\\, niom)}}}"+ ] =?>+ para "Foo moin, niom" , testGroup "Citations" Citation.tests , testGroup "Footnotes" Note.tests
test/command/1710.md view
@@ -55,7 +55,7 @@ </div> ^D \begin{frame}{Slide one}-\protect\hypertarget{slide-one}{}+\phantomsection\label{slide-one} \begin{columns}[T] \begin{column}{0.4\textwidth} \begin{itemize}
test/command/2874.md view
@@ -10,5 +10,5 @@ % pandoc -f html -t latex <a name="foo"></a><br/> ^D-\protect\hypertarget{foo}{}{}\strut \\+\phantomsection\label{foo}{}\strut \\ ```
test/command/3568.md view
@@ -10,7 +10,7 @@ normal \f[I]italic \f[BI]bold in the middle\f[I] only italic\f[R] normal. .PP-normal \f[B]bold \f[VB]code\f[B] more bold\f[R] normal.+normal \f[B]bold \f[CB]code\f[B] more bold\f[R] normal. .PP-normal \f[V]code\f[R] normal.+normal \f[CR]code\f[R] normal. ```
test/command/4016.md view
@@ -14,11 +14,11 @@ </div> ^D \begin{frame}{Level 2 blocks}-\protect\hypertarget{level-2-blocks}{}+\phantomsection\label{level-2-blocks} \begin{columns}[T] \begin{column}{0.4\textwidth} \begin{block}{Block one}-\protect\hypertarget{block-one}{}+\phantomsection\label{block-one} \begin{itemize} \tightlist \item@@ -29,7 +29,7 @@ \begin{column}{0.6\textwidth} \begin{block}{Block two}-\protect\hypertarget{block-two}{}+\phantomsection\label{block-two} \begin{itemize} \tightlist \item
test/command/4690.md view
@@ -12,7 +12,7 @@ :::: ^D \begin{frame}{title}-\protect\hypertarget{title}{}+\phantomsection\label{title} \begin{columns}[T] \begin{column}{0.08\textwidth} content
test/command/5340.md view
@@ -8,7 +8,7 @@ ^D \url{https://example.com/foo-bar} \url{https://example.com/foo--bar}-\url{https://example.com/foo%2Dbar}-\url{https://example.com/foo%2D%2Dbar}-\url{https://example.com/foo%2D%2Dbar}+\url{https://example.com/foo\%2Dbar}+\url{https://example.com/foo\%2D\%2Dbar}+\url{https://example.com/foo\%2D\%2Dbar} ```
test/command/5620.md view
@@ -4,6 +4,6 @@ : Write output to *OUTFILE* instead of `stdout`(3) ^D .TP-\f[V]-o\f[R], \f[V]--output=\f[R]\f[I]OUTFILE\f[R]-Write output to \f[I]OUTFILE\f[R] instead of \f[V]stdout\f[R](3)+\f[CR]-o\f[R], \f[CR]--output=\f[R]\f[I]OUTFILE\f[R]+Write output to \f[I]OUTFILE\f[R] instead of \f[CR]stdout\f[R](3) ```
test/command/6030.md view
@@ -83,11 +83,11 @@ \end{frame} \begin{frame}{Three}-\protect\hypertarget{three}{}+\phantomsection\label{three} Three \begin{block}{Four}-\protect\hypertarget{four}{}+\phantomsection\label{four} Four \end{block} \end{frame}
test/command/6107.md view
@@ -16,11 +16,11 @@ \section{A circus!}\label{a-circus} \begin{frame}{Another silly title}-\protect\hypertarget{another-silly-title}{}+\phantomsection\label{another-silly-title} Not much to do about nothing. \end{frame} \begin{frame}[standout]{Epilogue}-\protect\hypertarget{epilogue}{}+\phantomsection\label{epilogue} \end{frame} ```
test/command/6360.md view
@@ -2,5 +2,5 @@ % pandoc -f native -t latex --wrap=none [Link ("test2",[],[]) [Str "link",Space,Str "to",Space,Str "text",Space,Str "test1"] ("#test1","")] ^D-\protect\hypertarget{test2}{\hyperref[test1]{link to text test1}}+\phantomsection\label{test2}\hyperref[test1]{link to text test1} ```
test/command/7016.md view
@@ -39,6 +39,7 @@ </body> <back> <ref-list>+ <title></title> <ref id="ref-doe"> <mixed-citation>Doe, J. (2021). Another article. <italic>Proceedings of the Academy of Test Inputs</italic>.
test/command/7278.md view
@@ -17,21 +17,21 @@ text in block ^D \begin{frame}{Slide}-\protect\hypertarget{slide}{}+\phantomsection\label{slide} Some blocks: \begin{exampleblock}{example block title}-\protect\hypertarget{example-block-title}{}+\phantomsection\label{example-block-title} text in block \end{exampleblock} \begin{alertblock}{alert block title}-\protect\hypertarget{alert-block-title}{}+\phantomsection\label{alert-block-title} text in block \end{alertblock} \begin{block}{block title}-\protect\hypertarget{block-title}{}+\phantomsection\label{block-title} text in block \end{block} \end{frame}
test/command/7857.md view
@@ -15,7 +15,7 @@ \note{my note} \begin{frame}{slide}-\protect\hypertarget{slide}{}+\phantomsection\label{slide} ok \end{frame} ```
+ test/command/8254.md view
@@ -0,0 +1,20 @@+```+% pandoc -t native+Wow![@legras_michel_2010]+^D+[ Para+ [ Str "Wow!"+ , Cite+ [ Citation+ { citationId = "legras_michel_2010"+ , citationPrefix = []+ , citationSuffix = []+ , citationMode = NormalCitation+ , citationNoteNum = 2+ , citationHash = 0+ }+ ]+ [ Str "[@legras_michel_2010]" ]+ ]+]+```
+ test/command/8853.md view
@@ -0,0 +1,6 @@+```+% pandoc -f markdown+wikilinks_title_after_pipe --wrap=none+[[hi]] and ![[hi]]+^D+<p><a href="hi" title="wikilink">hi</a> and <img src="hi" title="wikilink" alt="hi" /></p>+```
+ test/command/9017.md view
@@ -0,0 +1,53 @@+```+% pandoc -t jats --citeproc -s+---+references:+- author: DeGroot+ id: degroot_probability+ title: Probability+ issued: 2002+title: Doc example with single reference+---++# I like++[@degroot_probability].+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+ "JATS-archivearticle1.dtd">+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+<title-group>+<article-title>Doc example with single reference</article-title>+</title-group>+<permissions>+</permissions>+</article-meta>+</front>+<body>+<sec id="i-like">+ <title>I like</title>+ <p>(DeGroot 2002).</p>+</sec>+</body>+<back>+<ref-list>+ <title></title>+ <ref id="ref-degroot_probability">+ <mixed-citation>DeGroot. 2002. “Probability.”</mixed-citation>+ </ref>+</ref-list>+</back>+</article>+```
+ test/command/9038.md view
@@ -0,0 +1,6 @@+```+% pandoc -t native+![foo]+^D+[ Para [ Str "![foo]" ] ]+```
+ test/command/9042.md view
@@ -0,0 +1,30 @@+```+% pandoc -f org+#+TITLE: Testing++* Testing++p. lower case++P. Upper Case+^D+<h1 id="testing-1">Testing</h1>+<p>p. lower case</p>+<p>P. Upper Case</p>+```+```+% pandoc -f org+fancy_lists+#+TITLE: Testing++* Testing++p. lower case++P. Upper Case+^D+<h1 id="testing-1">Testing</h1>+<ol type="a">+<li><p>lower case</p></li>+<li><p>Upper Case</p></li>+</ol>+```
+ test/command/9043.md view
@@ -0,0 +1,13 @@+```+% pandoc -t latex+[**TreeTagger**](https://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/)+^D+\href{https://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/}{\textbf{TreeTagger}}+```++```+% pandoc -t latex+[**TreeTagger**](https://www.cis.uni-muenchen.de/%E7schmid/tools/TreeTagger/)+^D+\href{https://www.cis.uni-muenchen.de/\%E7schmid/tools/TreeTagger/}{\textbf{TreeTagger}}+```
test/jats-reader.native view
@@ -8,6 +8,30 @@ , MetaInlines [ Str "Anonymous" ] ] )+ , ( "copyright"+ , MetaMap+ (fromList+ [ ( "holder" , MetaString "MacFarlane et al" )+ , ( "statement"+ , MetaString "\169 2023, MacFarlane et al"+ )+ , ( "year" , MetaString "2023" )+ ])+ )+ , ( "license"+ , MetaMap+ (fromList+ [ ( "link"+ , MetaString+ "https://creativecommons.org/licenses/by/4.0/"+ )+ , ( "text"+ , MetaString+ "This document is distributed under a Creative Commons Attribution 4.0 International license."+ )+ , ( "type" , MetaString "open-access" )+ ])+ ) , ( "references" , MetaList [ MetaMap (fromList [ ( "id" , MetaString "note_1" ) ])
test/jats-reader.xml view
@@ -27,6 +27,15 @@ </name> </contrib> </contrib-group>+<permissions>+ <copyright-statement>© 2023, MacFarlane et al</copyright-statement>+ <copyright-year>2023</copyright-year>+ <copyright-holder>MacFarlane et al</copyright-holder>+ <license license-type="open-access">+ <ali:license_ref xmlns:ali="http://www.niso.org/schemas/ali/1.0/">https://creativecommons.org/licenses/by/4.0/</ali:license_ref>+ <license-p>This document is distributed under a Creative Commons Attribution 4.0 International license.</license-p>+ </license>+ </permissions> </article-meta> </front> <body>
test/lhs-test.html view
@@ -168,7 +168,7 @@ .display.math{display: block; text-align: center; margin: 0.5rem auto;} /* CSS for syntax highlighting */ pre > code.sourceCode { white-space: pre; position: relative; }- pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }+ pre > code.sourceCode > span { line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; }
test/lhs-test.html+lhs view
@@ -168,7 +168,7 @@ .display.math{display: block; text-align: center; margin: 0.5rem auto;} /* CSS for syntax highlighting */ pre > code.sourceCode { white-space: pre; position: relative; }- pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }+ pre > code.sourceCode > span { line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; }
test/writer.man view
@@ -1,19 +1,4 @@-.\" Define V font for inline verbatim, using C font in formats-.\" that render this, and otherwise B font.-.ie "\f[CB]x\f[]"x" \{\-. ftr V B-. ftr VI BI-. ftr VB B-. ftr VBI BI-.\}-.el \{\-. ftr V CR-. ftr VI CI-. ftr VB CB-. ftr VBI CBI-.\} .TH "Pandoc Test Suite" "" "July 17, 2006" "" ""-.hy .PP This is a set of tests for pandoc. Most of them are adapted from John Gruber\[cq]s markdown test suite.@@ -27,15 +12,12 @@ .SH Level 1 .SS Level 2 with \f[I]emphasis\f[R] .SS Level 3-.PP with no blank line .SS Level 2-.PP with no blank line .PP * * * * * .SH Paragraphs-.PP Here\[cq]s a regular paragraph. .PP In Markdown 1.0.0 and earlier.@@ -55,7 +37,6 @@ .PP * * * * * .SH Block Quotes-.PP E-mail style: .RS .PP@@ -66,13 +47,11 @@ .PP Code in a block quote: .IP-.nf-\f[C]+.EX sub status { print \[dq]working\[dq]; }-\f[R]-.fi+.EE .PP A list: .IP "1." 3@@ -97,11 +76,9 @@ .PP * * * * * .SH Code Blocks-.PP Code: .IP-.nf-\f[C]+.EX ---- (should be four hyphens) sub status {@@ -109,23 +86,19 @@ } this code block is indented by one tab-\f[R]-.fi+.EE .PP And: .IP-.nf-\f[C]+.EX this code block is indented by two tabs These should not be escaped: \[rs]$ \[rs]\[rs] \[rs]> \[rs][ \[rs]{-\f[R]-.fi+.EE .PP * * * * * .SH Lists .SS Unordered-.PP Asterisks tight: .IP \[bu] 2 asterisk 1@@ -174,7 +147,6 @@ .IP \[bu] 2 Minus 3 .SS Ordered-.PP Tight: .IP "1." 3 First@@ -329,7 +301,6 @@ .PP * * * * * .SH Definition Lists-.PP Tight using spaces: .TP apple@@ -376,11 +347,9 @@ orange fruit .RS .IP-.nf-\f[C]+.EX { orange code block }-\f[R]-.fi+.EE .RS .PP orange block quote@@ -422,7 +391,6 @@ sublist .RE .SH HTML Blocks-.PP Simple block on one line: foo .PP@@ -441,21 +409,17 @@ .PP This should be a code block, though: .IP-.nf-\f[C]+.EX <div> foo </div>-\f[R]-.fi+.EE .PP As should this: .IP-.nf-\f[C]+.EX <div>foo</div>-\f[R]-.fi+.EE .PP Now, nested: foo@@ -466,27 +430,22 @@ .PP Code block: .IP-.nf-\f[C]+.EX <!-- Comment -->-\f[R]-.fi+.EE .PP Just plain comment, with trailing spaces on the line: .PP Code: .IP-.nf-\f[C]+.EX <hr />-\f[R]-.fi+.EE .PP Hr\[cq]s: .PP * * * * * .SH Inline Markup-.PP This is \f[I]emphasized\f[R], and so \f[I]is this\f[R]. .PP This is \f[B]strong\f[R], and so \f[B]is this\f[R].@@ -501,8 +460,8 @@ .PP So is \f[B]\f[BI]this\f[B]\f[R] word. .PP-This is code: \f[V]>\f[R], \f[V]$\f[R], \f[V]\[rs]\f[R], \f[V]\[rs]$\f[R],-\f[V]<html>\f[R].+This is code: \f[CR]>\f[R], \f[CR]$\f[R], \f[CR]\[rs]\f[R], \f[CR]\[rs]$\f[R],+\f[CR]<html>\f[R]. .PP [STRIKEOUT:This is \f[I]strikeout\f[R].] .PP@@ -515,7 +474,6 @@ .PP * * * * * .SH Smart quotes, ellipses, dashes-.PP \[lq]Hello,\[rq] said the spider. \[lq]`Shelob' is my name.\[rq] .PP@@ -526,7 +484,7 @@ .PP `He said, \[lq]I want to go.\[rq]' Were you alive in the 70\[cq]s? .PP-Here is some quoted `\f[V]code\f[R]' and a \[lq]quoted+Here is some quoted `\f[CR]code\f[R]' and a \[lq]quoted link (http://example.com/?foo=1&bar=2)\[rq]. .PP Some dashes: one\[em]two \[em] three\[em]four \[em] five.@@ -559,7 +517,7 @@ .PP These shouldn\[cq]t be math: .IP \[bu] 2-To get the famous equation, write \f[V]$e = mc\[ha]2$\f[R].+To get the famous equation, write \f[CR]$e = mc\[ha]2$\f[R]. .IP \[bu] 2 $22,000 is a \f[I]lot\f[R] of money. So is $34,000.@@ -567,13 +525,12 @@ .IP \[bu] 2 Shoes ($20) and socks ($5). .IP \[bu] 2-Escaped \f[V]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$.+Escaped \f[CR]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$. .PP Here\[cq]s a LaTeX table: .PP * * * * * .SH Special Characters-.PP Here is some unicode: .IP \[bu] 2 I hat: Î@@ -631,7 +588,6 @@ * * * * * .SH Links .SS Explicit-.PP Just a URL. .PP URL and title.@@ -650,7 +606,6 @@ .PP Empty. .SS Reference-.PP Foo bar. .PP With embedded [brackets].@@ -665,17 +620,14 @@ .PP This should [not][] be a link. .IP-.nf-\f[C]+.EX [not]: /url-\f[R]-.fi+.EE .PP Foo bar. .PP Foo biz. .SS With ampersands-.PP Here\[cq]s a link with an ampersand in the URL (http://example.com/?foo=1&bar=2). .PP@@ -685,7 +637,6 @@ .PP Here\[cq]s an inline link in pointy braces. .SS Autolinks-.PP With an ampersand: <http://example.com/?foo=1&bar=2> .IP \[bu] 2 In a list?@@ -700,17 +651,14 @@ Blockquoted: <http://example.com/> .RE .PP-Auto-links should not occur here: \f[V]<http://example.com/>\f[R]+Auto-links should not occur here: \f[CR]<http://example.com/>\f[R] .IP-.nf-\f[C]+.EX or here: <http://example.com/>-\f[R]-.fi+.EE .PP * * * * * .SH Images-.PP From \[lq]Voyage dans la Lune\[rq] by Georges Melies (1902): [IMAGE: lalune] lalune@@ -719,7 +667,6 @@ .PP * * * * * .SH Footnotes-.PP Here is a footnote reference,[1] and another.[2] This should \f[I]not\f[R] be a footnote reference, because it contains a space.[\[ha]my note] Here is an inline note.[3]@@ -745,18 +692,16 @@ Subsequent blocks are indented to show that they belong to the footnote (as with list items). .IP-.nf-\f[C]+.EX { <code> }-\f[R]-.fi+.EE .PP If you want, you can indent every line, but you can also be lazy and just indent the first line of each block. .SS [3] .PP This is \f[I]easier\f[R] to type.-Inline notes may contain links (http://google.com) and \f[V]]\f[R] verbatim+Inline notes may contain links (http://google.com) and \f[CR]]\f[R] verbatim characters, as well as [bracketed text]. .SS [4] .PP
test/writer.ms view
@@ -644,8 +644,8 @@ .PP So is \f[B]\f[BI]this\f[B]\f[R] word. .PP-This is code: \f[C]>\f[R], \f[C]$\f[R], \f[C]\[rs]\f[R], \f[C]\[rs]$\f[R],-\f[C]<html>\f[R].+This is code: \f[CR]>\f[R], \f[CR]$\f[R], \f[CR]\[rs]\f[R], \f[CR]\[rs]$\f[R],+\f[CR]<html>\f[R]. .PP \m[strikecolor]This is \f[I]strikeout\f[R].\m[] .PP@@ -671,7 +671,7 @@ .PP `He said, \[lq]I want to go.\[rq]' Were you alive in the 70\[cq]s? .PP-Here is some quoted `\f[C]code\f[R]' and a \[lq]\c+Here is some quoted `\f[CR]code\f[R]' and a \[lq]\c .pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \ -- "quoted link" \&\[rq].@@ -707,7 +707,7 @@ .LP These shouldn\[cq]t be math: .IP \[bu] 3-To get the famous equation, write \f[C]$e = mc\[ha]2$\f[R].+To get the famous equation, write \f[CR]$e = mc\[ha]2$\f[R]. .IP \[bu] 3 $22,000 is a \f[I]lot\f[R] of money. So is $34,000.@@ -715,7 +715,7 @@ .IP \[bu] 3 Shoes ($20) and socks ($5). .IP \[bu] 3-Escaped \f[C]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$.+Escaped \f[CR]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$. .LP Here\[cq]s a LaTeX table: .HLINE@@ -938,7 +938,7 @@ \& .QE .LP-Auto-links should not occur here: \f[C]<http://example.com/>\f[R]+Auto-links should not occur here: \f[CR]<http://example.com/>\f[R] .IP .nf \f[C]@@ -991,7 +991,7 @@ Inline notes may contain \c .pdfhref W -D "http://google.com" -A "\c" \ -- "links"-\& and \f[C]]\f[R] verbatim characters, as well as [bracketed text].+\& and \f[CR]]\f[R] verbatim characters, as well as [bracketed text]. .FE .QS .LP