@@ -252,33 +252,36 @@ parPartToString _ = ""
252252blacklistedCharStyles :: [String]
253253blacklistedCharStyles = ["Hyperlink"]
254254
255−resolveDependentRunStyle :: RunStyle -> RunStyle
255+resolveDependentRunStyle :: PandocMonad m => RunStyle -> DocxContext m RunStyle
256256resolveDependentRunStyle rPr
257257 | Just (s, _) <- rStyle rPr, s `elem` blacklistedCharStyles =
258− rPr
259− | Just (_, cs) <- rStyle rPr =
260− let rPr' = resolveDependentRunStyle cs
261− in
262− RunStyle { isBold = case isBold rPr of
263− Just bool -> Just bool
264− Nothing -> isBold rPr'
265− , isItalic = case isItalic rPr of
266− Just bool -> Just bool
267− Nothing -> isItalic rPr'
268− , isSmallCaps = case isSmallCaps rPr of
269− Just bool -> Just bool
270− Nothing -> isSmallCaps rPr'
271− , isStrike = case isStrike rPr of
272− Just bool -> Just bool
273− Nothing -> isStrike rPr'
274− , rVertAlign = case rVertAlign rPr of
275− Just valign -> Just valign
276− Nothing -> rVertAlign rPr'
277− , rUnderline = case rUnderline rPr of
278− Just ulstyle -> Just ulstyle
279− Nothing -> rUnderline rPr'
280− , rStyle = rStyle rPr }
281− | otherwise = rPr
258+ return rPr
259+ | Just (_, cs) <- rStyle rPr = do
260+ opts <- asks docxOptions
261+ if isEnabled Ext_styles opts
262+ then return rPr
263+ else do rPr' <- resolveDependentRunStyle cs
264+ return $
265+ RunStyle { isBold = case isBold rPr of
266+ Just bool -> Just bool
267+ Nothing -> isBold rPr'
268+ , isItalic = case isItalic rPr of
269+ Just bool -> Just bool
270+ Nothing -> isItalic rPr'
271+ , isSmallCaps = case isSmallCaps rPr of
272+ Just bool -> Just bool
273+ Nothing -> isSmallCaps rPr'
274+ , isStrike = case isStrike rPr of
275+ Just bool -> Just bool
276+ Nothing -> isStrike rPr'
277+ , rVertAlign = case rVertAlign rPr of
278+ Just valign -> Just valign
279+ Nothing -> rVertAlign rPr'
280+ , rUnderline = case rUnderline rPr of
281+ Just ulstyle -> Just ulstyle
282+ Nothing -> rUnderline rPr'
283+ , rStyle = rStyle rPr }
284+ | otherwise = return rPr
282285
283286extraRunStyleInfo :: PandocMonad m => RunStyle -> DocxContext m (Inlines -> Inlines)
284287extraRunStyleInfo rPr
@@ -337,18 +340,18 @@ runStyleToTransform rPr
337340runToInlines :: PandocMonad m => Run -> DocxContext m Inlines
338341runToInlines (Run rs runElems)
339342 | Just (s, _) <- rStyle rs
340− , s `elem` codeStyles =
341− let rPr = resolveDependentRunStyle rs
342− codeString = code $ concatMap runElemToString runElems
343− in
344− return $ case rVertAlign rPr of
345− Just SupScrpt -> superscript codeString
346− Just SubScrpt -> subscript codeString
347− _ -> codeString
343+ , s `elem` codeStyles = do
344+ rPr <- resolveDependentRunStyle rs
345+ let codeString = code $ concatMap runElemToString runElems
346+ return $ case rVertAlign rPr of
347+ Just SupScrpt -> superscript codeString
348+ Just SubScrpt -> subscript codeString
349+ _ -> codeString
348350 | otherwise = do
349− let ils = smushInlines (map runElemToInlines runElems)
350− transform <- runStyleToTransform $ resolveDependentRunStyle rs
351− return $ transform ils
351+ rPr <- resolveDependentRunStyle rs
352+ let ils = smushInlines (map runElemToInlines runElems)
353+ transform <- runStyleToTransform rPr
354+ return $ transform ils
352355runToInlines (Footnote bps) = do
353356 blksList <- smushBlocks <$> mapM bodyPartToBlocks bps
354357 return $ note blksList