diff --git a/src/Text/Pandoc/Readers/LaTeX/Table.hs b/src/Text/Pandoc/Readers/LaTeX/Table.hs index d439bc1f4..a0a127798 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Table.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Table.hs @@ -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] diff --git a/test/command/11604.md b/test/command/11604.md new file mode 100644 index 000000000..44ab98666 --- /dev/null +++ b/test/command/11604.md @@ -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 + ) + + +``` diff --git a/test/command/6137.md b/test/command/6137.md index 077044e07..f89fae0ee 100644 --- a/test/command/6137.md +++ b/test/command/6137.md @@ -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