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.
This commit is contained in:
parent
d1df2b2783
commit
05ae9f265f
3 changed files with 18 additions and 9 deletions
|
@ -393,7 +393,10 @@ blockToOpenDocument o bs
|
||||||
mapM_ addParaStyle . newPara $ paraHStyles ++ paraStyles
|
mapM_ addParaStyle . newPara $ paraHStyles ++ paraStyles
|
||||||
captionDoc <- if null c
|
captionDoc <- if null c
|
||||||
then return empty
|
then return empty
|
||||||
else inlinesToOpenDocument o c >>= numberedTableCaption
|
else inlinesToOpenDocument o c >>=
|
||||||
|
if True -- temporary: see #5474
|
||||||
|
then unNumberedCaption "TableCaption"
|
||||||
|
else numberedTableCaption
|
||||||
th <- if all null h
|
th <- if all null h
|
||||||
then return empty
|
then return empty
|
||||||
else colHeadsToOpenDocument o (map fst paraHStyles) h
|
else colHeadsToOpenDocument o (map fst paraHStyles) h
|
||||||
|
@ -405,7 +408,10 @@ blockToOpenDocument o bs
|
||||||
withParagraphStyle o "Figure" [Para [Image attr caption (source,title)]]
|
withParagraphStyle o "Figure" [Para [Image attr caption (source,title)]]
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
imageDoc <- withParagraphStyle o "FigureWithCaption" [Para [Image attr caption (source,title)]]
|
imageDoc <- withParagraphStyle o "FigureWithCaption" [Para [Image attr caption (source,title)]]
|
||||||
captionDoc <- inlinesToOpenDocument o caption >>= numberedFigureCaption
|
captionDoc <- inlinesToOpenDocument o caption >>=
|
||||||
|
if True -- temporary: see #5474
|
||||||
|
then unNumberedCaption "FigureCaption"
|
||||||
|
else numberedFigureCaption
|
||||||
return $ imageDoc $$ captionDoc
|
return $ imageDoc $$ captionDoc
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,6 +440,9 @@ numberedCaption style term name num caption =
|
||||||
c = text ": "
|
c = text ": "
|
||||||
in inParagraphTagsWithStyle style $ hcat [ t, text " ", s, c, caption ]
|
in inParagraphTagsWithStyle style $ hcat [ t, text " ", s, c, caption ]
|
||||||
|
|
||||||
|
unNumberedCaption :: Monad m => String -> Doc -> OD m Doc
|
||||||
|
unNumberedCaption style caption = return $ inParagraphTagsWithStyle style caption
|
||||||
|
|
||||||
colHeadsToOpenDocument :: PandocMonad m
|
colHeadsToOpenDocument :: PandocMonad m
|
||||||
=> WriterOptions -> [String] -> [[Block]]
|
=> WriterOptions -> [String] -> [[Block]]
|
||||||
-> OD m Doc
|
-> OD m Doc
|
||||||
|
|
|
@ -63,8 +63,8 @@
|
||||||
</table:table-cell>
|
</table:table-cell>
|
||||||
</table:table-row>
|
</table:table-row>
|
||||||
</table:table>
|
</table:table>
|
||||||
<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
|
<text:p text:style-name="TableCaption">Demonstration of simple table
|
||||||
of simple table syntax.</text:p>
|
syntax.</text:p>
|
||||||
<text:p text:style-name="First_20_paragraph">Simple table without
|
<text:p text:style-name="First_20_paragraph">Simple table without
|
||||||
caption:</text:p>
|
caption:</text:p>
|
||||||
<table:table table:name="Table2" table:style-name="Table2">
|
<table:table table:name="Table2" table:style-name="Table2">
|
||||||
|
@ -197,8 +197,8 @@ spaces:</text:p>
|
||||||
</table:table-cell>
|
</table:table-cell>
|
||||||
</table:table-row>
|
</table:table-row>
|
||||||
</table:table>
|
</table:table>
|
||||||
<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
|
<text:p text:style-name="TableCaption">Demonstration of simple table
|
||||||
of simple table syntax.</text:p>
|
syntax.</text:p>
|
||||||
<text:p text:style-name="First_20_paragraph">Multiline table with
|
<text:p text:style-name="First_20_paragraph">Multiline table with
|
||||||
caption:</text:p>
|
caption:</text:p>
|
||||||
<table:table table:name="Table4" table:style-name="Table4">
|
<table:table table:name="Table4" table:style-name="Table4">
|
||||||
|
@ -253,8 +253,8 @@ caption:</text:p>
|
||||||
</table:table-cell>
|
</table:table-cell>
|
||||||
</table:table-row>
|
</table:table-row>
|
||||||
</table:table>
|
</table:table>
|
||||||
<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
|
<text:p text:style-name="TableCaption">Here’s the caption. It may span
|
||||||
the caption. It may span multiple lines.</text:p>
|
multiple lines.</text:p>
|
||||||
<text:p text:style-name="First_20_paragraph">Multiline table without
|
<text:p text:style-name="First_20_paragraph">Multiline table without
|
||||||
caption:</text:p>
|
caption:</text:p>
|
||||||
<table:table table:name="Table5" table:style-name="Table5">
|
<table:table table:name="Table5" table:style-name="Table5">
|
||||||
|
|
|
@ -1879,7 +1879,7 @@ link in pointy braces</text:span></text:a>.</text:p>
|
||||||
<text:p text:style-name="First_20_paragraph">From “Voyage dans la Lune” by
|
<text:p text:style-name="First_20_paragraph">From “Voyage dans la Lune” by
|
||||||
Georges Melies (1902):</text:p>
|
Georges Melies (1902):</text:p>
|
||||||
<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>
|
<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>
|
||||||
<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>
|
<text:p text:style-name="FigureCaption">lalune</text:p>
|
||||||
<text:p text:style-name="Text_20_body">Here is a movie
|
<text:p text:style-name="Text_20_body">Here is a movie
|
||||||
<draw:frame draw:name="img2"><draw:image xlink:href="movie.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame>
|
<draw:frame draw:name="img2"><draw:image xlink:href="movie.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame>
|
||||||
icon.</text:p>
|
icon.</text:p>
|
||||||
|
|
Loading…
Add table
Reference in a new issue