aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-04-18 10:46:57 -0700
committerJohn MacFarlane <[email protected]>2025-04-18 10:47:47 -0700
commitec08f03782371b036416fbf4eede3002e000fff5 (patch)
tree798268c829fce8754b0dc5003433290ded537b2e /src
parent48f881d74620beddaa6f4c96c2239d179089b059 (diff)
OpenDocument writer: fix character styles in footnotes.
Character styles governing the position of the footnote reference should not be imposed on the footnote text. Closes #10791.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index 85df9c701..80fdb4177 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -115,10 +115,6 @@ addTextStyle :: PandocMonad m
addTextStyle attrs i = modify $ \s ->
s { stTextStyles = Map.insert attrs i (stTextStyles s) }
-addTextStyleAttr :: PandocMonad m => TextStyle -> OD m ()
-addTextStyleAttr t = modify $ \s ->
- s { stTextStyleAttr = Set.insert t (stTextStyleAttr s) }
-
increaseIndent :: PandocMonad m => OD m ()
increaseIndent = modify $ \s -> s { stIndentPara = 1 + stIndentPara s }
@@ -150,14 +146,18 @@ inParagraphTagsWithStyle sty = inTags False "text:p" [("text:style-name", sty)]
inSpanTags :: Text -> Doc Text -> Doc Text
inSpanTags s = inTags False "text:span" [("text:style-name",s)]
-withTextStyle :: PandocMonad m => TextStyle -> OD m a -> OD m a
-withTextStyle s f = do
+withAlteredTextStyles :: PandocMonad m
+ => (Set.Set TextStyle -> Set.Set TextStyle) -> OD m a -> OD m a
+withAlteredTextStyles f action = do
oldTextStyleAttr <- gets stTextStyleAttr
- addTextStyleAttr s
- res <- f
+ modify $ \st -> st{ stTextStyleAttr = f oldTextStyleAttr }
+ res <- action
modify $ \st -> st{ stTextStyleAttr = oldTextStyleAttr }
return res
+withTextStyle :: PandocMonad m => TextStyle -> OD m a -> OD m a
+withTextStyle s = withAlteredTextStyles (Set.insert s)
+
inTextStyle :: PandocMonad m => Doc Text -> OD m (Doc Text)
inTextStyle d = do
at <- gets stTextStyleAttr
@@ -691,7 +691,8 @@ inlineToOpenDocument o ils
, ("text:note-class", "footnote" )] $
inTagsSimple "text:note-citation" (text . show $ n + 1) <>
inTagsSimple "text:note-body" t
- nn <- footNote <$> withParagraphStyle o "Footnote" l
+ nn <- footNote <$> withAlteredTextStyles (const mempty)
+ (withParagraphStyle o "Footnote" l)
addNote nn
return nn