git.iko.soy/typeable/pandoc
on master help sign in
Roll back automatic figure/table numbering in ODT/OpenDocument.

This was added in pandoc 2.7.2, but it makes it impossible to use pandoc-crossref. So this has been rolled back for now, until we find a good solution to make this behavior optional (or a creative way to let pandoc-crossref and this feature to coexist). See #5474.

commit05ae9f265f19a6ae4cbba77c5466c7f7eff4cde8 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 8 Jun 2019, 14:17 (7 years ago) parentd1df2b2
3 files changed+18−9
src/Text/Pandoc/Writers/OpenDocument.hs+11−2 test/tables.opendocument+6−6 test/writer.opendocument+1−1
src/Text/Pandoc/Writers/OpenDocument.hs+11−2
@@ -393,7 +393,10 @@ blockToOpenDocument o bs
393393 mapM_ addParaStyle . newPara $ paraHStyles ++ paraStyles
394394 captionDoc <- if null c
395395 then return empty
396− else inlinesToOpenDocument o c >>= numberedTableCaption
396+ else inlinesToOpenDocument o c >>=
397+ if True -- temporary: see #5474
398+ then unNumberedCaption "TableCaption"
399+ else numberedTableCaption
397400 th <- if all null h
398401 then return empty
399402 else colHeadsToOpenDocument o (map fst paraHStyles) h
@@ -405,7 +408,10 @@ blockToOpenDocument o bs
405408 withParagraphStyle o "Figure" [Para [Image attr caption (source,title)]]
406409 | otherwise = do
407410 imageDoc <- withParagraphStyle o "FigureWithCaption" [Para [Image attr caption (source,title)]]
408− captionDoc <- inlinesToOpenDocument o caption >>= numberedFigureCaption
411+ captionDoc <- inlinesToOpenDocument o caption >>=
412+ if True -- temporary: see #5474
413+ then unNumberedCaption "FigureCaption"
414+ else numberedFigureCaption
409415 return $ imageDoc $$ captionDoc
410416
411417
@@ -434,6 +440,9 @@ numberedCaption style term name num caption =
434440 c = text ": "
435441 in inParagraphTagsWithStyle style $ hcat [ t, text " ", s, c, caption ]
436442
443+unNumberedCaption :: Monad m => String -> Doc -> OD m Doc
444+unNumberedCaption style caption = return $ inParagraphTagsWithStyle style caption
445+
437446colHeadsToOpenDocument :: PandocMonad m
438447 => WriterOptions -> [String] -> [[Block]]
439448 -> OD m Doc
test/tables.opendocument+6−6
@@ -63,8 +63,8 @@
6363 </table:table-cell>
6464 </table:table-row>
6565</table:table>
66−<text:p text:style-name="Table">Table <text:sequence text:ref-name="refTable0" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">1</text:sequence>: Demonstration
67−of simple table syntax.</text:p>
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">
@@ -197,8 +197,8 @@ spaces:</text:p>
197197 </table:table-cell>
198198 </table:table-row>
199199</table:table>
200−<text:p text:style-name="Table">Table <text:sequence text:ref-name="refTable1" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">2</text:sequence>: Demonstration
201−of simple table syntax.</text:p>
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>
204204<table:table table:name="Table4" table:style-name="Table4">
@@ -253,8 +253,8 @@ caption:</text:p>
253253 </table:table-cell>
254254 </table:table-row>
255255</table:table>
256−<text:p text:style-name="Table">Table <text:sequence text:ref-name="refTable2" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">3</text:sequence>: Here’s
257−the caption. It may span multiple lines.</text:p>
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">
test/writer.opendocument+1−1
@@ -1879,7 +1879,7 @@ link in pointy braces</text:span></text:a>.</text:p>
18791879<text:p text:style-name="First_20_paragraph">From “Voyage dans la Lune” by
18801880Georges Melies (1902):</text:p>
18811881<text:p text:style-name="FigureWithCaption"><draw:frame draw:name="img1"><draw:image xlink:href="lalune.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame></text:p>
1882−<text:p text:style-name="FigureCaption">Figure <text:sequence text:ref-name="refIllustration0" text:name="Illustration" text:formula="ooow:Illustration+1" style:num-format="1">1</text:sequence>: lalune</text:p>
1882+<text:p text:style-name="FigureCaption">lalune</text:p>
18831883<text:p text:style-name="Text_20_body">Here is a movie
18841884<draw:frame draw:name="img2"><draw:image xlink:href="movie.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame>
18851885icon.</text:p>