From fb4cea44b91e5c858c45ca67599ca7925bf159c8 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 8 Dec 2023 13:34:33 -0800 Subject: Docx writer: Use different style for block quotes in notes. Using "Footnote Block Text" for the style name, so it can be given a different font size if footnotes are. Closes #9243. --- src/Text/Pandoc/Writers/Docx.hs | 13 +++++++++---- src/Text/Pandoc/Writers/Docx/Types.hs | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 0178cec17..989518004 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -940,7 +940,11 @@ blockToOpenXML' _ b@(RawBlock format str) report $ BlockNotRendered b return [] blockToOpenXML' opts (BlockQuote blocks) = do - p <- withParaPropM (pStyleM "Block Text") + inNote <- asks envInNote + p <- withParaPropM (pStyleM + (if inNote + then "Footnote Block Text" + else "Block Text")) $ blocksToOpenXML opts blocks setFirstPara return p @@ -1361,9 +1365,10 @@ inlineToOpenXML' opts (Note bs) = do contents <- local (\env -> env{ envListLevel = -1 , envParaProperties = mempty - , envTextProperties = mempty }) - (withParaPropM (pStyleM "Footnote Text") $ blocksToOpenXML opts - $ insertNoteRef bs) + , envTextProperties = mempty + , envInNote = True }) + (withParaPropM (pStyleM "Footnote Text") $ + blocksToOpenXML opts $ insertNoteRef bs) let newnote = mknode "w:footnote" [("w:id", notenum)] contents modify $ \s -> s{ stFootnotes = newnote : notes } return [ Elem $ mknode "w:r" [] diff --git a/src/Text/Pandoc/Writers/Docx/Types.hs b/src/Text/Pandoc/Writers/Docx/Types.hs index 8dc6f08b2..b453745db 100644 --- a/src/Text/Pandoc/Writers/Docx/Types.hs +++ b/src/Text/Pandoc/Writers/Docx/Types.hs @@ -81,6 +81,7 @@ data WriterEnv = WriterEnv , envListLevel :: Int , envListNumId :: Int , envInDel :: Bool + , envInNote :: Bool , envChangesAuthor :: Text , envChangesDate :: Text , envPrintWidth :: Integer @@ -95,6 +96,7 @@ defaultWriterEnv = WriterEnv , envListLevel = -1 , envListNumId = 1 , envInDel = False + , envInNote = False , envChangesAuthor = "unknown" , envChangesDate = "1969-12-31T19:00:00Z" , envPrintWidth = 1 -- cgit v1.2.3