pandoc-crossref 0.3.12.1 → 0.3.12.2
raw patch · 4 files changed
+38/−10 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +18/−0
- docs/index.md +9/−1
- lib-internal/Text/Pandoc/CrossRef/References/Blocks.hs +3/−1
- pandoc-crossref.cabal +8/−8
CHANGELOG.md view
@@ -1,3 +1,21 @@+## 0.3.12.2++- Make section numbering more consistent with pandoc++ If the first heading in your document is level 2 or more, pandoc will assign+ index `0` to the implicit sections. Pandoc-crossref, on the other hand,+ assinged index `1` to these sections previously. This could lead to an+ off-by-one discrepancy between section and reference indices when using+ pandoc's `--number-sections`.++ This behaviour is now aligned with pandoc, i.e. missing top-level sections+ will get index of `0`.++ The old behaviour is kept when using pandoc-crossref's `numberSections`,+ for backwards compatibility and also because having references start with+ `0` is rather impractical to begin with.++ ## 0.3.12.1 - Fix docx tableEqns
docs/index.md view
@@ -255,6 +255,12 @@ `numberSections` controls if pandoc-crossref handles numbering sections, while `sectionsDepth` controls what sections are numbered. +Additionally, with `numberSections`, if the first heading in your document is+level 2 or more, pandoc-crossref will assume you meant to have implicit+headings with previous levels, and will assign those phantom implicit headings+the index `1`. Without `numberSections`, the behaviour is consistent with+pandoc, that is, missing headings will be assigned the index `0`.+ Set `sectionsDepth` to `0` to make section numbering consistent with `chaptersDepth`. @@ -486,7 +492,9 @@ corresponding to header numbers, e.g. `fig. 1.4.3`. - `numberSections`, default `false`: if True, pandoc-crossref will prepend section number to section titles (as counted by- pandoc-crossref itself).+ pandoc-crossref itself). This also makes pandoc-crossref assign missing+ top-level headings the index of `1` instead of `0` to avoid ugly `sec.+ 0.0.1` references. - `sectionsDepth`, default `0`: - sectionsDepth \< 0 -- number all sections - sectionsDepth == 0 -- be consistent with `chaptersDepths`
lib-internal/Text/Pandoc/CrossRef/References/Blocks.hs view
@@ -89,7 +89,9 @@ inc l = let i = fst (last l) + 1 in init l <> [(i, cl i)] cc' | ln > n = inc $ take n cc | ln == n = inc cc- | otherwise = cc <> take (n-ln-1) (zip [1,1..] $ repeat Nothing) <> [(1,cl 1)]+ | otherwise = cc <> take (n-ln-1) implicitChapters <> [(1,cl 1)]+ implicitChapters | numberSections opts = repeat (1, Nothing)+ | otherwise = repeat (0, Nothing) in cc' when ("sec:" `T.isPrefixOf` label') $ do index <- use curChap
pandoc-crossref.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 44cad1985e34691bb2ecdb6ccac537a1eb9de77329edf1dbfbdbb485ca98e803+-- hash: 643ffe23ec490430a946bbeec84db2ff503e9b935182801185089d7fba7cdc3f name: pandoc-crossref-version: 0.3.12.1+version: 0.3.12.2 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@@ -110,7 +110,7 @@ build-depends: base >=4.11 && <5 , mtl >=1.1 && <2.3- , pandoc >=2.10 && <2.17+ , pandoc >=2.10 && <2.18 , pandoc-crossref-internal , pandoc-types >=1.21 && <1.23 , text >=1.2.2 && <1.3@@ -145,7 +145,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.3- , pandoc >=2.10 && <2.17+ , pandoc >=2.10 && <2.18 , pandoc-types >=1.21 && <1.23 , roman-numerals ==0.5.* , syb >=0.4 && <0.8@@ -167,7 +167,7 @@ , gitrev >=1.3.1 && <1.4 , open-browser ==0.2.* , optparse-applicative >=0.13 && <0.17- , pandoc >=2.10 && <2.17+ , pandoc >=2.10 && <2.18 , pandoc-crossref , pandoc-types >=1.21 && <1.23 , template-haskell >=2.7.0.0 && <3.0.0.0@@ -186,7 +186,7 @@ , directory >=1 && <1.4 , filepath >=1.1 && <1.5 , hspec >=2.4.4 && <3- , pandoc >=2.10 && <2.17+ , pandoc >=2.10 && <2.18 , pandoc-crossref , pandoc-types >=1.21 && <1.23 , text >=1.2.2 && <1.3@@ -212,7 +212,7 @@ , hspec >=2.4.4 && <3 , microlens >=0.4.12.0 && <0.5.0.0 , mtl >=1.1 && <2.3- , pandoc >=2.10 && <2.17+ , pandoc >=2.10 && <2.18 , pandoc-crossref , pandoc-crossref-internal , pandoc-types >=1.21 && <1.23@@ -232,7 +232,7 @@ build-depends: base >=4.11 && <5 , criterion >=1.5.9.0 && <1.6- , pandoc >=2.10 && <2.17+ , pandoc >=2.10 && <2.18 , pandoc-crossref , pandoc-types >=1.21 && <1.23 , text >=1.2.2 && <1.3