Powerpoint writer: consolidate text run nodes.

This should reduce the size of the generated files.
This commit is contained in:
John MacFarlane 2021-10-04 11:45:01 -07:00
parent 0088e79cf5
commit 62f83aa486
137 changed files with 9 additions and 1 deletions

View file

@ -348,7 +348,15 @@ instance Default PicProps where
--------------------------------------------------
inlinesToParElems :: [Inline] -> Pres [ParaElem]
inlinesToParElems ils = concatMapM inlineToParElems ils
inlinesToParElems = concatMapM inlineToParElems . consolidateStrs
where
-- we combine Str + Space combinations, because this makes
-- the resulting ooxml much more compact, with fewer independent
-- text run elements
consolidateStrs [] = []
consolidateStrs (Str t : Space : ils) = consolidateStrs (Str (t <> " ") : ils)
consolidateStrs (Space : Str t : ils) = consolidateStrs (Str (" " <> t) : ils)
consolidateStrs (il : ils) = il : consolidateStrs ils
inlineToParElems :: Inline -> Pres [ParaElem]
inlineToParElems (Str s) = do

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more