git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: code legibility fixups.

More meaningful variable name, and explanatory comment.

commit4eba314c242aa44db4aed48f99973e07dc4ae435 authorJesse Rosenthal <jrosenthal@jhu.edu> dateWed 5 Oct 2016, 08:06 (10 years ago) parentbe27c9c
1 file changed+6−5
src/Text/Pandoc/Writers/Docx.hs+6−5
src/Text/Pandoc/Writers/Docx.hs+6−5
@@ -1282,15 +1282,16 @@ fitToPage (x, y) pageWidth
12821282
12831283withDirection :: WS a -> WS a
12841284withDirection x = do
1285− isDir <- asks envRTL
1285+ isRTL <- asks envRTL
12861286 paraProps <- asks envParaProperties
12871287 textProps <- asks envTextProperties
1288− -- we have to do this because we don't want to accumulate these
1289− -- properties if we have it set while the environment is already
1290− -- active.
1288+ -- We want to clean all bidirection (bidi) and right-to-left (rtl)
1289+ -- properties from the props first. This is because we don't want
1290+ -- them to stack up.
12911291 let paraProps' = filter (\e -> (qName . elName) e /= "bidi") paraProps
12921292 textProps' = filter (\e -> (qName . elName) e /= "rtl") textProps
1293− if isDir
1293+ if isRTL
1294+ -- if we are going right-to-left, we (re?)add the properties.
12941295 then flip local x $
12951296 \env -> env { envParaProperties = (mknode "w:bidi" [] ()) : paraProps'
12961297 , envTextProperties = (mknode "w:rtl" [] ()) : textProps'