From 4eba314c242aa44db4aed48f99973e07dc4ae435 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Wed, 5 Oct 2016 08:06:22 -0400 Subject: Docx writer: code legibility fixups. More meaningful variable name, and explanatory comment. --- src/Text/Pandoc/Writers/Docx.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc/Writers') 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' -- cgit v1.2.3