@@ -115,10 +115,6 @@ addTextStyle :: PandocMonad m
115115addTextStyle attrs i = modify $ \ s ->
116116 s { stTextStyles = Map. insert attrs i (stTextStyles s) }
117117
118- addTextStyleAttr :: PandocMonad m => TextStyle -> OD m ()
119- addTextStyleAttr t = modify $ \ s ->
120- s { stTextStyleAttr = Set. insert t (stTextStyleAttr s) }
121-
122118increaseIndent :: PandocMonad m => OD m ()
123119increaseIndent = modify $ \ s -> s { stIndentPara = 1 + stIndentPara s }
124120
@@ -150,14 +146,18 @@ inParagraphTagsWithStyle sty = inTags False "text:p" [("text:style-name", sty)]
150146inSpanTags :: Text -> Doc Text -> Doc Text
151147inSpanTags s = inTags False " text:span" [(" text:style-name" ,s)]
152148
153- withTextStyle :: PandocMonad m => TextStyle -> OD m a -> OD m a
154- withTextStyle s f = do
149+ withAlteredTextStyles :: PandocMonad m
150+ => (Set. Set TextStyle -> Set. Set TextStyle ) -> OD m a -> OD m a
151+ withAlteredTextStyles f action = do
155152 oldTextStyleAttr <- gets stTextStyleAttr
156- addTextStyleAttr s
157- res <- f
153+ modify $ \ st -> st{ stTextStyleAttr = f oldTextStyleAttr }
154+ res <- action
158155 modify $ \ st -> st{ stTextStyleAttr = oldTextStyleAttr }
159156 return res
160157
158+ withTextStyle :: PandocMonad m => TextStyle -> OD m a -> OD m a
159+ withTextStyle s = withAlteredTextStyles (Set. insert s)
160+
161161inTextStyle :: PandocMonad m => Doc Text -> OD m (Doc Text )
162162inTextStyle d = do
163163 at <- gets stTextStyleAttr
@@ -691,7 +691,8 @@ inlineToOpenDocument o ils
691691 , (" text:note-class" , " footnote" )] $
692692 inTagsSimple " text:note-citation" (text . show $ n + 1 ) <>
693693 inTagsSimple " text:note-body" t
694- nn <- footNote <$> withParagraphStyle o " Footnote" l
694+ nn <- footNote <$> withAlteredTextStyles (const mempty )
695+ (withParagraphStyle o " Footnote" l)
695696 addNote nn
696697 return nn
697698
0 commit comments