git.iko.soy/typeable/pandoc
on master help sign in
Docx reader: handle empty reducibles.
0411fe7Jesse Rosenthal
src/Text/Pandoc/Readers/Docx/Reducible.hs+6−5
@@ -88,11 +88,13 @@ combineReducibles r s =
88 in
88 in
89 case null shared of
89 case null shared of
90 True | (x : xs) <- reverse rs
90 True | (x : xs) <- reverse rs
91− , isSpace x ->
91+ , isSpace x -> case xs of
92+ [] -> [x, s]
92− rebuild conts (reverse xs) ++ [x, s]
93+ _ -> rebuild conts (reverse xs) ++ [x, s]
93 | (x : xs) <- ss
94 | (x : xs) <- ss
94− , isSpace x ->
95+ , isSpace x -> case xs of
96+ [] -> [r, x]
95− [r, x] ++ rebuild conts' (xs)
97+ _ -> [r, x] ++ rebuild conts' (xs)
96 True -> [r,s]
98 True -> [r,s]
97 False -> rebuild
99 False -> rebuild
98 shared $
100 shared $
@@ -121,7 +123,6 @@ instance Reducible Inline where
121 False -> [Span attr2' ils2]
123 False -> [Span attr2' ils2]
122 in
124 in
123 [Span attr' $ reduceList $ s1' ++ s2']
125 [Span attr' $ reduceList $ s1' ++ s2']
124−
125 (Str x) <++> (Str y) = [Str (x++y)]
126 (Str x) <++> (Str y) = [Str (x++y)]
126 il <++> il' = combineReducibles il il'
127 il <++> il' = combineReducibles il il'
127
128