aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Docx/Reducible.hs
AgeCommit message (Collapse)AuthorFilesLines
2016-02-26Docx Reader: Get rid of Modifiable typeclass.Jesse Rosenthal1-183/+0
The docx reader used to use a Modifiable typeclass to combine both Blocks and Inlines. But all the work was in the inlines. So most of the generality was wasted, at the expense of making the code harder to understand. This gets rid of the generality, and adds functions for Blocks and Inlines. It should be a bit easier to work with going forward.
2016-02-02Docx reader: Add a "Link" modifier to ReducibleJesse Rosenthal1-0/+2
We want to make sure that links have their spaces removed, and are appropriately smushed together. This closes #2689
2015-11-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane1-1/+0
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane1-0/+1
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane1-1/+0
- The (non-exported) prelude is in prelude/Prelude.hs. - It exports Monoid and Applicative, like base 4.8 prelude, but works with older base versions. - It exports (<>) for mappend. - It hides 'catch' on older base versions. This allows us to remove many imports of Data.Monoid and Control.Applicative, and remove Text.Pandoc.Compat.Monoid. It should allow us to use -Wall again for ghc 7.10.
2014-08-16Rewrite Docx.hs and Reducible to use Builder.Jesse Rosenthal1-189/+175
The big news here is a rewrite of Docx to use the builder functions. As opposed to previous attempts, we now see a significant speedup -- times are cut in half (or more) in a few informal tests. Reducible has also been rewritten. It can doubtless be simplified and clarified further. We can consider this, at the moment, a reference for correct behavior.
2014-08-13Docx: Reducible forgot about smallcapsJesse Rosenthal1-0/+2
2014-08-12Docx reader: move combining logic to ReducibleJesse Rosenthal1-0/+10
Introduces a new function in Reducibles, concatR. The idea is that if we have two list of Reducibles (blocks or inlines), we can combine them and just perform the reduction on the joining parts (the last element of the first list, the first element of the second list). This is useful in cases where the two lists are already reduced, and we're only worried about the joining elements. This actually improves the efficiency a bit further, because concatR can be smart about empty lists.
2014-08-11Docx reader: handle empty reducibles.Jesse Rosenthal1-5/+6
2014-08-10Change head/tail to pattern guards.Jesse Rosenthal1-7/+8
2014-08-09Docx reader: Fix spacing issue.Jesse Rosenthal1-9/+10
Previously spaces at the beginning of Emph/Strong/etc were kept inside. This makes sure they are moved out.
2014-07-12Removed space at ends of lines in source.John MacFarlane1-4/+4
2014-06-23Add copyright block to T.P.R.Docx.Reducible.Jesse Rosenthal1-0/+31
2014-06-23Add new typeclass, ReducibleJesse Rosenthal1-0/+150
This defines a typeclass `Reducible` which allows us to "reduce" pandoc Inlines and Blocks, like so Emph [Strong [Str "foo", Space]] <++> Strong [Emph [Str "bar"]], Str "baz"] = [Strong [Emph [Str "foo", Space, Str "bar"], Space, Str "baz"]] So adjacent formattings and strings are appropriately grouped. Another set of operators for `(Reducible a) => (Many a)` are also included.