git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1524 from jkr/dropCap3
d6f0973John MacFarlane
src/Text/Pandoc/Readers/Docx.hs+1−3
@@ -462,9 +462,7 @@ bodyPartToBlocks (Paragraph pPr parparts)
462bodyPartToBlocks (Paragraph pPr parparts) = do
462bodyPartToBlocks (Paragraph pPr parparts) = do
463 ils <- parPartsToInlines parparts >>= (return . normalizeSpaces)
463 ils <- parPartsToInlines parparts >>= (return . normalizeSpaces)
464 dropIls <- gets docxDropCap
464 dropIls <- gets docxDropCap
465− let ils' = case ils of
465+ let ils' = concatR dropIls ils
466− (x:xs) -> reduceList (dropIls ++ [x]) ++ xs
467− [] -> dropIls
468 if dropCap pPr
466 if dropCap pPr
469 then do modify $ \s -> s { docxDropCap = ils' }
467 then do modify $ \s -> s { docxDropCap = ils' }
470 return []
468 return []
src/Text/Pandoc/Readers/Docx/Reducible.hs+10
@@ -39,6 +39,7 @@ module Text.Pandoc.Readers.Docx.Reducible ((<++>),
39 innards,
39 innards,
40 reduceList,
40 reduceList,
41 reduceListB,
41 reduceListB,
42+ concatR,
42 rebuild)
43 rebuild)
43 where
44 where
44
45
@@ -78,6 +79,15 @@ reduceList' as (x:xs) = reduceList' (init as ++ (last as <++> x) ) xs
78reduceList :: (Reducible a) => [a] -> [a]
79reduceList :: (Reducible a) => [a] -> [a]
79reduceList = reduceList' []
80reduceList = reduceList' []
80
81
82+concatR :: (Reducible a) => [a] -> [a] -> [a]
83+concatR [] [] = []
84+concatR [] ss = ss
85+concatR rs [] = rs
86+concatR rs ss = let (x:xs) = reverse rs
87+ (y:ys) = ss
88+ in
89+ reverse xs ++ ( x <++> y ) ++ ys
90+
81combineReducibles :: (Reducible a, Eq a) => a -> a -> [a]
91combineReducibles :: (Reducible a, Eq a) => a -> a -> [a]
82combineReducibles r s =
92combineReducibles r s =
83 let (conts, rs) = topLevelContainers r
93 let (conts, rs) = topLevelContainers r