git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1510 from jkr/spacefix

Docx reader: Fix spacing issue.

commit65b31e0cacbdd2dc57a8406b420559f7e5fb4867 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 10 Aug 2014, 07:11 (12 years ago) parent7ec8dd9c15978c
1 file changed+12−10
src/Text/Pandoc/Readers/Docx/Reducible.hs+12−10
src/Text/Pandoc/Readers/Docx/Reducible.hs+12−10
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings #-}
1+{-# LANGUAGE OverloadedStrings, PatternGuards #-}
22
33{-
44Copyright (C) 2014 Jesse Rosenthal <jrosenthal@jhu.edu>
@@ -87,13 +87,17 @@ 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 | (x : xs) <- reverse rs
91+ , isSpace x ->
92+ rebuild conts (reverse xs) ++ [x, s]
93+ | (x : xs) <- ss
94+ , isSpace x ->
95+ [r, x] ++ rebuild conts' (xs)
96+ True -> [r,s]
97+ False -> rebuild
98+ shared $
99+ reduceList $
100+ (rebuild remaining rs) ++ (rebuild remaining' ss)
97101
98102instance Reducible Inline where
99103 s1@(Span (id1, classes1, kvs1) ils1) <++> s2@(Span (id2, classes2, kvs2) ils2) =
@@ -177,5 +181,3 @@ rebuild :: [Container a] -> [a] -> [a]
177181rebuild [] xs = xs
178182rebuild ((Container f) : cs) xs = rebuild cs $ [f xs]
179183rebuild (NullContainer : cs) xs = rebuild cs $ xs
180−
181−