summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Docx.hs
Commit message (Collapse)AuthorAge
* Merge branch 'errortype' of https://github.com/mpickering/pandoc into ↵John MacFarlane2015-03-28
|\ | | | | | | | | | | | | | | | | | | | | mpickering-errortype Conflicts: benchmark/benchmark-pandoc.hs src/Text/Pandoc/Readers/Markdown.hs src/Text/Pandoc/Readers/Org.hs src/Text/Pandoc/Readers/RST.hs tests/Tests/Readers/LaTeX.hs
| * Change return type of Docx readerMatthew Pickering2015-02-18
| |
* | Docx reader: Minor cleanup.Jesse Rosenthal2015-02-21
| | | | | | | | | | The previous commits had some code repetition. This just makes it a bit easier to read.
* | Docx reader: allow sub/superscript verbatims.Jesse Rosenthal2015-02-21
|/ | | | | Verbatim usually shuts off all other run styles, but we don't want it to shut off sub/superscript.
* Docx reader: Handle lists correctly inside table cells.Jesse Rosenthal2015-02-13
| | | | Previously we didn't transform lists inside table cells.
* Docx reader: fix for Issue #1692 (i18n styles)Nikolay Yakimov2014-10-25
| | | | | | | | 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.
* Docx Reader: Remove header class properly in other langsJesse Rosenthal2014-09-06
| | | | | | When we encounter one of the polyglot header styles, we want to remove that from the par styles after we convert to a header. To do that, we have to keep track of the style name, and remove it appropriately.
* Docx reader: Use polyglot header list.Jesse Rosenthal2014-09-05
| | | | | | | | | | We're just keeping a list of header formats that different languages use as their default styles. At the moment, we have English, German, Danish, and French. We can continue to add to this. This is simpler than parsing the styles file, and perhaps less error-prone, since there seems to be some variations, even within a language, of how a style file will define headers.
* Docx Reader: Start list of polyglot section headers.Jesse Rosenthal2014-09-05
|
* Docx reader: Rewrite rewriteLink to work with new headers.Jesse Rosenthal2014-09-04
| | | | | There could be new top-level headers after making lists, so we have to rewrite links after that.
* Docx Reader: Read single para in table cell as plainJesse Rosenthal2014-08-28
| | | | | | | | | | This makes to docx reader's native output fit with the way the markdown reader understands its markdown output. Ie, as far as table cells go: docx -> native == docx -> native -> markdown -> native (This identity isn't true for other things outside of table cells, of course).
* Docx reader: whitespace fix.Jesse Rosenthal2014-08-17
|
* Docx reader: remove emph styles and strong styles list.Jesse Rosenthal2014-08-17
| | | | | We no longer need the explicit lists since we're deriving them from the ground up.
* Docx reader: Add "Hyperlink" to blacklisted styles.Jesse Rosenthal2014-08-17
| | | | This is the only one so far. We'll add others as they show up.
* Docx reader: Use style resolver.Jesse Rosenthal2014-08-17
| | | | We now no longer check against explicit styles.
* Docx Reader: Introduce function for resolving dependent run styles.Jesse Rosenthal2014-08-17
| | | | | | | | We always favor an explicit positive or negative in a style in a descendent, and only turn to the ancestor if nothing is set. We also introduce an (empty) list of styles that are black-listed. We won't check them. (Think underlines in hyperlinks).
* Docx reader: work with new rStyle.Jesse Rosenthal2014-08-17
| | | | Just discards info at the moment, so at least it works the same.
* Docx reader: Change behavior of Super/SubscriptJesse Rosenthal2014-08-17
| | | | | | | | | | | 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.
* Docx reader: Remove unnecessary plural functionsJesse Rosenthal2014-08-16
| | | | | | | | | functions like runElemsToInlines and parPartsToInlines are just defined in terms of concatting and mapping their singular version (e.g. `runElemToInlines`). Having two functions with almost identical names makes it easier to introduce errors. It's easy enough to just concat and map inline, and it makes it clearer what is going on in the code.
* Docx reader: Fix bug in character styles.Jesse Rosenthal2014-08-16
| | | | | Style handling has been cleaned up, but introduced a bug here. There wasn't previously a test to catch it.
* Rewrite Docx.hs and Reducible to use Builder.Jesse Rosenthal2014-08-16
| | | | | | | | | | 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.
* Docx reader: Interpret "Strong" and Emphasis run styles.Jesse Rosenthal2014-08-13
|
* Docx Reader: Trim line breaks from the beginning and end of SectionJesse Rosenthal2014-08-12
| | | | | | Headers. We might also want to do this elsewhere (for pars, for example).
* Docx: More robust handling of multiple bookmarks in header.Jesse Rosenthal2014-08-12
|
* Docx reader: Check for null-id'd anchors too.Jesse Rosenthal2014-08-12
| | | | Otherwise they get left dangling in the document.
* Docx reader: accept explicit "Italic" and "Bold" rStyles.Jesse Rosenthal2014-08-12
| | | | | | | | 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.
* Docx reader: Add "BlockQuotation" to divs list.Jesse Rosenthal2014-08-12
|
* Docx reader: move combining logic to ReducibleJesse Rosenthal2014-08-12
| | | | | | | | | | | | 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.
* Docx reader: Make dropcap combining more efficient.Jesse Rosenthal2014-08-12
| | | | | | | Before, we had to run reduceList on the whole combined paragraph, which was redundant, and could take some time for long paragraphs. We only need to combine the drop cap with the first inline of the next paragraph.
* Docx reader: combine inlines properly in dropcaps.Jesse Rosenthal2014-08-11
| | | | | Make sure that adjacent inlines are combined properly in dropcaps. This updates the test results as well.
* Docx reader: Use dropcap state.Jesse Rosenthal2014-08-11
| | | | | If we get to a dropcap, we keep hold the inlines until the next paragraph, and combine it there.
* OMath parser: Change signature of exported function.Jesse Rosenthal2014-08-08
| | | | | | | | | | | | 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.
* Merge pull request #1494 from jkr/math-moduleJohn MacFarlane2014-08-07
|\ | | | | Math module
| * Docx reader: Split math out into math module.Jesse Rosenthal2014-08-07
| | | | | | | | | | Could use some cleanup, but this is the first step for getting an OMML reader into TeXMath.
| * Docx Reader: Added Default instances and removed withDStateMatthew Pickering2014-08-06
| | | | | | | | Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
* | Docx reader: Handle inline drawings.Jesse Rosenthal2014-08-07
|/ | | | | Previous drawings that were under some other toplevel run (i.e., a hyperlink) wouldn't be properly handled. This should fix that.
* Get rid of unused docx variable.Jesse Rosenthal2014-08-06
| | | | | Since changing the Docx type, this is no longer necessary. Thanks to Matthew Pickering for picking up on this.
* Docx reader: remove now-unnecessary state variable.Jesse Rosenthal2014-08-06
| | | | This also introduces a `defaultDState` value.
* Docx reader: Use TeXMath to write mathJesse Rosenthal2014-08-06
| | | | | | 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.
* Use `stripPrefix` where appropriate.Artyom Kazak2014-08-04
|
* Docx Reader: Single underlines are "emph"Jesse Rosenthal2014-07-31
| | | | All other underlines are ignored.
* New module, Text.Pandoc.MediaBag.John MacFarlane2014-07-31
| | | | | | | Moved `MediaBag` definition and functions from Shared: `lookupMedia`, `mediaDirectory`, `insertMedia`, `extractMediaBag`. Removed `emptyMediaBag`; use `mempty` instead, since `MediaBag` is a Monoid.
* Made MediaBag a newtype, and added mime type information to media.John MacFarlane2014-07-31
| | | | | | | | | | Shared now exports functions for interacting with a MediaBag: - `emptyMediaBag` - `lookuMedia` - `insertMedia` - `mediaDirectory` - `extractMediaBag`
* Docx reader: Make docx reader put image data in MediaBag.Jesse Rosenthal2014-07-30
| | | | | Image data will not be put in a media bag map, which will be output along with the pandoc output.
* Docx reader: Make metavalues out of styled paragraphs.Jesse Rosenthal2014-07-29
| | | | | | | | | | | This will make paragraphs styled with `Author`, `Title`, `Subtitle`, `Date`, and `Abstract` into pandoc metavalues, rather than text. The implementation only takes those elements from the beginning of the document (ignoring empty paragraphs). Multiple paragraphs in the `Author` style will be made into a metaList, one paragraph per item. Hard linebreaks (shift-return) in the paragraph will be maintained, and can be used for institution, email, etc.
* Docx Reader: Fix hdr auto-id when already auto-id.Jesse Rosenthal2014-07-16
| | | | | | | | | If header anchors (bookmarks in a header paragraph) already have an auto-id, which will happen if they're generated by pandoc, we don't want to rename it twice, and thus end up with an unnecessary number at the end. So we add a state value to check if we're in a header. If we are, we don't rename the bookmark -- wait until we rename it in our header handling.
* Docx Reader: Change state handling.Jesse Rosenthal2014-07-16
| | | | | We don't need `updateDState` -- the built-in `modify` works just fine. And we redefine `withDState` to use modify.
* Removed space at ends of lines in source.John MacFarlane2014-07-12
|
* Docx Reader: A nicer Docx type.Jesse Rosenthal2014-07-12
| | | | | | | | | | | | This modifies the Docx type in the parser to avoid all the extra files (Notes, numbering, etc). A reader monad keeps track of these, and applies them at the end. The reader monad is stacked with ErrorT to enable better error-handling than the old Maybes. (Note that the better error handling isn't really there yet, but it is now possible.) One long-term goal of these changes is to make it easier to write the Docx type. This should make it easier to develop a standalone docx package in the future.
* Docx Reader: Write LaTeX based on equations in word.Jesse Rosenthal2014-07-02
| | | | | | | | | | | This is a first stab at writing out equations in LaTeX based on omml equations in Word. There are some glitches: unicode chars not known to LaTeX are silently skipped, and functions (such as `\oiiint`) not in the standard LaTeX packages are inserted, which can lead to pdf compilation errors (depending, of course, on your preamble). Adding, for example, `\usepackage[charter]{mathdesign}` to the preamble will allow you to use most of the more esoteric functions.