aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Docx.hs12
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse.hs11
2 files changed, 19 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs
index c74380cb8..4f44d18e7 100644
--- a/src/Text/Pandoc/Readers/Docx.hs
+++ b/src/Text/Pandoc/Readers/Docx.hs
@@ -252,13 +252,17 @@ resolveDependentRunStyle rPr
, isStrike = case isStrike rPr of
Just bool -> Just bool
Nothing -> isStrike rPr'
+ , isRTL = case isRTL rPr of
+ Just bool -> Just bool
+ Nothing -> isRTL rPr'
, rVertAlign = case rVertAlign rPr of
Just valign -> Just valign
Nothing -> rVertAlign rPr'
, rUnderline = case rUnderline rPr of
Just ulstyle -> Just ulstyle
Nothing -> rUnderline rPr'
- , rStyle = rStyle rPr }
+ , rStyle = rStyle rPr
+ }
| otherwise = return rPr
runStyleToTransform :: PandocMonad m => RunStyle -> DocxContext m (Inlines -> Inlines)
@@ -286,6 +290,12 @@ runStyleToTransform rPr
| Just True <- isStrike rPr = do
transform <- runStyleToTransform rPr{isStrike = Nothing}
return $ strikeout . transform
+ | Just True <- isRTL rPr = do
+ transform <- runStyleToTransform rPr{isRTL = Nothing}
+ return $ spanWith ("",[],[("dir","rtl")]) . transform
+ | Just False <- isRTL rPr = do
+ transform <- runStyleToTransform rPr{isRTL = Nothing}
+ return $ spanWith ("",[],[("dir","ltr")]) . transform
| Just SupScrpt <- rVertAlign rPr = do
transform <- runStyleToTransform rPr{rVertAlign = Nothing}
return $ superscript . transform
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
index a28e90b5a..f725660b9 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -289,9 +289,11 @@ data RunStyle = RunStyle { isBold :: Maybe Bool
, isItalic :: Maybe Bool
, isSmallCaps :: Maybe Bool
, isStrike :: Maybe Bool
+ , isRTL :: Maybe Bool
, rVertAlign :: Maybe VertAlign
, rUnderline :: Maybe String
- , rStyle :: Maybe CharStyle}
+ , rStyle :: Maybe CharStyle
+ }
deriving Show
data ParStyleData = ParStyleData { headingLev :: Maybe (String, Int)
@@ -305,9 +307,11 @@ defaultRunStyle = RunStyle { isBold = Nothing
, isItalic = Nothing
, isSmallCaps = Nothing
, isStrike = Nothing
+ , isRTL = Nothing
, rVertAlign = Nothing
, rUnderline = Nothing
- , rStyle = Nothing}
+ , rStyle = Nothing
+ }
type Target = String
type Anchor = String
@@ -1106,6 +1110,7 @@ elemToRunStyle ns element parentStyle
checkOnOff ns rPr (elemName ns "w" "iCs")
, isSmallCaps = checkOnOff ns rPr (elemName ns "w" "smallCaps")
, isStrike = checkOnOff ns rPr (elemName ns "w" "strike")
+ , isRTL = checkOnOff ns rPr (elemName ns "w" "rtl")
, rVertAlign =
findChildByName ns "w" "vertAlign" rPr >>=
findAttrByName ns "w" "val" >>=
@@ -1117,7 +1122,7 @@ elemToRunStyle ns element parentStyle
findChildByName ns "w" "u" rPr >>=
findAttrByName ns "w" "val"
, rStyle = parentStyle
- }
+ }
elemToRunStyle _ _ _ = defaultRunStyle
getHeaderLevel :: NameSpaces -> Element -> Maybe (String,Int)