pandoc 3.0.1 → 3.1
raw patch · 29 files changed
+255/−90 lines, 29 filesdep ~skylightingdep ~skylighting-corebinary-added
Dependency ranges changed: skylighting, skylighting-core
Files
- AUTHORS.md +3/−0
- INSTALL.md +3/−5
- MANUAL.txt +14/−3
- changelog.md +47/−0
- man/pandoc.1 +17/−4
- pandoc.cabal +3/−3
- src/Text/Pandoc/App/CommandLineOptions.hs +8/−1
- src/Text/Pandoc/App/Opt.hs +5/−0
- src/Text/Pandoc/App/OutputSettings.hs +4/−0
- src/Text/Pandoc/Chunks.hs +7/−2
- src/Text/Pandoc/Citeproc/BibTeX.hs +2/−24
- src/Text/Pandoc/Citeproc/MetaValue.hs +2/−3
- src/Text/Pandoc/Options.hs +3/−0
- src/Text/Pandoc/Readers/ODT/ContentReader.hs +16/−10
- src/Text/Pandoc/Readers/ODT/StyleReader.hs +8/−8
- src/Text/Pandoc/Readers/Textile.hs +5/−2
- src/Text/Pandoc/Writers/ChunkedHTML.hs +1/−1
- src/Text/Pandoc/Writers/LaTeX.hs +2/−3
- src/Text/Pandoc/Writers/LaTeX/Caption.hs +16/−7
- src/Text/Pandoc/Writers/LaTeX/Table.hs +2/−3
- src/Text/Pandoc/Writers/Powerpoint/Presentation.hs +7/−1
- test/Tests/Readers/ODT.hs +2/−1
- test/command/7678.md +31/−0
- test/command/8611.md +34/−0
- test/command/newif.md +7/−7
- test/odt/markdown/blockquote2.md +3/−0
- test/odt/odt/blockquote2.odt binary
- test/tables/nordics.latex +2/−1
- test/textile-reader.textile +1/−1
AUTHORS.md view
@@ -73,6 +73,7 @@ - Craig S. Bosma - Damien Clochard - Daniel Bergey+- Daniel Kessler - Daniel Maslowski - Daniel T. Staal - Daniele D'Orazio@@ -216,6 +217,7 @@ - Mario Lang - Mark Szepieniec - Mark Wright+- Martin Joerg - Martin Linn - Masataka Ogawa - Masayoshi Takahashi@@ -309,6 +311,7 @@ - Simon Schuster - Siphalor - Stefan Dresselhaus+- Stephen Altamirano - Sukil Etxenike - Sukka - Sumit Sahrawat
INSTALL.md view
@@ -205,10 +205,9 @@ 1. Install [stack][stack]. Note that Pandoc requires stack >= 1.7.0. -2. Change to the pandoc source directory and issue the following commands:-+2. stack setup- stack install+ stack install pandoc-cli `stack setup` will automatically download the ghc compiler if you don't have it. `stack install` will install the@@ -228,7 +227,7 @@ 3. Use `cabal` to install pandoc and its dependencies: - cabal install pandoc+ cabal install pandoc-cli This procedure will install the released version of pandoc, which will be downloaded automatically from HackageDB.@@ -325,7 +324,6 @@ To run particular tests (pattern-matching on their names), use the `-p` option: - cabal install pandoc --enable-tests cabal test --test-options='-p markdown' Or with stack:
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: January 25, 2023+date: February 8, 2023 --- # Synopsis@@ -1261,6 +1261,17 @@ level of 2 or 3. For chunked HTML, this option determines how much content goes in each "chunk." +`--chunk-template=`*PATHTEMPLATE*++: Specify a template for the filenames in a `chunkedhtml` document.+ In the template, `%n` will be replaced by the chunk number (padded+ with leading 0s to 3 digits), `%s` with the section number of the chunk,+ `%h` with the heading text (with formatting removed), `%i` with+ the section identifier. For example, `%section-%s-%i.html` might+ be resolved to `section-1.1-introduction.html`. The characters+ `/` and `\` are not allowed in chunk templates and will be+ ignored. The default is `%s-%i.html`.+ `--epub-chapter-level=`*NUMBER* : *Deprecated synonym for `--split-level`.*@@ -4202,8 +4213,8 @@ Note that space between items in a definition list is required. (A variant that loosens this requirement, but disallows "lazy"-hard wrapping, can be activated with `compact_definition_lists`: see-[Non-default extensions], below.)+hard wrapping, can be activated with the [`compact_definition_lists`+extension][Extension: `compact_definition_lists`].) [^3]: I have been influenced by the suggestions of [David Wheeler](https://justatheory.com/2009/02/modest-markdown-proposal/).
changelog.md view
@@ -1,5 +1,52 @@ # Revision history for pandoc +## pandoc 3.1 (2023-02-09)++ * Fix regression with `--print-highlight-style` option (#8586).++ * Add new `--chunk-template` option (#8581), allowing more control+ over the filenames in chunked HTML output.++ * Text.Pandoc.App: Add `optChunkTemplate` constructor to Opt [API change].++ * Text.Pandoc.Options: add `writerChunkTemplate` constructor to+ `WriterOptions` [API change].++ * Text.Pandoc.Chunks: add Data, Typeable, Generic, ToJSON, FromJSON+ instances for `PathTemplate` [API change].++ * Text.Pandoc.Citeproc: Fix bug in `metaValueToReference` (#8611).+ This bug caused us to get some repeated content when converting+ MetaBlock to Inlines.++ * Textile reader:++ + Support footnote backlinks (#8585, Stephen Altamirano).+ + Don't allow brackets in URLs (#8582).++ * ODT reader: fix blockquote indent detection (#3437, Daniel Kessler).++ * LaTeX writer: include short figure/table caption if one is given+ (Albert Krewinkel). Short captions are used by LaTeX when generating+ the list of figures or list of tables. Adding a short caption will+ now overwrite the full caption in these lists.++ * Powerpoint writer: fix handling of simple figures (#8565,+ Albert Krewinkel). This ensures that simple figures are displayed+ in the same way as before the introduction of a dedicated `Figure`+ constructor in the AST.++ * Improve handling of `%` in bib(la)tex parsing (#8597, #8595).++ * Use released skylighting 0.13.2.1++ * INSTALL.md: direct people to cabal install pandoc-cli.++ * doc/lua-filters.md: document 'Figure' type and constructor (Albert+ Krewinkel). Fix typos (Martin Joerg).++ * Fix link in manual (#8583, Salim B).+ ## pandoc 3.0.1 (2023-01-25) * Fix use of extensions with custom readers (#8571).
man/pandoc.1 view
@@ -1,4 +1,4 @@-.\" Automatically generated by Pandoc 3.0+.\" Automatically generated by Pandoc 3.0.1 .\" .\" 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" "" "January 25, 2023" "pandoc 3.0.1" ""+.TH "Pandoc User\[cq]s Guide" "" "February 8, 2023" "pandoc 3.1" "" .hy .SH NAME pandoc - general markup converter@@ -1360,6 +1360,19 @@ For chunked HTML, this option determines how much content goes in each \[lq]chunk.\[rq] .TP+\f[V]--chunk-template=\f[R]\f[I]PATHTEMPLATE\f[R]+Specify a template for the filenames in a \f[V]chunkedhtml\f[R]+document.+In the template, \f[V]%n\f[R] will be replaced by the chunk number+(padded with leading 0s to 3 digits), \f[V]%s\f[R] with the section+number of the chunk, \f[V]%h\f[R] with the heading text (with formatting+removed), \f[V]%i\f[R] with the section identifier.+For example, \f[V]%section-%s-%i.html\f[R] might be resolved to+\f[V]section-1.1-introduction.html\f[R].+The characters \f[V]/\f[R] and \f[V]\[rs]\f[R] are not allowed in chunk+templates and will be ignored.+The default is \f[V]%s-%i.html\f[R].+.TP \f[V]--epub-chapter-level=\f[R]\f[I]NUMBER\f[R] \f[I]Deprecated synonym for \f[VI]--split-level\f[I].\f[R] .TP@@ -4489,8 +4502,8 @@ .PP Note that space between items in a definition list is required. (A variant that loosens this requirement, but disallows \[lq]lazy\[rq]-hard wrapping, can be activated with \f[V]compact_definition_lists\f[R]:-see Non-default extensions, below.)+hard wrapping, can be activated with the+\f[V]compact_definition_lists\f[R] extension.) .SS Numbered example lists .SS Extension: \f[V]example_lists\f[R] .PP
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: pandoc-version: 3.0.1+version: 3.1 build-type: Simple license: GPL-2.0-or-later license-file: COPYING.md@@ -506,8 +506,8 @@ random >= 1 && < 1.3, safe >= 0.3.18 && < 0.4, scientific >= 0.3 && < 0.4,- skylighting >= 0.13.2 && < 0.14,- skylighting-core >= 0.13.2 && < 0.14,+ skylighting >= 0.13.2.1 && < 0.14,+ skylighting-core >= 0.13.2.1 && < 0.14, split >= 0.2 && < 0.3, syb >= 0.1 && < 0.8, tagsoup >= 0.14.6 && < 0.15,
src/Text/Pandoc/App/CommandLineOptions.hs view
@@ -793,6 +793,13 @@ "NUMBER") "" -- "Header level at which to split documents in chunked HTML or EPUB" + , Option "" ["chunk-template"]+ (ReqArg+ (\arg opt ->+ return opt{ optChunkTemplate = Just (T.pack arg) })+ "PATHTEMPLATE")+ "" -- "Template for file paths in chunkedhtml"+ , Option "" ["epub-chapter-level"] (ReqArg (\arg opt -> do@@ -979,7 +986,7 @@ , Option "" ["print-highlight-style"] (ReqArg (\arg opts ->- optInfo $ PrintDefaultDataFile (optOutputFile opts)+ optInfo $ PrintHighlightStyle (optOutputFile opts) (T.pack arg)) "STYLE|FILE") "" -- "Print default template for FORMAT"
src/Text/Pandoc/App/Opt.hs view
@@ -127,6 +127,7 @@ , optAbbreviations :: Maybe FilePath -- ^ Path to abbrevs file , optReferenceDoc :: Maybe FilePath -- ^ Path of reference doc , optSplitLevel :: Int -- ^ Header level at which to split documents in epub and chunkedhtml+ , optChunkTemplate :: Maybe Text -- ^ Template to use for chunk filenames , optEpubSubdirectory :: String -- ^ EPUB subdir in OCF container , optEpubMetadata :: Maybe FilePath -- ^ EPUB metadata , optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed@@ -209,6 +210,7 @@ <*> o .:? "reference-doc" <*> ((o .:? "split-level") <|> (o .:? "epub-chapter-level")) .!= optSplitLevel defaultOpts+ <*> o .:? "chunk-template" <*> o .:? "epub-subdirectory" .!= optEpubSubdirectory defaultOpts <*> o .:? "epub-metadata" <*> o .:? "epub-fonts" .!= optEpubFonts defaultOpts@@ -563,6 +565,8 @@ parseJSON v >>= \x -> return (\o -> o{ optSplitLevel = x }) "split-level" -> parseJSON v >>= \x -> return (\o -> o{ optSplitLevel = x })+ "chunk-template" ->+ parseJSON v >>= \x -> return (\o -> o{ optChunkTemplate = Just x }) "epub-cover-image" -> parseJSON v >>= \x -> return (\o -> o{ optEpubCoverImage = unpack <$> x })@@ -740,6 +744,7 @@ , optAbbreviations = Nothing , optReferenceDoc = Nothing , optSplitLevel = 1+ , optChunkTemplate = Nothing , optEpubSubdirectory = "EPUB" , optEpubMetadata = Nothing , optEpubFonts = []
src/Text/Pandoc/App/OutputSettings.hs view
@@ -35,6 +35,7 @@ import System.Exit (exitSuccess) import System.FilePath import System.IO (stdout)+import Text.Pandoc.Chunks (PathTemplate(..)) import Text.Pandoc import Text.Pandoc.App.FormatHeuristics (formatFromFilePaths) import Text.Pandoc.App.Opt (Opt (..))@@ -249,6 +250,9 @@ , writerEpubFonts = optEpubFonts opts , writerEpubTitlePage = optEpubTitlePage opts , writerSplitLevel = optSplitLevel opts+ , writerChunkTemplate = maybe (PathTemplate "%s-%i.html")+ PathTemplate+ (optChunkTemplate opts) , writerTOCDepth = optTOCDepth opts , writerReferenceDoc = optReferenceDoc opts , writerSyntaxMap = syntaxMap
src/Text/Pandoc/Chunks.hs view
@@ -1,9 +1,9 @@ {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TupleSections #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {- | Module : Text.Pandoc.Chunks@@ -26,9 +26,11 @@ , tocToList , SecInfo(..) ) where+ import Text.Pandoc.Definition import Text.Pandoc.Shared (makeSections, stringify, inlineListToIdentifier) import Text.Pandoc.Walk (Walkable(..))+import Data.Aeson (FromJSON, ToJSON) import Data.Text (Text) import Text.Printf (printf) import Data.Maybe (fromMaybe, isNothing)@@ -38,6 +40,8 @@ import GHC.Generics (Generic) import Text.HTML.TagSoup (Tag (TagOpen), fromAttrib, parseTags) import Data.Tree (Tree(..))+import Data.Data (Data)+import Data.Typeable (Typeable) -- | Split 'Pandoc' into 'Chunk's, e.g. for conversion into -- a set of HTML pages or EPUB chapters.@@ -236,6 +240,7 @@ -> FilePath resolvePathTemplate (PathTemplate templ) chunknum headingText ident secnum = T.unpack .+ T.filter (\c -> c /= '/' && c /= '\\') . T.replace "%n" (T.pack $ printf "%03d" chunknum) . T.replace "%s" secnum . T.replace "%h" headingText .@@ -253,7 +258,7 @@ -- @"section-1.2-introduction.html"@. newtype PathTemplate = PathTemplate { unPathTemplate :: Text }- deriving (Show, IsString)+ deriving (Show, IsString, Data, Typeable, Generic, ToJSON, FromJSON) -- | A part of a document (typically a chapter or section, or -- the part of a section before its subsections).
src/Text/Pandoc/Citeproc/BibTeX.hs view
@@ -842,17 +842,6 @@ inBraces = do char '{' res <- manyTill- ( take1WhileP (\c -> c /= '{' && c /= '}' && c /= '\\' && c /= '%')- <|> (char '\\' >> T.cons '\\' . T.singleton <$> anyChar)- <|> ("" <$ (char '%' >> anyLine))- <|> (braced <$> inBraces)- ) (char '}')- return $ T.concat res--inBracesURL :: BibParser Text-inBracesURL = do- char '{'- res <- manyTill ( take1WhileP (\c -> c /= '{' && c /= '}' && c /= '\\') <|> (char '\\' >> T.cons '\\' . T.singleton <$> anyChar) <|> (braced <$> inBraces)@@ -866,20 +855,11 @@ inQuotes = do char '"' T.concat <$> manyTill- ( take1WhileP (\c -> c /= '{' && c /= '"' && c /= '\\' && c /= '%')+ ( take1WhileP (\c -> c /= '{' && c /= '"' && c /= '\\') <|> (char '\\' >> T.cons '\\' . T.singleton <$> anyChar)- <|> ("" <$ (char '%' >> anyLine)) <|> braced <$> inBraces ) (char '"') -inQuotesURL :: BibParser Text-inQuotesURL = do- char '"'- T.concat <$> manyTill- ( take1WhileP (\c -> c /= '{' && c /= '"' && c /= '\\')- <|> (char '\\' >> T.cons '\\' . T.singleton <$> anyChar)- ) (char '"')- fieldName :: BibParser Text fieldName = resolveAlias . T.toLower <$> take1WhileP (\c ->@@ -915,9 +895,7 @@ spaces' char '=' spaces'- let inQ = if k == "url" then inQuotesURL else inQuotes- let inB = if k == "url" then inBracesURL else inBraces- vs <- (expandString <|> inQ <|> inB <|> rawWord) `sepBy`+ vs <- (expandString <|> inQuotes <|> inBraces <|> rawWord) `sepBy` try (spaces' >> char '#' >> spaces') spaces' return (k, T.concat vs)
src/Text/Pandoc/Citeproc/MetaValue.hs view
@@ -9,8 +9,7 @@ import Citeproc.Types import Text.Pandoc.Definition import Text.Pandoc.Builder as B-import Text.Pandoc.Walk (query)-import Text.Pandoc.Shared (stringify)+import Text.Pandoc.Shared (stringify, blocksToInlines') import Data.Maybe import Safe import qualified Data.Set as Set@@ -126,7 +125,7 @@ case v of MetaString t -> TextVal t MetaInlines ils -> FancyVal (B.fromList ils)- MetaBlocks bs -> FancyVal (B.fromList $ query id bs)+ MetaBlocks bs -> FancyVal (blocksToInlines' bs) MetaBool b -> TextVal (if b then "true" else "false") MetaList _ -> TextVal mempty MetaMap _ -> TextVal mempty
src/Text/Pandoc/Options.hs view
@@ -45,6 +45,7 @@ import Skylighting (SyntaxMap, defaultSyntaxMap) import Text.DocTemplates (Context(..), Template) import Text.Pandoc.Extensions+import Text.Pandoc.Chunks (PathTemplate) import Text.Pandoc.Highlighting (Style, pygments) import Text.Pandoc.UTF8 (toStringLazy) import Data.Aeson.TH (deriveJSON)@@ -318,6 +319,7 @@ , writerEpubFonts :: [FilePath] -- ^ Paths to fonts to embed , writerEpubTitlePage :: Bool -- ^ Include title page in epub , writerSplitLevel :: Int -- ^ Header level at which to split EPUB or chunked HTML into separate files+ , writerChunkTemplate :: PathTemplate -- ^ Template for filenames in chunked HTML , writerTOCDepth :: Int -- ^ Number of levels to include in TOC , writerReferenceDoc :: Maybe FilePath -- ^ Path to reference document if specified , writerReferenceLocation :: ReferenceLocation -- ^ Location of footnotes and references for writing markdown@@ -355,6 +357,7 @@ , writerEpubFonts = [] , writerEpubTitlePage = True , writerSplitLevel = 1+ , writerChunkTemplate = "%s-%i.html" , writerTOCDepth = 3 , writerReferenceDoc = Nothing , writerReferenceLocation = EndOfDocument
src/Text/Pandoc/Readers/ODT/ContentReader.hs view
@@ -370,16 +370,21 @@ _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_MM_ = 5 _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_PERCENT_ = 5 --- | Returns either 'id' or 'blockQuote' depending on the current indentation-getParaModifier :: Style -> ParaModifier-getParaModifier Style{..} | Just props <- paraProperties styleProperties- , isBlockQuote (indentation props)- (margin_left props)- = blockQuote- | otherwise- = id+-- | Returns either 'id' or 'blockQuote' depending if any of the StyleProperties+-- are indented at quote level.+getParaModifier :: [StyleProperties] -> ParaModifier+getParaModifier props | any isBlockQuote props+ = blockQuote+ | otherwise+ = id where- isBlockQuote mIndent mMargin+ isBlockQuote SProps {..} | Just paraProps <- paraProperties+ , isQuoteWidth (indentation paraProps)+ (margin_left paraProps)+ = True+ | otherwise+ = False+ isQuoteWidth mIndent mMargin | LengthValueMM indent <- mIndent , indent > _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_MM_ = True@@ -413,7 +418,8 @@ blocks' <- reader -< blocks arr tableCaptionP -< blocks' Right (_, style) -> do- let modifier = getParaModifier style+ props <- fromStyles extendedStylePropertyChain -< [style]+ let modifier = getParaModifier props blocks' <- reader -< blocks arr modifier -<< blocks' where
src/Text/Pandoc/Readers/ODT/StyleReader.hs view
@@ -330,14 +330,14 @@ -- so I could not really easily calculate anything exact here even if I wanted. -- But I do not care about exactness right now, as I only use measures -- to determine if a paragraph is "indented" or not.-estimateInMillimeter :: Int -> XslUnit -> Int-estimateInMillimeter n XslUnitMM = n-estimateInMillimeter n XslUnitCM = n * 10-estimateInMillimeter n XslUnitInch = n * 25 -- \* 25.4-estimateInMillimeter n XslUnitPoints = n `div` 3 -- \* 1/72 * 25.4-estimateInMillimeter n XslUnitPica = n * 4 -- \* 12 * 1/72 * 25.4-estimateInMillimeter n XslUnitPixel = n `div`3 -- \* 1/72 * 25.4-estimateInMillimeter n XslUnitEM = n * 7 -- \* 16 * 1/72 * 25.4+estimateInMillimeter :: Double -> XslUnit -> Int+estimateInMillimeter n XslUnitMM = round n+estimateInMillimeter n XslUnitCM = round $ n * 10+estimateInMillimeter n XslUnitInch = round $ n * 25.4+estimateInMillimeter n XslUnitPoints = round $ n * (1/72) * 25.4+estimateInMillimeter n XslUnitPica = round $ n * 12 * (1/72) * 25.4+estimateInMillimeter n XslUnitPixel = round $ n * (1/72) * 25.4+estimateInMillimeter n XslUnitEM = round $ n * 16 * (1/72) * 25.4 ----
src/Text/Pandoc/Readers/Textile.hs view
@@ -90,7 +90,10 @@ Pandoc nullMeta . B.toList <$> parseBlocks -- FIXME noteMarker :: PandocMonad m => TextileParser m Text-noteMarker = skipMany spaceChar >> string "fn" >> T.pack <$> manyTill digit (char '.')+noteMarker = do+ skipMany spaceChar+ string "fn"+ T.pack <$> manyTill digit (string "." <|> try (string "^.")) noteBlock :: PandocMonad m => TextileParser m Text noteBlock = try $ do@@ -618,7 +621,7 @@ char ':' let stop = if bracketed then char ']'- else lookAhead $ space <|> eof' <|>+ else lookAhead $ space <|> eof' <|> oneOf "[]" <|> try (oneOf "!.,;:*" *> (space <|> newline <|> eof')) T.pack <$> many1Till nonspaceChar stop
src/Text/Pandoc/Writers/ChunkedHTML.hs view
@@ -55,7 +55,7 @@ epochtime <- floor <$> getPOSIXTime let toMediaEntry (fp, _mt, bs) = toEntry fp epochtime bs mediaEntries <- map toMediaEntry . mediaItems <$> getMediaBag- let chunkedDoc = splitIntoChunks "%s-%i.html"+ let chunkedDoc = splitIntoChunks (writerChunkTemplate opts) True (Just 1) (writerSplitLevel opts)
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -563,9 +563,8 @@ blockToLaTeX (Table attr blkCapt specs thead tbodies tfoot) = tableToLaTeX inlineListToLaTeX blockListToLaTeX (Ann.toTable attr blkCapt specs thead tbodies tfoot)-blockToLaTeX (Figure (ident, _, _) (Caption _ longCapt) body) = do- (capt, captForLof, footnotes) <- getCaption inlineListToLaTeX True- (blocksToInlines longCapt)+blockToLaTeX (Figure (ident, _, _) captnode body) = do+ (capt, captForLof, footnotes) <- getCaption inlineListToLaTeX True captnode lab <- labelFor ident let caption = "\\caption" <> captForLof <> braces capt <> lab
src/Text/Pandoc/Writers/LaTeX/Caption.hs view
@@ -25,14 +25,20 @@ import Text.Pandoc.Writers.LaTeX.Types ( LW, WriterState (stExternalNotes, stNotes) ) ++-- | Produces the components of a LaTeX 'caption' command. Returns a triple+-- containing the caption text, the short caption for the list of+-- figures/tables, and the footnote definitions. getCaption :: PandocMonad m- => ([Inline] -> LW m (Doc Text))- -> Bool -> [Inline]+ => ([Inline] -> LW m (Doc Text)) -- ^ inlines converter+ -> Bool -- ^ whether to extract notes+ -> Caption -> LW m (Doc Text, Doc Text, Doc Text)-getCaption inlineListToLaTeX externalNotes txt = do+getCaption inlineListToLaTeX externalNotes (Caption maybeShort long) = do+ let long' = blocksToInlines long oldExternalNotes <- gets stExternalNotes modify $ \st -> st{ stExternalNotes = externalNotes, stNotes = [] }- capt <- inlineListToLaTeX txt+ capt <- inlineListToLaTeX long' footnotes <- if externalNotes then notesToLaTeX <$> gets stNotes else return empty@@ -41,7 +47,10 @@ let getNote (Note _) = Any True getNote _ = Any False let hasNotes = getAny . query getNote- captForLof <- if hasNotes txt- then brackets <$> inlineListToLaTeX (walk deNote txt)- else return empty+ let toShortCapt = fmap brackets . inlineListToLaTeX . walk deNote+ captForLof <- case maybeShort of+ Nothing -> if hasNotes long'+ then toShortCapt long'+ else return empty+ Just short -> toShortCapt short return (capt, captForLof, footnotes)
src/Text/Pandoc/Writers/LaTeX/Table.hs view
@@ -26,7 +26,7 @@ import Text.DocLayout ( Doc, braces, cr, empty, hcat, hsep, isEmpty, literal, nest , text, vcat, ($$) )-import Text.Pandoc.Shared (blocksToInlines, splitBy, tshow)+import Text.Pandoc.Shared (splitBy, tshow) import Text.Pandoc.Walk (walk, query) import Data.Monoid (Any(..)) import Text.Pandoc.Writers.LaTeX.Caption (getCaption)@@ -159,8 +159,7 @@ -> Caption -> Text -- ^ table identifier (label) -> LW m CaptionDocs-captionToLaTeX inlnsToLaTeX (Caption _maybeShort longCaption) ident = do- let caption = blocksToInlines longCaption+captionToLaTeX inlnsToLaTeX caption ident = do (captionText, captForLot, captNotes) <- getCaption inlnsToLaTeX False caption label <- labelFor ident return $ CaptionDocs
src/Text/Pandoc/Writers/Powerpoint/Presentation.hs view
@@ -539,7 +539,12 @@ in local addIncremental (concatMapM blockToParagraphs blks) blockToParagraphs (Figure attr capt blks) = blockToParagraphs (Shared.figureDiv attr capt blks)-blockToParagraphs blk = do+blockToParagraphs hr@HorizontalRule = notRendered hr+blockToParagraphs tbl@Table{} = notRendered tbl++-- | Report that a block cannot be rendered.+notRendered :: Block -> Pres [Paragraph]+notRendered blk = do addLogMessage $ BlockNotRendered blk return [] @@ -594,6 +599,7 @@ withAttr attr . Pic def{picPropLink = Just $ ExternalTarget target} (T.unpack url) title <$> inlinesToParElems ils+blockToShape (Figure _figattr _caption [b]) = blockToShape b blockToShape (Table _ blkCapt specs thead tbody tfoot) = do let (caption, algn, _, hdrCells, rows) = toLegacyTable blkCapt specs thead tbody tfoot caption' <- inlinesToParElems caption
test/Tests/Readers/ODT.hs view
@@ -146,7 +146,8 @@ namesOfTestsComparingToMarkdown :: [ String ]-namesOfTestsComparingToMarkdown = [ "bold"+namesOfTestsComparingToMarkdown = [ "blockquote2"+ , "bold" -- , "citation" , "endnote" , "externalLink"
test/command/7678.md view
@@ -29,3 +29,34 @@ } ] ```+```+% pandoc -f bibtex -t csljson+@misc{doe,+ author = "Jane Doe",+ title = "Work",+ year = "2021",+ doi = "%20and%20"+}+^D+[+ {+ "DOI": "%20and%20",+ "author": [+ {+ "family": "Doe",+ "given": "Jane"+ }+ ],+ "id": "doe",+ "issued": {+ "date-parts": [+ [+ 2021+ ]+ ]+ },+ "title": "Work",+ "type": ""+ }+]+```
+ test/command/8611.md view
@@ -0,0 +1,34 @@+```+% pandoc -f markdown -s -t bibtex+---+nocite: "[@*]"+references:+- id: mcdowell:why+ title: |+ Why is Sellars's Essay Called "Empiricism and the Philosophy of Mind"?+ author:+ - family: McDowell+ given: John+ journal: Proceedings of the Aristotelian Society+ type: chapter+ container-title: 'Empiricism, Perceptual Knowledge, Normativity, and Realism: Essays on Wilfrid Sellars'+ editor:+ - family: deVries+ given: Willem A.+ issued: 2009+ publisher: Oxford University Press+ publisher-place: Oxford+...+^D+@incollection{mcdowell:why,+ author = {McDowell, John},+ editor = {deVries, Willem A.},+ publisher = {Oxford University Press},+ title = {Why Is {Sellars’s} {Essay} {Called} “{Empiricism} and the+ {Philosophy} of {Mind}”?},+ booktitle = {Empiricism, Perceptual Knowledge, Normativity, and+ Realism: Essays on Wilfrid Sellars},+ year = {2009},+ address = {Oxford}+}+```
test/command/newif.md view
@@ -5,26 +5,26 @@ \iftrue should print \else-should not print+should not print A \fi \else-should not print+should not print B \fi \iffalse-should not print+should not print C \else \iftrue should print \else-should not print+should not print D \fi \fi \newif\ifepub \ifepub-should not print+should not print E \fi \epubtrue@@ -32,13 +32,13 @@ \ifepub should print \else-should not print+should not print F \fi \epubfalse \ifepub-should not print+should not print G \else should print \fi
+ test/odt/markdown/blockquote2.md view
@@ -0,0 +1,3 @@+Paragraph++> A blockquote.
+ test/odt/odt/blockquote2.odt view
binary file changed (absent → 9024 bytes)
test/tables/nordics.latex view
@@ -3,7 +3,8 @@ >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.3000}} >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.2000}} >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.2000}}@{}}-\caption{States belonging to the \emph{Nordics.}}\label{nordics}\tabularnewline+\caption[Nordic countries]{States belonging to the+\emph{Nordics.}}\label{nordics}\tabularnewline \toprule\noalign{} \begin{minipage}[b]{\linewidth}\centering Name
test/textile-reader.textile view
@@ -269,7 +269,7 @@ fn1. The note is here! -fn2. Other note.+fn2^. Other note. h1. Comment blocks