pandoc-crossref 0.3.24 → 0.3.25
raw patch · 9 files changed
+60/−19 lines, 9 filesdep ~pandocPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: pandoc
API changes (from Hackage documentation)
- Text.Pandoc.CrossRef: autoEqnLabels :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: autoSectionLabels :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: ccsDelim :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: ccsLabelSep :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: ccsTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: chapDelim :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: chapters :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: chaptersDepth :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: codeBlockCaptions :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: cref :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: crossrefYaml :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: customHeadingLabel :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: customLabel :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqLabels :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqnBlockInlineMath :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqnBlockTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqnDisplayTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqnIndexTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqnInlineTableTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqnInlineTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqnPrefix :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: eqnPrefixTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: equationNumberTeX :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: figLabels :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: figPrefix :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: figPrefixTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: figureTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: figureTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: getOptions :: Meta -> Maybe Format -> Options
- Text.Pandoc.CrossRef: lastDelim :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: linkReferences :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: listItemTitleDelim :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: listOfMetadata :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: listingTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: listingTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: listings :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lofItemTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lofItemTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lofTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lolItemTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lolItemTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lolTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lotItemTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lotItemTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lotTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lstLabels :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lstPrefix :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: lstPrefixTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: nameInLink :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: numberSections :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: outFormat :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: pairDelim :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: preserveAltText :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: rangeDelim :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: refDelim :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: refIndexTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: secHeaderDelim :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: secHeaderTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: secLabels :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: secPrefix :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: secPrefixTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: sectionsDepth :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: setLabelAttribute :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: subfigColumns :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: subfigGrid :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: subfigLabels :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: subfigureChildTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: subfigureRefIndexTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: subfigureTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: tableEqns :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: tableTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: tableTitle :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: tblLabels :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: tblPrefix :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: tblPrefixTemplate :: ToMetaValue a => a -> Meta
- Text.Pandoc.CrossRef: titleDelim :: ToMetaValue a => a -> Meta
Files
- docs/index.md +1/−1
- lib-internal/Text/Pandoc/CrossRef/References/Blocks/Subfigures.hs +1/−1
- lib-internal/Text/Pandoc/CrossRef/References/Blocks/Util.hs +1/−2
- pandoc-crossref.cabal +10/−7
- test/m2m/preserveAltText/expect.md +12/−0
- test/m2m/preserveAltText/expect.tex +17/−0
- test/m2m/preserveAltText/input.md +13/−0
- test/m2m/standalone-listOfMetadata/expect.md +2/−2
- test/test-pandoc-crossref.hs +3/−6
docs/index.md view
@@ -789,7 +789,7 @@ - `linkReferences`, default `false`: Make references hyperlinks to the referenced element - `nameInLink`, default `false`: For single-element references,- inlcude prefix into hyperlink (when using `linkReferences`)+ include prefix into hyperlink (when using `linkReferences`) Note that none of the `*Delim` options are honored with cleveref output. Use cleveref's customization options instead.
lib-internal/Text/Pandoc/CrossRef/References/Blocks/Subfigures.hs view
@@ -94,7 +94,7 @@ | otherwise = blks where figurize x- | Para is <- x = case (mapMaybe getImg is) `zip` widths' of+ | Para is <- x = case mapMaybe getImg is `zip` widths' of [] -> Nothing -- skip empty Paras [_] -> error "The impossible happened: single-element Para in \ \subfigure which is not a figure"
lib-internal/Text/Pandoc/CrossRef/References/Blocks/Util.hs view
@@ -39,7 +39,6 @@ import Text.Pandoc.Shared (stringify, deNote) import Text.Pandoc.Walk (walk) import Control.Monad (when)-import Data.Maybe (fromMaybe) import Text.Read (readMaybe) @@ -103,7 +102,7 @@ | otherwise = 1 index = chap S.|> (i, refLabel <|> customLabel (Pfx pfx) i) synthLabel = IdxSynth globCtr- label' = fromMaybe synthLabel $ IdxRef pfx <$> label+ label' = maybe synthLabel (IdxRef pfx) label when (M.member label' prop') $ error $ "Duplicate label: " <> displayIdx label' wsReferences . ctrsAt pfx .= index
pandoc-crossref.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: pandoc-crossref-version: 0.3.24+version: 0.3.25 synopsis: Pandoc filter for cross-references description: pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them. category: Text@@ -108,6 +108,9 @@ test/m2m/numberOverride/expect.md test/m2m/numberOverride/expect.tex test/m2m/numberOverride/input.md+ test/m2m/preserveAltText/expect.md+ test/m2m/preserveAltText/expect.tex+ test/m2m/preserveAltText/input.md test/m2m/refsInListOf/expect.md test/m2m/refsInListOf/expect.tex test/m2m/refsInListOf/input.md@@ -178,7 +181,7 @@ , microlens >=0.4.12.0 && <0.5.0.0 , microlens-mtl >=0.2.0.1 && <0.3.0.0 , mtl >=1.1 && <2.4- , pandoc >=3.8.2 && <3.10+ , pandoc ==3.10.* , pandoc-crossref-internal , pandoc-types ==1.23.* , text >=1.2.2 && <2.2@@ -232,7 +235,7 @@ , microlens-mtl >=0.2.0.1 && <0.3.0.0 , microlens-th >=0.4.3.10 && <0.5.0.0 , mtl >=1.1 && <2.4- , pandoc >=3.8.2 && <3.10+ , pandoc ==3.10.* , pandoc-types ==1.23.* , syb >=0.4 && <0.8 , template-haskell >=2.7.0.0 && <3.0.0.0@@ -262,7 +265,7 @@ , gitrev >=1.3.1 && <1.4 , open-browser >=0.2 && <0.4 , optparse-applicative >=0.13 && <0.20- , pandoc >=3.8.2 && <3.10+ , pandoc ==3.10.* , pandoc-crossref , pandoc-types ==1.23.* , template-haskell >=2.7.0.0 && <3.0.0.0@@ -292,7 +295,7 @@ , directory >=1 && <1.4 , filepath >=1.1 && <1.6 , hspec >=2.4.4 && <3- , pandoc >=3.8.2 && <3.10+ , pandoc ==3.10.* , pandoc-crossref , pandoc-types ==1.23.* , text >=1.2.2 && <2.2@@ -328,7 +331,7 @@ , microlens >=0.4.12.0 && <0.5.0.0 , microlens-mtl >=0.2.0.1 && <0.3.0.0 , mtl >=1.1 && <2.4- , pandoc >=3.8.2 && <3.10+ , pandoc ==3.10.* , pandoc-crossref , pandoc-crossref-internal , pandoc-types ==1.23.*@@ -357,7 +360,7 @@ build-depends: base >=4.19 && <5 , criterion >=1.5.9.0 && <1.7- , pandoc >=3.8.2 && <3.10+ , pandoc ==3.10.* , pandoc-crossref , pandoc-types ==1.23.* , text >=1.2.2 && <2.2
+ test/m2m/preserveAltText/expect.md view
@@ -0,0 +1,12 @@+{#fig:one alt="Single figure"}++:::: {#fig:figureRef .figure .subfigures}+{#fig:figureRefA alt="subfigure 1 caption"}++{#fig:figureRefB alt="subfigure 2 caption"}++::: caption+Figure 2: Caption of figure. a --- subfigure 1 caption, b --- subfigure+2 caption+:::+::::
+ test/m2m/preserveAltText/expect.tex view
@@ -0,0 +1,17 @@+\begin{figure}+\centering+\pandocbounded{\includegraphics[keepaspectratio,alt={Single figure}]{./fig1.png}}+\caption{Single figure}\label{fig:one}+\end{figure}++\begin{pandoccrossrefsubfigures}++\begin{subfigure}{1.0\linewidth}\centering\pandocbounded{\includegraphics[keepaspectratio,alt={subfigure 1 caption}]{image1.png}}\caption{subfigure+1 caption\label{fig:figureRefA}}\end{subfigure}%++\begin{subfigure}{1.0\linewidth}\centering\pandocbounded{\includegraphics[keepaspectratio,alt={subfigure 2 caption}]{image2.png}}\caption{subfigure+2 caption\label{fig:figureRefB}}\end{subfigure}%++\caption{Caption of figure}\label{fig:figureRef}++\end{pandoccrossrefsubfigures}
+ test/m2m/preserveAltText/input.md view
@@ -0,0 +1,13 @@+---+preserveAltText: True+---++{#fig:one}++:::{#fig:figureRef}+{#fig:figureRefA}++{#fig:figureRefB}++Caption of figure+:::
test/m2m/standalone-listOfMetadata/expect.md view
@@ -104,14 +104,14 @@ rangeDelim: "-" refDelim: ", " refIndexTemplate: $$i$$$$suf$$-secHeaderDelim:+secHeaderDelim: secHeaderTemplate: $$i$$$$secHeaderDelim[n]$$$$t$$ secLabels: arabic secPrefix: - sec. - secs. secPrefixTemplate: $$p$$ $$i$$-sectionsDepth: 0+sectionsDepth: "0" standalone: true subfigGrid: false subfigLabels: alpha a
test/test-pandoc-crossref.hs view
@@ -420,7 +420,7 @@ testCBCaptions :: Blocks -> Blocks -> Expectation testCBCaptions bs res = let opts = defaultOptions{Text.Pandoc.CrossRef.Util.Options.codeBlockCaptions=True}- in (bottomUp (\bs' -> fromMaybe bs' $ Util.CodeBlockCaptions.mkCodeBlockCaptions opts bs') (toList bs)) `shouldBe` toList res+ in bottomUp (\bs' -> fromMaybe bs' $ Util.CodeBlockCaptions.mkCodeBlockCaptions opts bs') (toList bs) `shouldBe` toList res testList :: Blocks -> References -> Blocks -> Expectation testList bs st res = runWSWithOptsInit defaultOptions st (bottomUpM listOf' (toList bs))@@ -505,10 +505,7 @@ infixr 0 =: (=:) :: Prefix -> M.Map RefIndex RefRec -> References a =: b = def- & ctrsAt a .~ (refIndex $ last $ M.elems b)+ & ctrsAt a .~ refIndex (last $ M.elems b) & refsAt a .~ b & stGlob %~ (+ fromIntegral (M.size b))- & stHiddenHeaderLevel .~- if a == PfxSec- then [HiddenHeader { hhLevel = 1, hhHidden = False }]- else []+ & stHiddenHeaderLevel .~ [HiddenHeader { hhLevel = 1, hhHidden = False } | a == PfxSec]