ConTeXt writer: Properly handle tables without captions.

The old output only worked in MkII. This should work in MkIV
as well.

Closes #837.
This commit is contained in:
John MacFarlane 2013-06-28 21:30:27 -07:00
parent 644e3239a9
commit 5cb0f0bbf1
2 changed files with 8 additions and 6 deletions

View file

@ -203,9 +203,11 @@ blockToConTeXt (Table caption aligns widths heads rows) = do
then return empty then return empty
else liftM ($$ "\\HL") $ tableRowToConTeXt heads else liftM ($$ "\\HL") $ tableRowToConTeXt heads
captionText <- inlineListToConTeXt caption captionText <- inlineListToConTeXt caption
let captionText' = if null caption then text "none" else captionText
rows' <- mapM tableRowToConTeXt rows rows' <- mapM tableRowToConTeXt rows
return $ "\\placetable[here]" <> braces captionText' $$ return $ "\\placetable" <> brackets ("here" <> if null caption
then ",none"
else "")
<> braces captionText $$
"\\starttable" <> brackets (text colDescriptors) $$ "\\starttable" <> brackets (text colDescriptors) $$
"\\HL" $$ headers $$ "\\HL" $$ headers $$
vcat rows' $$ "\\HL" $$ "\\stoptable" <> blankline vcat rows' $$ "\\HL" $$ "\\stoptable" <> blankline

View file

@ -29,7 +29,7 @@ Simple table with caption:
Simple table without caption: Simple table without caption:
\placetable[here]{none} \placetable[here,none]{}
\starttable[|r|l|c|l|] \starttable[|r|l|c|l|]
\HL \HL
\NC Right \NC Right
@ -111,7 +111,7 @@ Multiline table with caption:
Multiline table without caption: Multiline table without caption:
\placetable[here]{none} \placetable[here,none]{}
\starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|] \starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|]
\HL \HL
\NC Centered Header \NC Centered Header
@ -135,7 +135,7 @@ Multiline table without caption:
Table without column headers: Table without column headers:
\placetable[here]{none} \placetable[here,none]{}
\starttable[|r|l|c|r|] \starttable[|r|l|c|r|]
\HL \HL
\NC 12 \NC 12
@ -158,7 +158,7 @@ Table without column headers:
Multiline table without column headers: Multiline table without column headers:
\placetable[here]{none} \placetable[here,none]{}
\starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|] \starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|]
\HL \HL
\NC First \NC First