diff options
-rw-r--r-- | changelog.md | 7 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 9 | ||||
-rw-r--r-- | test/command/6137.md | 51 |
3 files changed, 34 insertions, 33 deletions
diff --git a/changelog.md b/changelog.md index 52ff41dd0..dd20afa5b 100644 --- a/changelog.md +++ b/changelog.md @@ -89,13 +89,6 @@ for the part after the initial capital. Ensure that both arguments are parsed, so that in Markdown both are treated as raw LateX. (Closes #6258.) - + Don't put surrounding Div around Table. - This reverts a change in the last release; the Div is - no longer needed, because we can now put the id right in - the Table's attributes. However, writers may still need - to be modified to do something with the id in a Table - (e.g. create an anchor), so in the short term we may lose - the ability to link to tables in some writers. * Org reader (Albert Krewinkel): diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 05abfe6fb..c47c88965 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -2433,9 +2433,16 @@ addTableCaption = walkM go ((_,classes,kvs), Just ident) -> (ident,classes,kvs) _ -> attr - return $ Table attr' capt spec th tb tf + return $ addAttrDiv attr' $ Table nullAttr capt spec th tb tf go x = return x +-- TODO: For now we add a Div to contain table attributes, since +-- most writers don't do anything yet with attributes on Table. +-- This can be removed when that changes. +addAttrDiv :: Attr -> Block -> Block +addAttrDiv ("",[],[]) b = b +addAttrDiv attr b = Div attr [b] + block :: PandocMonad m => LP m Blocks block = do res <- (mempty <$ spaces1) diff --git a/test/command/6137.md b/test/command/6137.md index e95f4242d..9081f775f 100644 --- a/test/command/6137.md +++ b/test/command/6137.md @@ -16,31 +16,32 @@ This reference to Figure \ref{fig:label} works fine. \end{figure} ^D [Para [Str "This",Space,Str "reference",Space,Str "to",Space,Str "Table",Space,Link ("",[],[("reference-type","ref"),("reference","tbl:label")]) [Str "1"] ("#tbl:label",""),Space,Str "doesn\8217t",Space,Str "work."] -,Table ("tbl:label",[],[]) (Caption Nothing - [Plain [Str "This",Space,Str "caption",Space,Str "has",Space,Str "no",Space,Str "number."]]) - [(AlignLeft,ColWidthDefault) - ,(AlignCenter,ColWidthDefault) - ,(AlignRight,ColWidthDefault)] - (TableHead ("",[],[]) - []) - [(TableBody ("",[],[]) (RowHeadColumns 0) - [] - [Row ("",[],[]) - [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) - [Plain [Str "\8212\8212\8211"]] - ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) - [Plain [Str "\8212\8212\8211"]] - ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) - [Plain [Str "\8212\8212\8211"]]] - ,Row ("",[],[]) - [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) - [Plain [Str "\8212\8212\8211"]] - ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) - [Plain [Str "\8212\8212\8211"]] - ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) - [Plain [Str "\8212\8212\8211"]]]])] - (TableFoot ("",[],[]) - []) +,Div ("tbl:label",[],[]) + [Table ("",[],[]) (Caption Nothing + [Plain [Str "This",Space,Str "caption",Space,Str "has",Space,Str "no",Space,Str "number."]]) + [(AlignLeft,ColWidthDefault) + ,(AlignCenter,ColWidthDefault) + ,(AlignRight,ColWidthDefault)] + (TableHead ("",[],[]) + []) + [(TableBody ("",[],[]) (RowHeadColumns 0) + [] + [Row ("",[],[]) + [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) + [Plain [Str "\8212\8212\8211"]] + ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) + [Plain [Str "\8212\8212\8211"]] + ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) + [Plain [Str "\8212\8212\8211"]]] + ,Row ("",[],[]) + [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) + [Plain [Str "\8212\8212\8211"]] + ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) + [Plain [Str "\8212\8212\8211"]] + ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) + [Plain [Str "\8212\8212\8211"]]]])] + (TableFoot ("",[],[]) + [])] ,Para [Str "This",Space,Str "reference",Space,Str "to",Space,Str "Figure",Space,Link ("",[],[("reference-type","ref"),("reference","fig:label")]) [Str "1"] ("#fig:label",""),Space,Str "works",Space,Str "fine."] ,Para [Image ("fig:label",[],[("width","\\textwidth")]) [Str "A",Space,Str "numbered",Space,Str "caption,",Space,Str "if",Space,Str "I",Space,Str "use",Space,Str "pandoc-crossref."] ("example.png","fig:")]] ``` |