aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Docx
AgeCommit message (Collapse)AuthorFilesLines
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane6-0/+6
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 MacFarlane2-2/+1
- 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.
2015-10-04Docx Reader: Parse soft, no-break hyphen elementsOphir Lifshitz1-1/+3
2015-03-24Docx Writer: Fix StyleMapNikolay Yakimov1-18/+19
I've messed up badly with it, so it didn't work properly most of the time. At the plus side, fallback mechanic is working wonderfully.
2015-03-03Code cleanupNikolay Yakimov1-12/+12
2015-03-01Started moving StyleMap out of writer codeNikolay Yakimov3-20/+137
2015-02-19Docx reader: Allow numbering in the style file.Jesse Rosenthal1-21/+33
This allows inherited styles with numbering (lists). It works like this: 1. check to see if the style has numbering info. 2. if the paragraph has explicit numbering info in the doc that takes precedence. 3. if not we use the numbering info in the style, if it's there. 4. otherwise normal paragraph. We no longer assume it's not a numbering element if it doesn't have an explicit level---we just set that level to 1. (In the style files, the examples I've seen don't have that explicit level.)
2015-01-21Docx: Parse images in deprecated vml format.Jesse Rosenthal1-0/+10
Some older versions of word use vml (vector markup language) and put their images in a "v:imagedata" tag inside a "w:pict". We read those as we read the more modern "blip" inside a "w:drawing". Note that this does not mean the reader knows anything about vml. It just looks for a `v:imagdata`. It's possible that, with more complicated uses of images in vml, it won't do the right thing.
2014-11-13Account for external link URLs with anchorsCaleb McDaniel1-7/+10
Previously, if a URL had an anchor, such as http://johnmacfarlane.net/pandoc/README.html#synopsis the reader would incorrectly identify it as an internal link and return "#synopsis" for the link in output.
2014-10-25Docx reader: fix for Issue #1692 (i18n styles)Nikolay Yakimov1-29/+124
This patch builds paragraph styles tree, then checks if paragraph has style.styleId or style/name.val matching predetermined patterns. Works with "Heading#" (name.val="heading #") for headings and "Quote"|"BlockQuote"|"BlockQuotation" (name.val="Quote"|"Block Text") for block quotes.
2014-09-27Merge pull request #1601 from jkr/windowsfixJohn MacFarlane1-1/+1
Fix path-slashes inside archive for windows
2014-09-04Docx reader: Single-item headers in ordered lists are headers.Jesse Rosenthal1-4/+6
When users number their headers, Word understands that as a single item enumerated list. We make the assumption that such a list is, in fact, a header.
2014-09-02Docx reader: Fix window path for image lookup.Jesse Rosenthal1-1/+1
Don't use os-sensitive "combine", since we always want the paths in our zip-archive to use forward-slashes.
2014-08-17Docx Parse: build a bottom-up style tree.Jesse Rosenthal1-6/+31
Two points here: (1) We're going bottom-up, from styles not based on anything, to avoid circular dependencies or any other sort of maliciousness/incompetence. And (2) each style points to its parent. That way, we don't need the whole tree to pass a style over to Docx.hs
2014-08-17Alias string and runStyle to CharStyle type.Jesse Rosenthal1-7/+10
2014-08-17Docx Style parser: Basic one now just takes a parent style.Jesse Rosenthal1-13/+15
This will make it easier to build the style map from the bottom up (to avoid any infinite references).
2014-08-17Parser: Framework for parsing styles.Jesse Rosenthal1-11/+44
We want to be able to read user-defined styles. Eventually we'll be able to figure out styles in terms of inheritance as well. The actual cascading will happen in the docx reader.
2014-08-17Docx reader: Change behavior of Super/SubscriptJesse Rosenthal1-12/+13
In docx, super- and subscript are attributes of Vertalign. It makes more sense to follow this, and have different possible values of Vertalign in runStyle. This is mainly a preparatory step for real style parsing, since it can distinguish between vertical align being explicitly turned off and it not being set. In addition, it makes parsing a bit clearer, and makes sure we don't do docx-impossible things like being simultaneously super and sub.
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: accept explicit "Italic" and "Bold" rStyles.Jesse Rosenthal1-13/+13
Note that "Italic" can be on, and, from the last commit, `<w:i>` can be present, but be turned off. In that case, the turned-off tag takes precedence. So, we have to distinguish between something being off and something not being there. Hence, isItalic, isBold, isStrike, and isSmallCaps have become Maybes.
2014-08-12Docx Reader: Fix font style parsing.Jesse Rosenthal1-12/+27
Before we just checked for the existence of a tag. Now, we make sure to check for its on/off value.
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-11Add dropCap to paragraph style.Jesse Rosenthal1-2/+12
2014-08-11Docx reader: handle empty reducibles.Jesse Rosenthal1-5/+6
2014-08-11Docx Parse: Improved font recognition when specified in rFonts elementMatthew Pickering1-8/+27
2014-08-11Docx Fonts: Derives Show and EqMatthew Pickering1-0/+1
2014-08-10Merge pull request #1510 from jkr/spacefixJohn MacFarlane1-10/+12
Docx reader: Fix spacing issue.
2014-08-10Removed OMath module, depend on texmath >= 0.8.John MacFarlane2-439/+1
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-08-09Docx Parse: Recognises code points in sym elements which are in the private ↵Matthew Pickering1-1/+4
range
2014-08-09Added Text.Pandoc.Readers.Docx.FontsMatthew Pickering1-0/+237
2014-08-09Docx Reader: Added recognition of sym element in paragraphsMatthew Pickering1-0/+19
2014-08-08OMath parser: Change signature of exported function.Jesse Rosenthal2-7/+20
This changes the signature of the exported `readOMML` to `String -> Either String [Exp]`, so it can now, in theory, be slotted into TeXMath. It doesn't have any real error reporting yet, but that might make more sense once I put it in a branch, and understand how it works in the other readers. It also now reads strings that parse to either oMath or oMathPara elements. Note that the distinction is lost in the output. It's up to the caller to remember the display type.
2014-08-08OMath: Finish initial cleanup.Jesse Rosenthal2-536/+54
This gets rid of commented-out functions, cleans up whitespace errors, and exports and imports the correct functions.
2014-08-08OMath: Remove NamespacesJesse Rosenthal2-287/+290
We still need to test against prefixes, but this is only going to look at oMath fragments, so we're not going to be worried about looking up the real namespace.
2014-08-08OMath: Start phasing out internal OMath type.Jesse Rosenthal1-0/+276
This is the first step in removing the intermediate OMath type, which we no longer need since we're writing straight to TeXMath Exp.
2014-08-08OMath parser: don't group expressions if there's only one.Jesse Rosenthal1-3/+3
2014-08-07Merge pull request #1494 from jkr/math-moduleJohn MacFarlane2-366/+629
Math module
2014-08-07Docx reader: Handle inline drawings.Jesse Rosenthal1-3/+15
Previous drawings that were under some other toplevel run (i.e., a hyperlink) wouldn't be properly handled. This should fix that.
2014-08-07OMath module: Add new file.Jesse Rosenthal1-0/+622
2014-08-07Docx reader: Split math out into math module.Jesse Rosenthal1-366/+7
Could use some cleanup, but this is the first step for getting an OMML reader into TeXMath.
2014-08-06Remove now-unnecessary TexCharJesse Rosenthal1-4386/+0
TeXMath does the work now.
2014-08-06Add a note on how `mapD` works.Jesse Rosenthal1-0/+3
2014-08-06Docx reader: Use TeXMath to write mathJesse Rosenthal1-22/+125
The new version of TeXMath can translate from its type system into LaTeX. So instead of writing the LaTeX ourself, we write to the TeXMath `Exp` type, and let TeXMath do the rest.
2014-08-01Docx Parser: Produce endnotes.Jesse Rosenthal1-2/+2
The parser had been changing footnotes and endnotes into footnotes. This isn't a problem, because pandoc collapses them, but the parser should maintain as much of the docx structure as is collapsed, and let the toplevel reader worry about how to translate it into Pandoc. (This would be an issue when, as is planned, the docx parser spins off into its own module.) The output is the same, so no test change is required.
2014-07-30Docx reader: Make docx reader put image data in MediaBag.Jesse Rosenthal1-5/+5
Image data will not be put in a media bag map, which will be output along with the pandoc output.
2014-07-12Removed space at ends of lines in source.John MacFarlane4-36/+36
2014-07-12Docx Reader: Add a compatibility layer for Except.Jesse Rosenthal1-3/+3
mtl switched from ErrorT to ExceptT, but we're not sure which mtl we'll be dealing with. This should make errors work with both. The main difference (beside the name of the module and the monad transformer) is that Except doesn't require an instance of an Error Typeclass. So we define that for compatability. When we switch to a later mtl, using Control.Monad.Exception, we can just erase the instance declaration, and all should work fine.