aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-10-05 08:06:22 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-10-05 08:06:22 -0400
commit4eba314c242aa44db4aed48f99973e07dc4ae435 (patch)
tree264f6f4ddba1b21adf0f2c2a68cbb4a764bd49f1 /src
parentbe27c9c646e95c47e4ac6c2c082d93301332d1b8 (diff)
downloadpandoc-4eba314c242aa44db4aed48f99973e07dc4ae435.tar.gz
Docx writer: code legibility fixups.
More meaningful variable name, and explanatory comment.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 03a4f82ff..9081c0a20 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -1282,15 +1282,16 @@ fitToPage (x, y) pageWidth
withDirection :: WS a -> WS a
withDirection x = do
- isDir <- asks envRTL
+ isRTL <- asks envRTL
paraProps <- asks envParaProperties
textProps <- asks envTextProperties
- -- we have to do this because we don't want to accumulate these
- -- properties if we have it set while the environment is already
- -- active.
+ -- We want to clean all bidirection (bidi) and right-to-left (rtl)
+ -- properties from the props first. This is because we don't want
+ -- them to stack up.
let paraProps' = filter (\e -> (qName . elName) e /= "bidi") paraProps
textProps' = filter (\e -> (qName . elName) e /= "rtl") textProps
- if isDir
+ if isRTL
+ -- if we are going right-to-left, we (re?)add the properties.
then flip local x $
\env -> env { envParaProperties = (mknode "w:bidi" [] ()) : paraProps'
, envTextProperties = (mknode "w:rtl" [] ()) : textProps'