packages feed

pandoc-crossref 0.3.21 → 0.3.22

raw patch · 30 files changed

+407/−268 lines, 30 filesdep ~pandocPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: pandoc

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,42 @@+## 0.3.22++### Changes++-   Update to support pandoc 3.8.2 (gesh)++    Recent changes in Pandoc are incompatible with older versions of+    pandoc-crossref.++    Minimal supported version of Pandoc is now 3.8.2.++### Fixes++-   Do not inject duplicate TeX label for tables++    Since Pandoc 3.8.2, table labels (and other attributes) are parsed. As such,+    they're also added to LaTeX. But pandoc-crossref adds its own LaTeX labels,+    which creates duplicates.++    Now, pandoc-crossref only injects labels if a table without a label of its+    own is wrapped in a Div. This is mostly kept for backwards compatibility.++-   Remove flaky tests flag from freezefile++    `cabal.project.freeze` no longer sets `enable_flaky_tests` flag. This+    shouldn't affect end users, but this is a consideration for downstream+    packagers.++### Maintenance++-   Remove divBlocks hack++    This hack reparsed table titles to support `{#tbl:foo}` syntax for labels.+    This is now redundant as Pandoc parses this itself. Hence removed.++-   Makefile: config nix experimental-features, fix yq invocation (gesh)++    These changes make the Makefile more robust.+ ## 0.3.21  ### New features
lib-internal/Text/Pandoc/CrossRef/References/Blocks.hs view
@@ -97,7 +97,7 @@   = runCodeBlock (label, nub $ divClasses <> cbClasses, divAttrs <> cbAttrs) code $ Right caption replaceBlock (Para [Span attr [Math DisplayMath eq]])   = runBlockMath attr eq-replaceBlock x = maybe noReplaceRecurse replaceBlock $ divBlocks x+replaceBlock _ = noReplaceRecurse  replaceInlineMany :: [Inline] -> WS (ReplacedResult [Inline]) replaceInlineMany (Span spanAttr@(label,clss,attrs) [Math DisplayMath eq]:xs) = do@@ -124,16 +124,6 @@     Just res' -> replaceRecurse res'     Nothing -> liftF (listOf x opts) `fixRefs` xs replaceBlockMany [] = noReplaceRecurse--divBlocks :: Block -> Maybe Block-divBlocks (Table tattr (Caption short (btitle:rest)) colspec header cells foot)-  | not $ null title-  , Just label <- getRefLabel PfxTbl [last title]-  = Just $ Div (label,[],[]) [-    Table tattr (Caption short $ walkReplaceInlines (dropWhileEnd isSpace (init title)) title btitle:rest) colspec header cells foot]-  where-    title = blocksToInlines [btitle]-divBlocks _ = Nothing  spanInlines :: Options -> [Inline] -> [Inline] spanInlines opts (math@(Math DisplayMath _eq):ils)
lib-internal/Text/Pandoc/CrossRef/References/Blocks/Table.hs view
@@ -24,6 +24,7 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared (blocksToInlines) import Data.Function ((&))+import qualified Data.Text as T  import Text.Pandoc.CrossRef.References.Monad import Text.Pandoc.CrossRef.References.Blocks.Util@@ -39,8 +40,12 @@   idxStr <- chapIndex ref   let short' | refHideFromList ref = Just mempty              | otherwise = short+      maybeTeXLabel+        | Just (tid, _, _) <- mtattr+        , T.null tid = latexLabel ref+        | otherwise = mempty       title'-        | isLatexFormat opts = latexLabel ref <> title+        | isLatexFormat opts = maybeTeXLabel <> title         | otherwise = applyTemplate idxStr title $ tableTemplate opts       caption' = Caption short' (walkReplaceInlines title' title btitle:rest)       label' | isLatexFormat opts = ""
pandoc-crossref.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.38.1.+-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack  name:           pandoc-crossref-version:        0.3.21+version:        0.3.22 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@@ -30,6 +30,9 @@     test/m2m/delim/expect.md     test/m2m/delim/expect.tex     test/m2m/delim/input.md+    test/m2m/divTable/expect.md+    test/m2m/divTable/expect.tex+    test/m2m/divTable/input.md     test/m2m/emptyChapterLabels/expect.md     test/m2m/emptyChapterLabels/expect.tex     test/m2m/emptyChapterLabels/input.md@@ -168,11 +171,11 @@       BlockArguments   ghc-options: -Wall   build-depends:-      base >=4.16 && <5+      base >=4.19 && <5     , 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.*+    , pandoc >=3.8.2 && <3.9     , pandoc-crossref-internal     , pandoc-types ==1.23.*     , text >=1.2.2 && <2.2@@ -216,7 +219,7 @@       ApplicativeDo       BlockArguments   build-depends:-      base >=4.16 && <5+      base >=4.19 && <5     , containers >=0.1 && <0.9     , data-default >=0.4 && <0.9     , directory >=1 && <1.4@@ -226,7 +229,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.*+    , pandoc >=3.8.2 && <3.9     , pandoc-types ==1.23.*     , syb >=0.4 && <0.8     , template-haskell >=2.7.0.0 && <3.0.0.0@@ -251,12 +254,12 @@       BlockArguments   ghc-options: -Wall -threaded   build-depends:-      base >=4.16 && <5+      base >=4.19 && <5     , deepseq >=1.4 && <1.6     , gitrev >=1.3.1 && <1.4     , open-browser >=0.2 && <0.4     , optparse-applicative >=0.13 && <0.20-    , pandoc ==3.8.*+    , pandoc >=3.8.2 && <3.9     , pandoc-crossref     , pandoc-types ==1.23.*     , template-haskell >=2.7.0.0 && <3.0.0.0@@ -282,11 +285,11 @@   build-tool-depends:       pandoc-cli:pandoc   build-depends:-      base >=4.16 && <5+      base >=4.19 && <5     , directory >=1 && <1.4     , filepath >=1.1 && <1.6     , hspec >=2.4.4 && <3-    , pandoc ==3.8.*+    , pandoc >=3.8.2 && <3.9     , pandoc-crossref     , pandoc-types ==1.23.*     , text >=1.2.2 && <2.2@@ -315,14 +318,14 @@       BlockArguments   ghc-options: -Wall -fno-warn-unused-do-bind -threaded   build-depends:-      base >=4.16 && <5+      base >=4.19 && <5     , containers >=0.1 && <0.9     , data-default >=0.4 && <0.9     , hspec >=2.4.4 && <3     , 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.*+    , pandoc >=3.8.2 && <3.9     , pandoc-crossref     , pandoc-crossref-internal     , pandoc-types ==1.23.*@@ -349,9 +352,9 @@       BlockArguments   ghc-options: -Wall -fno-warn-unused-do-bind -threaded   build-depends:-      base >=4.16 && <5+      base >=4.19 && <5     , criterion >=1.5.9.0 && <1.7-    , pandoc ==3.8.*+    , pandoc >=3.8.2 && <3.9     , pandoc-crossref     , pandoc-types ==1.23.*     , text >=1.2.2 && <2.2
src/ManData.hs view
@@ -2,6 +2,7 @@ pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them. Copyright (C) 2015  Nikolay Yakimov <root@livid.pp.ru>+Copyright (C) 2025  Gesh <gesh@gesh.uni.cx>  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
test/demo-chapters.inc view
@@ -602,80 +602,77 @@       1       ( "sec:chapter-3.-tables" , [] , [] )       [ Str "Chapter" , Space , Str "3." , Space , Str "Tables" ]-  , Div+  , Table       ( "tbl:table1" , [] , [] )-      [ Table-          ( "" , [] , [] )-          (Caption-             Nothing-             [ Plain-                 [ Emph [ Str "Table" , Space , Str "3.1" ]-                 , Str ":"-                 , Space-                 , Str "Table"-                 , Space-                 , Str "example"-                 ]-             ])-          [ ( AlignLeft , ColWidthDefault )-          , ( AlignLeft , ColWidthDefault )-          ]-          (TableHead+      (Caption+         Nothing+         [ Plain+             [ Emph [ Str "Table" , Space , Str "3.1" ]+             , Str ":"+             , Space+             , Str "Table"+             , Space+             , Str "example"+             ]+         ])+      [ ( AlignLeft , ColWidthDefault )+      , ( AlignLeft , ColWidthDefault )+      ]+      (TableHead+         ( "" , [] , [] )+         [ Row              ( "" , [] , [] )-             [ Row+             [ Cell                  ( "" , [] , [] )-                 [ Cell-                     ( "" , [] , [] )-                     AlignDefault-                     (RowSpan 1)-                     (ColSpan 1)-                     [ Plain [ Str "First" , Space , Str "Header" ] ]-                 , Cell-                     ( "" , [] , [] )-                     AlignDefault-                     (RowSpan 1)-                     (ColSpan 1)-                     [ Plain [ Str "Second" , Space , Str "Header" ] ]-                 ]-             ])-          [ TableBody+                 AlignDefault+                 (RowSpan 1)+                 (ColSpan 1)+                 [ Plain [ Str "First" , Space , Str "Header" ] ]+             , Cell+                 ( "" , [] , [] )+                 AlignDefault+                 (RowSpan 1)+                 (ColSpan 1)+                 [ Plain [ Str "Second" , Space , Str "Header" ] ]+             ]+         ])+      [ TableBody+          ( "" , [] , [] )+          (RowHeadColumns 0)+          []+          [ Row               ( "" , [] , [] )-              (RowHeadColumns 0)-              []-              [ Row+              [ Cell                   ( "" , [] , [] )-                  [ Cell-                      ( "" , [] , [] )-                      AlignDefault-                      (RowSpan 1)-                      (ColSpan 1)-                      [ Plain [ Str "Content" , Space , Str "Cell" ] ]-                  , Cell-                      ( "" , [] , [] )-                      AlignDefault-                      (RowSpan 1)-                      (ColSpan 1)-                      [ Plain [ Str "Content" , Space , Str "Cell" ] ]-                  ]-              , Row+                  AlignDefault+                  (RowSpan 1)+                  (ColSpan 1)+                  [ Plain [ Str "Content" , Space , Str "Cell" ] ]+              , Cell                   ( "" , [] , [] )-                  [ Cell-                      ( "" , [] , [] )-                      AlignDefault-                      (RowSpan 1)-                      (ColSpan 1)-                      [ Plain [ Str "Content" , Space , Str "Cell" ] ]-                  , Cell-                      ( "" , [] , [] )-                      AlignDefault-                      (RowSpan 1)-                      (ColSpan 1)-                      [ Plain [ Str "Content" , Space , Str "Cell" ] ]-                  ]+                  AlignDefault+                  (RowSpan 1)+                  (ColSpan 1)+                  [ Plain [ Str "Content" , Space , Str "Cell" ] ]               ]+          , Row+              ( "" , [] , [] )+              [ Cell+                  ( "" , [] , [] )+                  AlignDefault+                  (RowSpan 1)+                  (ColSpan 1)+                  [ Plain [ Str "Content" , Space , Str "Cell" ] ]+              , Cell+                  ( "" , [] , [] )+                  AlignDefault+                  (RowSpan 1)+                  (ColSpan 1)+                  [ Plain [ Str "Content" , Space , Str "Cell" ] ]+              ]           ]-          (TableFoot ( "" , [] , [] ) [])       ]+      (TableFoot ( "" , [] , [] ) [])   , Para       [ Str "Table"       , Space
test/demo.inc view
@@ -601,80 +601,77 @@       1       ( "sec:chapter-3.-tables" , [] , [] )       [ Str "Chapter" , Space , Str "3." , Space , Str "Tables" ]-  , Div+  , Table       ( "tbl:table1" , [] , [] )-      [ Table-          ( "" , [] , [] )-          (Caption-             Nothing-             [ Plain-                 [ Emph [ Str "Table" , Space , Str "1" ]-                 , Str ":"-                 , Space-                 , Str "Table"-                 , Space-                 , Str "example"-                 ]-             ])-          [ ( AlignLeft , ColWidthDefault )-          , ( AlignLeft , ColWidthDefault )-          ]-          (TableHead+      (Caption+         Nothing+         [ Plain+             [ Emph [ Str "Table" , Space , Str "1" ]+             , Str ":"+             , Space+             , Str "Table"+             , Space+             , Str "example"+             ]+         ])+      [ ( AlignLeft , ColWidthDefault )+      , ( AlignLeft , ColWidthDefault )+      ]+      (TableHead+         ( "" , [] , [] )+         [ Row              ( "" , [] , [] )-             [ Row+             [ Cell                  ( "" , [] , [] )-                 [ Cell-                     ( "" , [] , [] )-                     AlignDefault-                     (RowSpan 1)-                     (ColSpan 1)-                     [ Plain [ Str "First" , Space , Str "Header" ] ]-                 , Cell-                     ( "" , [] , [] )-                     AlignDefault-                     (RowSpan 1)-                     (ColSpan 1)-                     [ Plain [ Str "Second" , Space , Str "Header" ] ]-                 ]-             ])-          [ TableBody+                 AlignDefault+                 (RowSpan 1)+                 (ColSpan 1)+                 [ Plain [ Str "First" , Space , Str "Header" ] ]+             , Cell+                 ( "" , [] , [] )+                 AlignDefault+                 (RowSpan 1)+                 (ColSpan 1)+                 [ Plain [ Str "Second" , Space , Str "Header" ] ]+             ]+         ])+      [ TableBody+          ( "" , [] , [] )+          (RowHeadColumns 0)+          []+          [ Row               ( "" , [] , [] )-              (RowHeadColumns 0)-              []-              [ Row+              [ Cell                   ( "" , [] , [] )-                  [ Cell-                      ( "" , [] , [] )-                      AlignDefault-                      (RowSpan 1)-                      (ColSpan 1)-                      [ Plain [ Str "Content" , Space , Str "Cell" ] ]-                  , Cell-                      ( "" , [] , [] )-                      AlignDefault-                      (RowSpan 1)-                      (ColSpan 1)-                      [ Plain [ Str "Content" , Space , Str "Cell" ] ]-                  ]-              , Row+                  AlignDefault+                  (RowSpan 1)+                  (ColSpan 1)+                  [ Plain [ Str "Content" , Space , Str "Cell" ] ]+              , Cell                   ( "" , [] , [] )-                  [ Cell-                      ( "" , [] , [] )-                      AlignDefault-                      (RowSpan 1)-                      (ColSpan 1)-                      [ Plain [ Str "Content" , Space , Str "Cell" ] ]-                  , Cell-                      ( "" , [] , [] )-                      AlignDefault-                      (RowSpan 1)-                      (ColSpan 1)-                      [ Plain [ Str "Content" , Space , Str "Cell" ] ]-                  ]+                  AlignDefault+                  (RowSpan 1)+                  (ColSpan 1)+                  [ Plain [ Str "Content" , Space , Str "Cell" ] ]               ]+          , Row+              ( "" , [] , [] )+              [ Cell+                  ( "" , [] , [] )+                  AlignDefault+                  (RowSpan 1)+                  (ColSpan 1)+                  [ Plain [ Str "Content" , Space , Str "Cell" ] ]+              , Cell+                  ( "" , [] , [] )+                  AlignDefault+                  (RowSpan 1)+                  (ColSpan 1)+                  [ Plain [ Str "Content" , Space , Str "Cell" ] ]+              ]           ]-          (TableFoot ( "" , [] , [] ) [])       ]+      (TableFoot ( "" , [] , [] ) [])   , Para       [ Str "Table"       , Space
+ test/m2m/divTable/expect.md view
@@ -0,0 +1,47 @@+On a table in a crossref div, attributes remain untouched. It's a+backwards compatibility thing.++::: {#tbl:table1}+  foo   bar+  ----- -----+  1     10+  2     20+  3     30++  : Table 1: table {.foo bar="baz"}+:::++However, if a table in a crossref div has id set, then its id takes+precedence in LaTeX.++::: {#tbl:table_with_id}+  foo   bar+  ----- -----+  1     10+  2     20+  3     30++  : Table 2: table {#quux}+:::++Even if attributes are empty++::: {#tbl:table2}+  foo   bar+  ----- -----+  1     10+  2     20+  3     30++  : Table 3: table (no attributes)+:::++But tables without a div don't get wrapped since Pandoc 3.8.2:++  foo   bar+  ----- -----+  1     10+  2     20+  3     30++  : Table 4: table (crossref id) {#tbl:table3}
+ test/m2m/divTable/expect.tex view
@@ -0,0 +1,77 @@+On a table in a crossref div, attributes remain untouched. It's a+backwards compatibility thing.++\begin{longtable}[]{@{}ll@{}}+\caption{\label{tbl:table1}table}\tabularnewline+\toprule\noalign{}+foo & bar \\+\midrule\noalign{}+\endfirsthead+\toprule\noalign{}+foo & bar \\+\midrule\noalign{}+\endhead+\bottomrule\noalign{}+\endlastfoot+1 & 10 \\+2 & 20 \\+3 & 30 \\+\end{longtable}++However, if a table in a crossref div has id set, then its id takes+precedence in LaTeX.++\begin{longtable}[]{@{}ll@{}}+\caption{table}\label{quux}\tabularnewline+\toprule\noalign{}+foo & bar \\+\midrule\noalign{}+\endfirsthead+\toprule\noalign{}+foo & bar \\+\midrule\noalign{}+\endhead+\bottomrule\noalign{}+\endlastfoot+1 & 10 \\+2 & 20 \\+3 & 30 \\+\end{longtable}++Even if attributes are empty++\begin{longtable}[]{@{}ll@{}}+\caption{\label{tbl:table2}table (no attributes)}\tabularnewline+\toprule\noalign{}+foo & bar \\+\midrule\noalign{}+\endfirsthead+\toprule\noalign{}+foo & bar \\+\midrule\noalign{}+\endhead+\bottomrule\noalign{}+\endlastfoot+1 & 10 \\+2 & 20 \\+3 & 30 \\+\end{longtable}++But tables without a div don't get wrapped since Pandoc 3.8.2:++\begin{longtable}[]{@{}ll@{}}+\caption{table (crossref id)}\label{tbl:table3}\tabularnewline+\toprule\noalign{}+foo & bar \\+\midrule\noalign{}+\endfirsthead+\toprule\noalign{}+foo & bar \\+\midrule\noalign{}+\endhead+\bottomrule\noalign{}+\endlastfoot+1 & 10 \\+2 & 20 \\+3 & 30 \\+\end{longtable}
+ test/m2m/divTable/input.md view
@@ -0,0 +1,45 @@+On a table in a crossref div, attributes remain untouched. It's a backwards compatibility thing.++:::{#tbl:table1}+foo   bar+----- -----+1     10+2     20+3     30++: table {.foo bar="baz"}+:::++However, if a table in a crossref div has id set, then its id takes precedence in LaTeX.++:::{#tbl:table_with_id}+foo   bar+----- -----+1     10+2     20+3     30++: table {#quux}+:::++Even if attributes are empty++:::{#tbl:table2}+foo   bar+----- -----+1     10+2     20+3     30++: table (no attributes)+:::++But tables without a div don't get wrapped since Pandoc 3.8.2:++foo   bar+----- -----+1     10+2     20+3     30++: table (crossref id) {#tbl:table3}
test/m2m/listOfHidden/expect.md view
@@ -14,58 +14,26 @@  # S hidden supplemental section {#hidden-supplemental-section label="S"} -:::: {#fig:fig_s1 .figure}-![Figure S.1: hidden! first supp figure](figs/fig_s1.jpg){hidden="y"}--::: {.caption short-caption=""}-Figure S.1: hidden! first supp figure-:::-::::--:::: {#fig:fig_s2 .figure}-![Figure S.2: hidden! second supp figure](figs/fig_s2.jpg){hidden="y"}+![Figure S.1: hidden! first supp figure](figs/fig_s1.jpg){#fig:fig_s1+hidden="y"} -::: {.caption short-caption=""}-Figure S.2: hidden! second supp figure-:::-::::+![Figure S.2: hidden! second supp figure](figs/fig_s2.jpg){#fig:fig_s2+hidden="y"}  # 2 hidden section {#hidden-section hidden="y"} -:::: {#fig:fig_h1 .figure}-![Figure 2.1: hidden! first hidden figure](figs/fig_s1.jpg)--::: {.caption short-caption=""}-Figure 2.1: hidden! first hidden figure-:::-::::--:::: {#fig:fig_h2 .figure}-![Figure 2.2: hidden! second hidden figure](figs/fig_s2.jpg)+![Figure 2.1: hidden! first hidden figure](figs/fig_s1.jpg){#fig:fig_h1} -::: {.caption short-caption=""}-Figure 2.2: hidden! second hidden figure-:::-::::+![Figure 2.2: hidden! second hidden+figure](figs/fig_s2.jpg){#fig:fig_h2}  ## 2.1 subsection of a hidden section -:::: {#fig:fig_h1_s .figure}-![Figure 2.1.1: hidden! first hidden subsection figure](figs/fig_s1.jpg)--::: {.caption short-caption=""}-Figure 2.1.1: hidden! first hidden subsection figure-:::-::::+![Figure 2.1.1: hidden! first hidden subsection+figure](figs/fig_s1.jpg){#fig:fig_h1_s} -:::: {#fig:fig_h2_s .figure} ![Figure 2.1.2: hidden! second hidden subsection-figure](figs/fig_s2.jpg)--::: {.caption short-caption=""}-Figure 2.1.2: hidden! second hidden subsection figure-:::-::::+figure](figs/fig_s2.jpg){#fig:fig_h2_s}  # 3 regular section @@ -85,22 +53,11 @@  ## 3.2 hidden subsection {#hidden-subsection hidden="y"} -:::: {#fig:fig_ss1 .figure}-![Figure 3.2.1: hidden! first hidden subsection figure](figs/fig_s1.jpg)--::: {.caption short-caption=""}-Figure 3.2.1: hidden! first hidden subsection figure-:::-::::+![Figure 3.2.1: hidden! first hidden subsection+figure](figs/fig_s1.jpg){#fig:fig_ss1} -:::: {#fig:fig_ss2 .figure} ![Figure 3.2.2: hidden! second hidden subsection-figure](figs/fig_s2.jpg)--::: {.caption short-caption=""}-Figure 3.2.2: hidden! second hidden subsection figure-:::-::::+figure](figs/fig_s2.jpg){#fig:fig_ss2}  ![Figure 3.2.3: visible! overridden visibility](figs/fig_s3.jpg){#fig:fig_ss3 hidden="n"}@@ -131,15 +88,13 @@ ``` ::: -::: {#tbl:table1}   foo   bar   ----- -----   1     10   2     20   3     30 -  : Table 3.2.1: hidden! table-:::+  : Table 3.2.1: hidden! table {#tbl:table1}  ::: {#tbl:table2 hidden="n"}   foo   bar
test/m2m/listOfHidden/expect.tex view
@@ -153,7 +153,7 @@ \end{codelisting}  \begin{longtable}[]{@{}ll@{}}-\caption[]{\label{tbl:table1}hidden! table}\tabularnewline+\caption[]{hidden! table}\label{tbl:table1}\tabularnewline \toprule\noalign{} foo & bar \\ \midrule\noalign{}
test/m2m/listOfLinked/expect.md view
@@ -54,22 +54,18 @@  ------------------------------------------------------------------------ -::: {#tbl:mytable}   a   b   c   --- --- ---   1   2   3   4   5   6 -  : Table 1: My table-:::+  : Table 1: My table {#tbl:mytable} -::: {#tbl:1}   a   b   --- ---   1   2 -  : Table 2: Table-:::+  : Table 2: Table {#tbl:1}  # List of Figures 
test/m2m/listOfLinked/expect.tex view
@@ -107,7 +107,7 @@ \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}  \begin{longtable}[]{@{}lll@{}}-\caption{\label{tbl:mytable}My table}\tabularnewline+\caption{My table}\label{tbl:mytable}\tabularnewline \toprule\noalign{} a & b & c \\ \midrule\noalign{}@@ -123,7 +123,7 @@ \end{longtable}  \begin{longtable}[]{@{}ll@{}}-\caption{\label{tbl:1}Table}\tabularnewline+\caption{Table}\label{tbl:1}\tabularnewline \toprule\noalign{} a & b \\ \midrule\noalign{}
test/m2m/listOfTemplates/expect.md view
@@ -54,22 +54,18 @@  ------------------------------------------------------------------------ -::: {#tbl:mytable}   a   b   c   --- --- ---   1   2   3   4   5   6 -  : Table 1: My table-:::+  : Table 1: My table {#tbl:mytable} -::: {#tbl:1}   a   b   --- ---   1   2 -  : Table 2: Table-:::+  : Table 2: Table {#tbl:1}  # List of Figures 
test/m2m/listOfTemplates/expect.tex view
@@ -107,7 +107,7 @@ \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}  \begin{longtable}[]{@{}lll@{}}-\caption{\label{tbl:mytable}My table}\tabularnewline+\caption{My table}\label{tbl:mytable}\tabularnewline \toprule\noalign{} a & b & c \\ \midrule\noalign{}@@ -123,7 +123,7 @@ \end{longtable}  \begin{longtable}[]{@{}ll@{}}-\caption{\label{tbl:1}Table}\tabularnewline+\caption{Table}\label{tbl:1}\tabularnewline \toprule\noalign{} a & b \\ \midrule\noalign{}
test/m2m/loxItemTitle/expect.md view
@@ -54,22 +54,18 @@  ------------------------------------------------------------------------ -::: {#tbl:mytable}   a   b   c   --- --- ---   1   2   3   4   5   6 -  : Table 1: My table-:::+  : Table 1: My table {#tbl:mytable} -::: {#tbl:1}   a   b   --- ---   1   2 -  : Table 2: Table-:::+  : Table 2: Table {#tbl:1}  # List of Figures 
test/m2m/loxItemTitle/expect.tex view
@@ -107,7 +107,7 @@ \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}  \begin{longtable}[]{@{}lll@{}}-\caption{\label{tbl:mytable}My table}\tabularnewline+\caption{My table}\label{tbl:mytable}\tabularnewline \toprule\noalign{} a & b & c \\ \midrule\noalign{}@@ -123,7 +123,7 @@ \end{longtable}  \begin{longtable}[]{@{}ll@{}}-\caption{\label{tbl:1}Table}\tabularnewline+\caption{Table}\label{tbl:1}\tabularnewline \toprule\noalign{} a & b \\ \midrule\noalign{}
test/m2m/refsInListOf/expect.md view
@@ -14,14 +14,12 @@ figure caption, e.g. (fig. 1, tbl. 1) or (fig. 2, tbl. 1), although if you cite the thing alone it'll work just fine (tbl. 1) -::: {#tbl:tbl1}   col1   col2   ------ ------   row1   row1   row2   ro2 -  : Table 1: Table 1-:::+  : Table 1: Table 1 {#tbl:tbl1}  # List of Figures 
test/m2m/refsInListOf/expect.tex view
@@ -24,7 +24,7 @@ just fine (tbl.~\ref{tbl:tbl1})  \begin{longtable}[]{@{}ll@{}}-\caption{\label{tbl:tbl1}Table 1}\tabularnewline+\caption{Table 1}\label{tbl:tbl1}\tabularnewline \toprule\noalign{} col1 & col2 \\ \midrule\noalign{}
test/m2m/refsInObjects/expect.md view
@@ -2,13 +2,11 @@  ![Figure 1: fig. 1](foo.png){#fig:fig} -::: {#tbl:table}   -- -- --            -- -- -- -  : Table 1: tbl. 1 fig. 2 fig. 2 (a) fig. 2 (b) lst. 1-:::+  : Table 1: tbl. 1 fig. 2 fig. 2 (a) fig. 2 (b) lst. 1 {#tbl:table}  ::: {#lst:lst .listing .cpp} Listing 1: Listing tbl. 1 fig. 2 fig. 2 (a) fig. 2 (b) lst. 1
test/m2m/refsInObjects/expect.tex view
@@ -7,9 +7,9 @@ \end{figure}  \begin{longtable}[]{@{}lll@{}}-\caption{\label{tbl:table}tbl.~\ref{tbl:table} fig.~\ref{fig:subfigures}+\caption{tbl.~\ref{tbl:table} fig.~\ref{fig:subfigures} fig.~\ref{fig:subfig1} fig.~\ref{fig:subfig2}-lst.~\ref{lst:lst}}\tabularnewline+lst.~\ref{lst:lst}}\label{tbl:table}\tabularnewline \toprule\noalign{} \endfirsthead \endhead
test/m2m/secLabels/expect.md view
@@ -6,11 +6,9 @@  ## a.b Other Second Level Section {#other-second-level-section} -::: {#tbl:mytable}   a   b   c   --- --- ---   1   2   3   4   5   6 -  : Table I: My table-:::+  : Table I: My table {#tbl:mytable}
test/m2m/secLabels/expect.tex view
@@ -12,7 +12,7 @@ Section}\label{other-second-level-section}  \begin{longtable}[]{@{}lll@{}}-\caption{\label{tbl:mytable}My table}\tabularnewline+\caption{My table}\label{tbl:mytable}\tabularnewline \toprule\noalign{} a & b & c \\ \midrule\noalign{}
test/m2m/setLabelAttribute/expect.md view
@@ -10,13 +10,11 @@  [$$equation\qquad{(1.1)}$$]{#eq:1 label="(1.1)"} -::: {#tbl:1 label="1.1"}   a   b   --- ---   1   2 -  : Table 1.1: Table-:::+  : Table 1.1: Table {#tbl:1 label="1.1"}  ::: {#lst:1 .listing} Listing 1.1: Code Listing
test/m2m/setLabelAttribute/expect.tex view
@@ -9,7 +9,7 @@ \begin{equation}\protect\phantomsection\label{eq:1}{equation}\end{equation}  \begin{longtable}[]{@{}ll@{}}-\caption{\label{tbl:1}Table}\tabularnewline+\caption{Table}\label{tbl:1}\tabularnewline \toprule\noalign{} a & b \\ \midrule\noalign{}
test/m2m/standalone-listOfMetadata/expect.md view
@@ -185,22 +185,18 @@  ------------------------------------------------------------------------ -::: {#tbl:mytable}   a   b   c   --- --- ---   1   2   3   4   5   6 -  : Table 1: My table-:::+  : Table 1: My table {#tbl:mytable} -::: {#tbl:1}   a   b   --- ---   1   2 -  : Table 2: Table-:::+  : Table 2: Table {#tbl:1}  # List of Figures 
test/m2m/standalone-listOfMetadata/expect.tex view
@@ -107,7 +107,7 @@ \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}  \begin{longtable}[]{@{}lll@{}}-\caption{\label{tbl:mytable}My table}\tabularnewline+\caption{My table}\label{tbl:mytable}\tabularnewline \toprule\noalign{} a & b & c \\ \midrule\noalign{}@@ -123,7 +123,7 @@ \end{longtable}  \begin{longtable}[]{@{}ll@{}}-\caption{\label{tbl:1}Table}\tabularnewline+\caption{Table}\label{tbl:1}\tabularnewline \toprule\noalign{} a & b \\ \midrule\noalign{}
test/test-integrative.hs view
@@ -2,6 +2,7 @@ pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them. Copyright (C) 2015  Nikolay Yakimov <root@livid.pp.ru>+Copyright (C) 2025  Gesh <gesh@gesh.uni.cx>  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
test/test-pandoc-crossref.hs view
@@ -192,7 +192,7 @@           PfxEqn =: M.fromList $ refRec'' "eq:equation" 1)       it "Labels tables" $         testAll (table' "Test table" "table")-        (divWith ("tbl:table", [], []) $ table' "Table 1: Test table" "",+        (table'' ("tbl:table", [], []) "Table 1: Test table" "",           PfxTbl =: M.fromList $ refRec' "tbl:table" 1 "Test table")       it "Labels code blocks" $         testAll (codeBlock' "Test code block" "codeblock")@@ -338,7 +338,7 @@             <> para (citeGen "tbl:some_table" [1])             `test` concat (               [ "\\begin{longtable}[]{@{}l@{}}\n"-              , "\\caption{\\label{tbl:some_table1}A table}\\tabularnewline\n"+              , "\\caption{A table}\\label{tbl:some_table1}\\tabularnewline\n"               , "\\toprule\\noalign{}\n"               , "\\endfirsthead\n"               , "\\endhead\n"@@ -449,7 +449,13 @@ equation' eq ref = displayMath eq <> ref' "eq" ref  table' :: T.Text -> T.Text -> Blocks-table' title ref = table (simpleCaption . plain $ text title <> ref' "tbl" ref) []+table' title ref = tableWith ("tbl:" <> ref, [], []) (simpleCaption . plain $ text title) []+   (TableHead nullAttr [Row nullAttr $ map (Cell nullAttr AlignDefault (RowSpan 0) (ColSpan 0) . toList) [para $ str "H1", para $ str "H2"]])+  [TableBody nullAttr (RowHeadColumns 0) [] [Row nullAttr $ map (Cell nullAttr AlignDefault (RowSpan 0) (ColSpan 0) . toList) [para $ str "C1", para $ str "C2"]]]+  (TableFoot nullAttr [])++table'' :: Attr -> T.Text -> T.Text -> Blocks+table'' attr title ref = tableWith attr (simpleCaption . plain $ text title <> ref' "tbl" ref) []    (TableHead nullAttr [Row nullAttr $ map (Cell nullAttr AlignDefault (RowSpan 0) (ColSpan 0) . toList) [para $ str "H1", para $ str "H2"]])   [TableBody nullAttr (RowHeadColumns 0) [] [Row nullAttr $ map (Cell nullAttr AlignDefault (RowSpan 0) (ColSpan 0) . toList) [para $ str "C1", para $ str "C2"]]]   (TableFoot nullAttr [])