summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-10-03 18:29:25 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-10-03 21:39:40 -0400
commitacf352331c43e44a5cbf63b4ff1502db056284af (patch)
tree1297af101102932d8efdf72f67056f40a4e7a576
parente98be61a3855c5f19946c3be757cd6f071b184b3 (diff)
Add a boolean flag to the setRTL function.
At the toplevel we don't check to see if RTL is already set.
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index af3717b10..27bb4117b 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -797,7 +797,7 @@ blockToOpenXML opts (Div (ident,classes,kvs) bs)
withParaPropM (pStyleM sty) $ blocksToOpenXML opts bs
| Just "rtl" <- lookup "dir" kvs = do
let kvs' = filter (("dir", "rtl")/=) kvs
- setRTL $ blockToOpenXML opts (Div (ident,classes,kvs') bs)
+ setRTL False $ blockToOpenXML opts (Div (ident,classes,kvs') bs)
| Just "ltr" <- lookup "dir" kvs = do
let kvs' = filter (("dir", "ltr")/=) kvs
setLTR $ blockToOpenXML opts (Div (ident,classes,kvs') bs)
@@ -1042,7 +1042,7 @@ inlineToOpenXML opts (Span (ident,classes,kvs) ils)
inlineToOpenXML opts (Span (ident,classes,kvs') ils)
| Just "rtl" <- lookup "dir" kvs = do
let kvs' = filter (("dir", "rtl")/=) kvs
- setRTL $ inlineToOpenXML opts (Span (ident,classes,kvs') ils)
+ setRTL False $ inlineToOpenXML opts (Span (ident,classes,kvs') ils)
| Just "ltr" <- lookup "dir" kvs = do
let kvs' = filter (("dir", "ltr")/=) kvs
setLTR $ inlineToOpenXML opts (Span (ident,classes,kvs') ils)
@@ -1275,10 +1275,10 @@ fitToPage (x, y) pageWidth
(pageWidth, floor $ ((fromIntegral pageWidth) / x) * y)
| otherwise = (floor x, floor y)
-setRTL :: WS a -> WS a
-setRTL x = do
+setRTL :: Bool -> WS a -> WS a
+setRTL topLevel x = do
isRTL <- asks envRTL
- if isRTL
+ if isRTL && not topLevel
then x
else flip local x $ \env -> env {
envRTL = True