git.iko.soy/typeable/pandoc
on master help sign in
ConTeXt writer: Properly handle tables without captions.
5cb0f0bJohn MacFarlane
src/Text/Pandoc/Writers/ConTeXt.hs+4−2
@@ -203,9 +203,11 @@ blockToConTeXt (Table caption aligns widths heads rows) = do
203 then return empty
203 then return empty
204 else liftM ($$ "\\HL") $ tableRowToConTeXt heads
204 else liftM ($$ "\\HL") $ tableRowToConTeXt heads
205 captionText <- inlineListToConTeXt caption
205 captionText <- inlineListToConTeXt caption
206− let captionText' = if null caption then text "none" else captionText
207 rows' <- mapM tableRowToConTeXt rows
206 rows' <- mapM tableRowToConTeXt rows
207+ return $ "\\placetable" <> brackets ("here" <> if null caption
208+ then ",none"
209+ else "")
208− return $ "\\placetable[here]" <> braces captionText' $$
210+ <> braces captionText $$
209 "\\starttable" <> brackets (text colDescriptors) $$
211 "\\starttable" <> brackets (text colDescriptors) $$
210 "\\HL" $$ headers $$
212 "\\HL" $$ headers $$
211 vcat rows' $$ "\\HL" $$ "\\stoptable" <> blankline
213 vcat rows' $$ "\\HL" $$ "\\stoptable" <> blankline
tests/tables.context+4−4
@@ -29,7 +29,7 @@ Simple table with caption:
29
29
30Simple table without caption:
30Simple table without caption:
31
31
32−\placetable[here]{none}
32+\placetable[here,none]{}
33\starttable[|r|l|c|l|]
33\starttable[|r|l|c|l|]
34\HL
34\HL
35\NC Right
35\NC Right
@@ -111,7 +111,7 @@ Multiline table with caption:
111
111
112Multiline table without caption:
112Multiline table without caption:
113
113
114−\placetable[here]{none}
114+\placetable[here,none]{}
115\starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|]
115\starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|]
116\HL
116\HL
117\NC Centered Header
117\NC Centered Header
@@ -135,7 +135,7 @@ Multiline table without caption:
135
135
136Table without column headers:
136Table without column headers:
137
137
138−\placetable[here]{none}
138+\placetable[here,none]{}
139\starttable[|r|l|c|r|]
139\starttable[|r|l|c|r|]
140\HL
140\HL
141\NC 12
141\NC 12
@@ -158,7 +158,7 @@ Table without column headers:
158
158
159Multiline table without column headers:
159Multiline table without column headers:
160
160
161−\placetable[here]{none}
161+\placetable[here,none]{}
162\starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|]
162\starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|]
163\HL
163\HL
164\NC First
164\NC First