@@ -128,8 +128,8 @@ data WriterState = WriterState{
128 , stStyleMaps :: StyleMaps
128 , stStyleMaps :: StyleMaps
129 , stFirstPara :: Bool
129 , stFirstPara :: Bool
130 , stTocTitle :: [Inline]
130 , stTocTitle :: [Inline]
131− , stDynamicParaProps :: [String]
131+ , stDynamicParaProps :: Set.Set String
132− , stDynamicTextProps :: [String]
132+ , stDynamicTextProps :: Set.Set String
135defaultWriterState :: WriterState
135defaultWriterState :: WriterState
@@ -144,8 +144,8 @@ defaultWriterState = WriterState{
144 , stStyleMaps = defaultStyleMaps
144 , stStyleMaps = defaultStyleMaps
145 , stFirstPara = False
145 , stFirstPara = False
146 , stTocTitle = [Str "Table of Contents"]
146 , stTocTitle = [Str "Table of Contents"]
147− , stDynamicParaProps = []
147+ , stDynamicParaProps = Set.empty
148− , stDynamicTextProps = []
148+ , stDynamicTextProps = Set.empty
151type WS m = ReaderT WriterEnv (StateT WriterState m)
151type WS m = ReaderT WriterEnv (StateT WriterState m)
@@ -443,11 +443,11 @@ writeDocx opts doc@(Pandoc meta _) = do
443 -- are normalized as lowercase.
443 -- are normalized as lowercase.
444 let newDynamicParaProps = filter
444 let newDynamicParaProps = filter
445 (\sty -> isNothing $ M.lookup (toLower <$> sty) $ getMap $ sParaStyleMap styleMaps)
445 (\sty -> isNothing $ M.lookup (toLower <$> sty) $ getMap $ sParaStyleMap styleMaps)
446− (stDynamicParaProps st)
446+ (Set.toList $ stDynamicParaProps st)
448 newDynamicTextProps = filter
448 newDynamicTextProps = filter
449 (\sty -> isNothing $ M.lookup (toLower <$> sty) $ getMap $ sCharStyleMap styleMaps)
449 (\sty -> isNothing $ M.lookup (toLower <$> sty) $ getMap $ sCharStyleMap styleMaps)
450− (stDynamicTextProps st)
450+ (Set.toList $ stDynamicTextProps st)
452 let newstyles = map newParaPropToOpenXml newDynamicParaProps ++
452 let newstyles = map newParaPropToOpenXml newDynamicParaProps ++
453 map newTextPropToOpenXml newDynamicTextProps ++
453 map newTextPropToOpenXml newDynamicTextProps ++
@@ -800,7 +800,8 @@ blockToOpenXML' opts (Div (ident,classes,kvs) bs) = do
800 stylemod <- case lookup dynamicStyleKey kvs of
800 stylemod <- case lookup dynamicStyleKey kvs of
801 Just sty -> do
801 Just sty -> do
802 modify $ \s ->
802 modify $ \s ->
803+ s{stDynamicParaProps = Set.insert sty
803− s{stDynamicParaProps = sty : (stDynamicParaProps s)}
804+ (stDynamicParaProps s)}
804 return $ withParaPropM (pStyleM sty)
805 return $ withParaPropM (pStyleM sty)
805 _ -> return id
806 _ -> return id
806 dirmod <- case lookup "dir" kvs of
807 dirmod <- case lookup "dir" kvs of
@@ -1053,7 +1054,8 @@ inlineToOpenXML' opts (Span (ident,classes,kvs) ils) = do
1053 stylemod <- case lookup dynamicStyleKey kvs of
1054 stylemod <- case lookup dynamicStyleKey kvs of
1054 Just sty -> do
1055 Just sty -> do
1055 modify $ \s ->
1056 modify $ \s ->
1057+ s{stDynamicTextProps = Set.insert sty
1056− s{stDynamicTextProps = sty : (stDynamicTextProps s)}
1058+ (stDynamicTextProps s)}
1057 return $ withTextProp (rCustomStyle sty)
1059 return $ withTextProp (rCustomStyle sty)
1058 _ -> return id
1060 _ -> return id
1059 let dirmod = case lookup "dir" kvs of
1061 let dirmod = case lookup "dir" kvs of