diff options
Diffstat (limited to 'src/Text/Pandoc/Readers/Docx/Reducible.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx/Reducible.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Reducible.hs b/src/Text/Pandoc/Readers/Docx/Reducible.hs index a852e25bf..39a93d988 100644 --- a/src/Text/Pandoc/Readers/Docx/Reducible.hs +++ b/src/Text/Pandoc/Readers/Docx/Reducible.hs @@ -39,6 +39,7 @@ module Text.Pandoc.Readers.Docx.Reducible ((<++>), innards, reduceList, reduceListB, + concatR, rebuild) where @@ -78,6 +79,15 @@ reduceList' as (x:xs) = reduceList' (init as ++ (last as <++> x) ) xs reduceList :: (Reducible a) => [a] -> [a] reduceList = reduceList' [] +concatR :: (Reducible a) => [a] -> [a] -> [a] +concatR [] [] = [] +concatR [] ss = ss +concatR rs [] = rs +concatR rs ss = let (x:xs) = reverse rs + (y:ys) = ss + in + reverse xs ++ ( x <++> y ) ++ ys + combineReducibles :: (Reducible a, Eq a) => a -> a -> [a] combineReducibles r s = let (conts, rs) = topLevelContainers r |