git.iko.soy/typeable/pandoc
on master help sign in
Docx reader: Fix spacing issue.

Previously spaces at the beginning of Emph/Strong/etc were kept inside. This makes sure they are moved out.

commita02ce74acf2189207b178fb7c6b62efd23145b0e authorJesse Rosenthal <jrosenthal@jhu.edu> dateSat 9 Aug 2014, 23:35 (12 years ago) parentc2a0d47
1 file changed+10−9
src/Text/Pandoc/Readers/Docx/Reducible.hs+10−9
src/Text/Pandoc/Readers/Docx/Reducible.hs+10−9
@@ -87,13 +87,16 @@ combineReducibles r s =
8787 remaining' = conts' \\ shared
8888 in
8989 case null shared of
90− True -> case (not . null) rs && isSpace (last rs) of
91− True -> rebuild conts (init rs) ++ [last rs, s]
92− False -> [r,s]
93− False -> rebuild
94− shared $
95− reduceList $
96− (rebuild remaining rs) ++ (rebuild remaining' ss)
90+ True -> case () of
91+ _ | (not . null) rs && isSpace (last rs) ->
92+ rebuild conts (init rs) ++ [last rs, s]
93+ _ | (not . null) ss && isSpace (head ss) ->
94+ [r, head ss] ++ rebuild conts' (tail ss)
95+ _ -> [r,s]
96+ False -> rebuild
97+ shared $
98+ reduceList $
99+ (rebuild remaining rs) ++ (rebuild remaining' ss)
97100
98101instance Reducible Inline where
99102 s1@(Span (id1, classes1, kvs1) ils1) <++> s2@(Span (id2, classes2, kvs2) ils2) =
@@ -177,5 +180,3 @@ rebuild :: [Container a] -> [a] -> [a]
177180rebuild [] xs = xs
178181rebuild ((Container f) : cs) xs = rebuild cs $ [f xs]
179182rebuild (NullContainer : cs) xs = rebuild cs $ xs
180−
181−