@@ -128,8 +128,8 @@ data WriterState = WriterState{
128128 , stStyleMaps :: StyleMaps
129129 , stFirstPara :: Bool
130130 , stTocTitle :: [Inline]
131− , stDynamicParaProps :: [String]
132− , stDynamicTextProps :: [String]
131+ , stDynamicParaProps :: Set.Set String
132+ , stDynamicTextProps :: Set.Set String
133133 }
134134
135135defaultWriterState :: WriterState
@@ -144,8 +144,8 @@ defaultWriterState = WriterState{
144144 , stStyleMaps = defaultStyleMaps
145145 , stFirstPara = False
146146 , stTocTitle = [Str "Table of Contents"]
147− , stDynamicParaProps = []
148− , stDynamicTextProps = []
147+ , stDynamicParaProps = Set.empty
148+ , stDynamicTextProps = Set.empty
149149 }
150150
151151type WS m = ReaderT WriterEnv (StateT WriterState m)
@@ -443,11 +443,11 @@ writeDocx opts doc@(Pandoc meta _) = do
443443 -- are normalized as lowercase.
444444 let newDynamicParaProps = filter
445445 (\sty -> isNothing $ M.lookup (toLower <$> sty) $ getMap $ sParaStyleMap styleMaps)
446− (stDynamicParaProps st)
446+ (Set.toList $ stDynamicParaProps st)
447447
448448 newDynamicTextProps = filter
449449 (\sty -> isNothing $ M.lookup (toLower <$> sty) $ getMap $ sCharStyleMap styleMaps)
450− (stDynamicTextProps st)
450+ (Set.toList $ stDynamicTextProps st)
451451
452452 let newstyles = map newParaPropToOpenXml newDynamicParaProps ++
453453 map newTextPropToOpenXml newDynamicTextProps ++
@@ -800,7 +800,8 @@ blockToOpenXML' opts (Div (ident,classes,kvs) bs) = do
800800 stylemod <- case lookup dynamicStyleKey kvs of
801801 Just sty -> do
802802 modify $ \s ->
803− s{stDynamicParaProps = sty : (stDynamicParaProps s)}
803+ s{stDynamicParaProps = Set.insert sty
804+ (stDynamicParaProps s)}
804805 return $ withParaPropM (pStyleM sty)
805806 _ -> return id
806807 dirmod <- case lookup "dir" kvs of
@@ -1053,7 +1054,8 @@ inlineToOpenXML' opts (Span (ident,classes,kvs) ils) = do
10531054 stylemod <- case lookup dynamicStyleKey kvs of
10541055 Just sty -> do
10551056 modify $ \s ->
1056− s{stDynamicTextProps = sty : (stDynamicTextProps s)}
1057+ s{stDynamicTextProps = Set.insert sty
1058+ (stDynamicTextProps s)}
10571059 return $ withTextProp (rCustomStyle sty)
10581060 _ -> return id
10591061 let dirmod = case lookup "dir" kvs of