mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
LaTeX reader: put identifier from label on table attributes...
rather than adding an enclosing Div. Closes #11604.
This commit is contained in:
@@ -379,14 +379,6 @@ addTableCaption = walkM go
|
||||
((_,classes,kvs), Just ident) ->
|
||||
(ident,classes,kvs)
|
||||
_ -> attr
|
||||
return $ addAttrDiv attr'
|
||||
$ maybe id removeLabel mblabel
|
||||
$ Table nullAttr capt spec th tb tf
|
||||
return $ maybe id removeLabel mblabel
|
||||
$ Table attr' 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]
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
```
|
||||
% pandoc -f latex -t typst
|
||||
\begin{table}
|
||||
\caption{Caption}\label{tab}
|
||||
\begin{tabular}{cc}
|
||||
a & b \\ c & d
|
||||
\end{tabular}
|
||||
\end{table}
|
||||
^D
|
||||
#figure(
|
||||
align(center)[#table(
|
||||
columns: 2,
|
||||
align: (center,center,),
|
||||
[a], [b],
|
||||
[c], [d],
|
||||
)]
|
||||
, caption: [Caption]
|
||||
, kind: table
|
||||
)
|
||||
<tab>
|
||||
|
||||
```
|
||||
+62
-65
@@ -38,79 +38,76 @@ This reference to Figure \ref{fig:label} works fine.
|
||||
, Space
|
||||
, Str "work."
|
||||
]
|
||||
, Div
|
||||
, Table
|
||||
( "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
|
||||
( "" , [] , [] )
|
||||
(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
|
||||
( "" , [] , [] )
|
||||
(RowHeadColumns 0)
|
||||
[]
|
||||
[ Row
|
||||
[ Cell
|
||||
( "" , [] , [] )
|
||||
[ 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
|
||||
AlignDefault
|
||||
(RowSpan 1)
|
||||
(ColSpan 1)
|
||||
[ Plain [ Str "\8212\8212\8211" ] ]
|
||||
, Cell
|
||||
( "" , [] , [] )
|
||||
[ 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" ] ]
|
||||
]
|
||||
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 ( "" , [] , [] ) [])
|
||||
]
|
||||
(TableFoot ( "" , [] , [] ) [])
|
||||
, Para
|
||||
[ Str "This"
|
||||
, Space
|
||||
|
||||
Reference in New Issue
Block a user