summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2023-12-08 13:34:33 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2023-12-08 13:34:33 -0800
commitfb4cea44b91e5c858c45ca67599ca7925bf159c8 (patch)
tree826a134dcdf7e792edfd9a595f90ec8833cbebae /src/Text
parent901359bf460246861418ae1b96aa912920c86d35 (diff)
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.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs13
-rw-r--r--src/Text/Pandoc/Writers/Docx/Types.hs2
2 files changed, 11 insertions, 4 deletions
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