diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2014-08-17 17:03:44 -0400 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2014-08-17 17:03:44 -0400 |
commit | 15ce28b8caa5f3e71d518a231cc87a319a314400 (patch) | |
tree | 83a493da0449c849438f9499e89da6c3ab08d305 /src/Text | |
parent | 03d5d8e596551d7454a35bb272a3439967181776 (diff) | |
download | pandoc-15ce28b8caa5f3e71d518a231cc87a319a314400.tar.gz |
Docx reader: Use style resolver.
We now no longer check against explicit styles.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx.hs | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index 0c2cf064f..5e00e9996 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -256,8 +256,8 @@ resolveDependentRunStyle rPr , rUnderline = case rUnderline rPr of Just ulstyle -> Just ulstyle Nothing -> rUnderline rPr' - , rStyle = Nothing } - | otherwise = rPr{rStyle = Nothing} + , rStyle = rStyle rPr } + | otherwise = rPr runStyleToTransform :: RunStyle -> (Inlines -> Inlines) runStyleToTransform rPr @@ -266,34 +266,20 @@ runStyleToTransform rPr let rPr' = rPr{rStyle = Nothing} in (spanWith ("", [s], [])) . (runStyleToTransform rPr') - | Just (s, _) <- rStyle rPr - , s `elem` emphStyles = - let rPr' = rPr{rStyle = Nothing, isItalic = Nothing} - in - case isItalic rPr of - Just False -> runStyleToTransform rPr' - _ -> emph . (runStyleToTransform rPr') - | Just (s, _) <- rStyle rPr - , s `elem` strongStyles = - let rPr' = rPr{rStyle = Nothing, isBold = Nothing} - in - case isBold rPr of - Just False -> runStyleToTransform rPr' - _ -> strong . (runStyleToTransform rPr') | Just True <- isItalic rPr = emph . (runStyleToTransform rPr {isItalic = Nothing}) | Just True <- isBold rPr = - strong . (runStyleToTransform rPr {isBold = Nothing}) + strong . (runStyleToTransform rPr {isBold = Nothing}) | Just True <- isSmallCaps rPr = - smallcaps . (runStyleToTransform rPr {isSmallCaps = Nothing}) + smallcaps . (runStyleToTransform rPr {isSmallCaps = Nothing}) | Just True <- isStrike rPr = - strikeout . (runStyleToTransform rPr {isStrike = Nothing}) + strikeout . (runStyleToTransform rPr {isStrike = Nothing}) | Just SupScrpt <- rVertAlign rPr = - superscript . (runStyleToTransform rPr {rVertAlign = Nothing}) + superscript . (runStyleToTransform rPr {rVertAlign = Nothing}) | Just SubScrpt <- rVertAlign rPr = - subscript . (runStyleToTransform rPr {rVertAlign = Nothing}) + subscript . (runStyleToTransform rPr {rVertAlign = Nothing}) | Just "single" <- rUnderline rPr = - emph . (runStyleToTransform rPr {rUnderline = Nothing}) + emph . (runStyleToTransform rPr {rUnderline = Nothing}) | otherwise = id runToInlines :: Run -> DocxContext Inlines @@ -303,7 +289,7 @@ runToInlines (Run rs runElems) return $ code $ concatMap runElemToString runElems | otherwise = do let ils = concatReduce (map runElemToInlines runElems) - return $ (runStyleToTransform rs) ils + return $ (runStyleToTransform $ resolveDependentRunStyle rs) ils runToInlines (Footnote bps) = do blksList <- concatReduce <$> (mapM bodyPartToBlocks bps) return $ note blksList |