diff options
author | Nikolay Yakimov <root@livid.pp.ru> | 2020-07-07 12:28:38 +0300 |
---|---|---|
committer | Nikolay Yakimov <root@livid.pp.ru> | 2020-07-07 12:28:38 +0300 |
commit | 1ae4d76d42eb63ab71b7bd27301501f9cf683cf4 (patch) | |
tree | d07b6ff942e07da3c42547ca33d971a317d79e65 /src/Text/Pandoc/Readers/Docx | |
parent | 27465638a16b2105e393ef49e3aeb5240cd80055 (diff) | |
download | pandoc-1ae4d76d42eb63ab71b7bd27301501f9cf683cf4.tar.gz |
[Docx Reader] Remove no-op stack/unstackInlines in Readers.Docx.Combine
Diffstat (limited to 'src/Text/Pandoc/Readers/Docx')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx/Combine.hs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Combine.hs b/src/Text/Pandoc/Readers/Docx/Combine.hs index c095adc2b..22541097c 100644 --- a/src/Text/Pandoc/Readers/Docx/Combine.hs +++ b/src/Text/Pandoc/Readers/Docx/Combine.hs @@ -71,20 +71,18 @@ data Modifier a = Modifier (a -> a) spaceOutInlinesL :: Inlines -> (Inlines, Inlines) spaceOutInlinesL ms = (l, stackInlines fs (m' <> r)) - where (l, m, r) = spaceOutInlines ms - (fs, m') = unstackInlines m + where (l, (fs, m'), r) = spaceOutInlines ms spaceOutInlinesR :: Inlines -> (Inlines, Inlines) spaceOutInlinesR ms = (stackInlines fs (l <> m'), r) - where (l, m, r) = spaceOutInlines ms - (fs, m') = unstackInlines m + where (l, (fs, m'), r) = spaceOutInlines ms -spaceOutInlines :: Inlines -> (Inlines, Inlines, Inlines) +spaceOutInlines :: Inlines -> (Inlines, ([Modifier Inlines], Inlines), Inlines) spaceOutInlines ils = let (fs, ils') = unstackInlines ils (left, (right, contents')) = second (spanr isSpace) $ spanl isSpace $ unMany ils' -- NOTE: spanr counterintuitively returns suffix as the FIRST tuple element - in (Many left, stackInlines fs $ Many contents', Many right) + in (Many left, (fs, Many contents'), Many right) isSpace :: Inline -> Bool isSpace Space = True |