git.iko.soy/typeable/pandoc
on master help sign in
Place caption before table in OpenDocument format. (#5869)

Closes #5681.

commit270ffe6ab548de83287b7647269b0c8a18b9e8bf authorDmitry Pogodin <lunaticare@users.noreply.github.com> dateSun 3 Nov 2019, 18:17 (7 years ago) parent8a2e877
3 files changed+15−13
src/Text/Pandoc/Writers/OpenDocument.hs+5−3 test/command/5474-tables.md+4−4 test/tables.opendocument+6−6
src/Text/Pandoc/Writers/OpenDocument.hs+5−3
@@ -404,9 +404,11 @@ blockToOpenDocument o bs
404404 then return empty
405405 else colHeadsToOpenDocument o (map fst paraHStyles) h
406406 tr <- mapM (tableRowToOpenDocument o (map fst paraStyles)) r
407− return $ inTags True "table:table" [ ("table:name" , name)
408− , ("table:style-name", name)
409− ] (vcat columns $$ th $$ vcat tr) $$ captionDoc
407+ let tableDoc = inTags True "table:table" [
408+ ("table:name" , name)
409+ , ("table:style-name", name)
410+ ] (vcat columns $$ th $$ vcat tr)
411+ return $ captionDoc $$ tableDoc
410412 figure attr caption source title | null caption =
411413 withParagraphStyle o "Figure" [Para [Image attr caption (source,title)]]
412414 | otherwise = do
test/command/5474-tables.md+4−4
@@ -12,6 +12,8 @@
1212
1313: Second Table
1414^D
15+<text:p text:style-name="TableCaption">Table <text:sequence text:ref-name="refTable0" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">1</text:sequence>: First
16+table</text:p>
1517<table:table table:name="Table1" table:style-name="Table1">
1618 <table:table-column table:style-name="Table1.A" />
1719 <table:table-column table:style-name="Table1.B" />
@@ -34,8 +36,8 @@
3436 </table:table-cell>
3537 </table:table-row>
3638</table:table>
37−<text:p text:style-name="TableCaption">Table <text:sequence text:ref-name="refTable0" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">1</text:sequence>: First
38−table</text:p>
39+<text:p text:style-name="TableCaption">Table <text:sequence text:ref-name="refTable1" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">2</text:sequence>: Second
40+Table</text:p>
3941<table:table table:name="Table2" table:style-name="Table2">
4042 <table:table-column table:style-name="Table2.A" />
4143 <table:table-column table:style-name="Table2.B" />
@@ -58,6 +60,4 @@ table</text:p>
5860 </table:table-cell>
5961 </table:table-row>
6062</table:table>
61−<text:p text:style-name="TableCaption">Table <text:sequence text:ref-name="refTable1" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">2</text:sequence>: Second
62−Table</text:p>
6363```
test/tables.opendocument+6−6
@@ -1,4 +1,6 @@
11<text:p text:style-name="Text_20_body">Simple table with caption:</text:p>
2+<text:p text:style-name="TableCaption">Demonstration of simple table
3+syntax.</text:p>
24<table:table table:name="Table1" table:style-name="Table1">
35 <table:table-column table:style-name="Table1.A" />
46 <table:table-column table:style-name="Table1.B" />
@@ -63,8 +65,6 @@
6365 </table:table-cell>
6466 </table:table-row>
6567</table:table>
66−<text:p text:style-name="TableCaption">Demonstration of simple table
67−syntax.</text:p>
6868<text:p text:style-name="First_20_paragraph">Simple table without
6969caption:</text:p>
7070<table:table table:name="Table2" table:style-name="Table2">
@@ -133,6 +133,8 @@ caption:</text:p>
133133</table:table>
134134<text:p text:style-name="First_20_paragraph">Simple table indented two
135135spaces:</text:p>
136+<text:p text:style-name="TableCaption">Demonstration of simple table
137+syntax.</text:p>
136138<table:table table:name="Table3" table:style-name="Table3">
137139 <table:table-column table:style-name="Table3.A" />
138140 <table:table-column table:style-name="Table3.B" />
@@ -197,10 +199,10 @@ spaces:</text:p>
197199 </table:table-cell>
198200 </table:table-row>
199201</table:table>
200−<text:p text:style-name="TableCaption">Demonstration of simple table
201−syntax.</text:p>
202202<text:p text:style-name="First_20_paragraph">Multiline table with
203203caption:</text:p>
204+<text:p text:style-name="TableCaption">Here’s the caption. It may span
205+multiple lines.</text:p>
204206<table:table table:name="Table4" table:style-name="Table4">
205207 <table:table-column table:style-name="Table4.A" />
206208 <table:table-column table:style-name="Table4.B" />
@@ -253,8 +255,6 @@ caption:</text:p>
253255 </table:table-cell>
254256 </table:table-row>
255257</table:table>
256−<text:p text:style-name="TableCaption">Here’s the caption. It may span
257−multiple lines.</text:p>
258258<text:p text:style-name="First_20_paragraph">Multiline table without
259259caption:</text:p>
260260<table:table table:name="Table5" table:style-name="Table5">