mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-29 01:41:20 +08:00
LaTeX writer: create valid table even when table is empty.
Closes #9350.
This commit is contained in:
@@ -137,12 +137,14 @@ colDescriptors isSimpleTable
|
||||
then replicate (length specs)
|
||||
(1 / fromIntegral (length specs))
|
||||
else map toRelWidth widths
|
||||
in if defaultWidthsOnly && isSimpleTable
|
||||
then hcat $ map (literal . colAlign) aligns
|
||||
else (cr <>) . nest 2 . vcat . map literal $
|
||||
zipWith (toColDescriptor (length specs))
|
||||
aligns
|
||||
relativeWidths
|
||||
in if null aligns
|
||||
then "l" -- #9350, table needs at least one column spec
|
||||
else if defaultWidthsOnly && isSimpleTable
|
||||
then hcat $ map (literal . colAlign) aligns
|
||||
else (cr <>) . nest 2 . vcat . map literal $
|
||||
zipWith (toColDescriptor (length specs))
|
||||
aligns
|
||||
relativeWidths
|
||||
where
|
||||
toColDescriptor :: Int -> Alignment -> Double -> Text
|
||||
toColDescriptor numcols align width =
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
```
|
||||
% pandoc -f html -t latex
|
||||
<table><tbody><tr></tr></tbody></table>
|
||||
^D
|
||||
\begin{longtable}[]{@{}l@{}}
|
||||
\toprule\noalign{}
|
||||
\endhead
|
||||
\bottomrule\noalign{}
|
||||
\endlastfoot
|
||||
\\
|
||||
\end{longtable}
|
||||
```
|
||||
Reference in New Issue
Block a user