aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-04-17 13:04:15 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-04-17 13:04:15 -0700
commit8f40b4ba14fce10199a059a281c9bd10c884241d (patch)
treecb3d03b61d80052b5edfa5d526ac964fd53b3937
parent2877ca70ecaf5b6715b38f41165974f89206d18b (diff)
downloadpandoc-8f40b4ba14fce10199a059a281c9bd10c884241d.tar.gz
LaTeX reader: 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.
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs7
-rw-r--r--test/command/6137.md51
2 files changed, 30 insertions, 28 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index cdd2c1362..b6bc039df 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -2417,8 +2417,11 @@ addTableCaption = walkM go
(sLabels st) }
return $ caption Nothing (plain ils) -- add number??
(Nothing, _) -> return c
- return $ maybe id (\ident -> Div (ident, [], []) . (:[])) mblabel $
- Table attr capt spec th tb tf
+ let attr' = case (attr, mblabel) of
+ ((_,classes,kvs), Just ident) ->
+ (ident,classes,kvs)
+ _ -> attr
+ return $ Table attr' capt spec th tb tf
go x = return x
block :: PandocMonad m => LP m Blocks
diff --git a/test/command/6137.md b/test/command/6137.md
index 9081f775f..e95f4242d 100644
--- a/test/command/6137.md
+++ b/test/command/6137.md
@@ -16,32 +16,31 @@ 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."]
-,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 ("",[],[])
- [])]
+,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 ("",[],[])
+ [])
,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:")]]
```