aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-06-08 14:17:52 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-06-08 14:17:52 -0700
commit05ae9f265f19a6ae4cbba77c5466c7f7eff4cde8 (patch)
tree0817519322ee4f19083467da06cbec12a8c41224 /src/Text/Pandoc
parentd1df2b2783a6fdbe0315cf69d2306271254960f3 (diff)
downloadpandoc-05ae9f265f19a6ae4cbba77c5466c7f7eff4cde8.tar.gz
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index e2c8abd2e..f00ae12bf 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -393,7 +393,10 @@ blockToOpenDocument o bs
mapM_ addParaStyle . newPara $ paraHStyles ++ paraStyles
captionDoc <- if null c
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
then return empty
else colHeadsToOpenDocument o (map fst paraHStyles) h
@@ -405,7 +408,10 @@ blockToOpenDocument o bs
withParagraphStyle o "Figure" [Para [Image attr caption (source,title)]]
| otherwise = do
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
@@ -434,6 +440,9 @@ numberedCaption style term name num caption =
c = text ": "
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
=> WriterOptions -> [String] -> [[Block]]
-> OD m Doc