From 05ae9f265f19a6ae4cbba77c5466c7f7eff4cde8 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 8 Jun 2019 14:17:52 -0700 Subject: 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. --- src/Text/Pandoc/Writers/OpenDocument.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc') 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 -- cgit v1.2.3