pandoc-crossref 0.3.8.0 → 0.3.8.1
raw patch · 6 files changed
+34/−8 lines, 6 filesdep ~pandocdep ~pandoc-typesPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: pandoc, pandoc-types
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- lib/Text/Pandoc/CrossRef/References/Blocks.hs +12/−6
- pandoc-crossref.cabal +5/−2
- test/m2m/multiple-eqn-same-para/expect.md +3/−0
- test/m2m/multiple-eqn-same-para/expect.tex +5/−0
- test/m2m/multiple-eqn-same-para/input.md +5/−0
CHANGELOG.md view
@@ -1,3 +1,7 @@+## 0.3.8.1++- Fix parsing multiple inlines in block+ ## 0.3.8.0 - [LaTeX] Move hypertarget inside equation environment
lib/Text/Pandoc/CrossRef/References/Blocks.hs view
@@ -46,7 +46,10 @@ replaceAll :: (Data a) => Options -> a -> WS a replaceAll opts =- runReplace (mkRR (replaceBlock opts) `extRR` replaceInline opts)+ runReplace (mkRR (replaceBlock opts)+ `extRR` replaceInline opts+ `extRR` replaceInlineMany opts+ ) . runSplitMath . everywhere (mkT divBlocks `extT` spanInlines opts) where@@ -292,23 +295,26 @@ idxTxt = stringify idxStr return (eq', idxTxt) -replaceInline :: Options -> [Inline] -> WS (ReplacedResult [Inline])-replaceInline opts (Span attrs@(label,_,_) [Math DisplayMath eq]:xs)+replaceInlineMany :: Options -> [Inline] -> WS (ReplacedResult [Inline])+replaceInlineMany opts (Span attrs@(label,_,_) [Math DisplayMath eq]:xs) | "eq:" `T.isPrefixOf` label || T.null label && autoEqnLabels opts- = replaceNoRecurse . (<>xs) =<< case outFormat opts of+ = replaceRecurse . (<>xs) =<< case outFormat opts of f | isLatexFormat f -> pure [RawInline (Format "latex") "\\begin{equation}" , Span attrs [RawInline (Format "latex") eq] , RawInline (Format "latex") $ mkLaTeXLabel label <> "\\end{equation}"] _ -> pure . Span attrs . (:[]) . Math DisplayMath . fst <$> replaceEqn opts attrs eq-replaceInline opts (Image attr@(label,_,attrs) alt img@(_, tit):xs)+replaceInlineMany _ _ = noReplaceRecurse++replaceInline :: Options -> Inline -> WS (ReplacedResult Inline)+replaceInline opts (Image attr@(label,_,attrs) alt img@(_, tit)) | "fig:" `T.isPrefixOf` label && "fig:" `T.isPrefixOf` tit = do idxStr <- replaceAttr opts (Right label) (lookup "label" attrs) alt imgRefs let alt' = case outFormat opts of f | isLatexFormat f -> alt _ -> applyTemplate idxStr alt $ figureTemplate opts- replaceNoRecurse $ Image attr alt' img:xs+ replaceNoRecurse $ Image attr alt' img replaceInline _ _ = noReplaceRecurse replaceSubfigs :: Options -> [Inline] -> WS (ReplacedResult [Inline])
pandoc-crossref.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 16b94461d13008e2ca6ada6c83e8f56a855b54be95bc2d50ee6c0a4367bd1232+-- hash: 60aff0647917782b159c09b84eb53496da9ed0f414fe0eb7d77857567ba27dfb name: pandoc-crossref-version: 0.3.8.0+version: 0.3.8.1 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@@ -49,6 +49,9 @@ test/m2m/listing-captions-ids/expect.md test/m2m/listing-captions-ids/expect.tex test/m2m/listing-captions-ids/input.md+ test/m2m/multiple-eqn-same-para/expect.md+ test/m2m/multiple-eqn-same-para/expect.tex+ test/m2m/multiple-eqn-same-para/input.md test/m2m/section-template/expect.md test/m2m/section-template/expect.tex test/m2m/section-template/input.md
+ test/m2m/multiple-eqn-same-para/expect.md view
@@ -0,0 +1,3 @@+Simple test [$$x=y\qquad(1)$$]{#eq:1} [$$x=y\qquad(2)$$]{#eq:2}++eqns. 1, 2
+ test/m2m/multiple-eqn-same-para/expect.tex view
@@ -0,0 +1,5 @@+Simple test+\begin{equation}\protect\hypertarget{eq:1}{}{x=y}\label{eq:1}\end{equation}+\begin{equation}\protect\hypertarget{eq:2}{}{x=y}\label{eq:2}\end{equation}++eqns.~\ref{eq:1}, \ref{eq:2}
+ test/m2m/multiple-eqn-same-para/input.md view
@@ -0,0 +1,5 @@+Simple test+$$x=y$${#eq:1}+$$x=y$${#eq:2}++[@eq:1; @eq:2]