aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Docx.hs
AgeCommit message (Collapse)AuthorFilesLines
2015-11-18Docx reader: Handle dummy list items.Jesse Rosenthal1-0/+4
These come up when people create a list item and then delete the bullet. It doesn't refer to any real list item, and we used to ignore it. We handle it with a DummyListItem type, which, in Docx.hs, is turned into a normal paragraph with a "ListParagraph" class. If it follow another list item, it is folded as another paragraph into that item. If it doesn't, it's just its own (usually indented, and therefore block-quoted) paragraph.
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-2/+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.
2015-10-04Docx Reader: Parse soft, no-break hyphen elementsOphir Lifshitz1-0/+4
2015-08-07Updated readers, writers and README for link attributemb211-2/+2
2015-03-28Merge branch 'errortype' of https://github.com/mpickering/pandoc into ↵John MacFarlane1-8/+11
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
2015-02-21Docx reader: Minor cleanup.Jesse Rosenthal1-3/+4
The previous commits had some code repetition. This just makes it a bit easier to read.
2015-02-21Docx reader: allow sub/superscript verbatims.Jesse Rosenthal1-1/+6
Verbatim usually shuts off all other run styles, but we don't want it to shut off sub/superscript.
2015-02-18Change return type of Docx readerMatthew Pickering1-8/+11
2015-02-13Docx reader: Handle lists correctly inside table cells.Jesse Rosenthal1-1/+3
Previously we didn't transform lists inside table cells.
2014-10-25Docx reader: fix for Issue #1692 (i18n styles)Nikolay Yakimov1-27/+6
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-06Docx Reader: Remove header class properly in other langsJesse Rosenthal1-4/+4
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.
2014-09-05Docx reader: Use polyglot header list.Jesse Rosenthal1-7/+7
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.
2014-09-05Docx Reader: Start list of polyglot section headers.Jesse Rosenthal1-0/+7
2014-09-04Docx reader: Rewrite rewriteLink to work with new headers.Jesse Rosenthal1-9/+4
There could be new top-level headers after making lists, so we have to rewrite links after that.
2014-08-28Docx Reader: Read single para in table cell as plainJesse Rosenthal1-1/+12
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).
2014-08-17Docx reader: whitespace fix.Jesse Rosenthal1-6/+6
2014-08-17Docx reader: remove emph styles and strong styles list.Jesse Rosenthal1-6/+0
We no longer need the explicit lists since we're deriving them from the ground up.
2014-08-17Docx reader: Add "Hyperlink" to blacklisted styles.Jesse Rosenthal1-2/+2
This is the only one so far. We'll add others as they show up.
2014-08-17Docx reader: Use style resolver.Jesse Rosenthal1-23/+9
We now no longer check against explicit styles.
2014-08-17Docx Reader: Introduce function for resolving dependent run styles.Jesse Rosenthal1-0/+31
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).
2014-08-17Docx reader: work with new rStyle.Jesse Rosenthal1-4/+4
Just discards info at the moment, so at least it works the same.
2014-08-17Docx reader: Change behavior of Super/SubscriptJesse Rosenthal1-4/+4
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-16Docx reader: Remove unnecessary plural functionsJesse Rosenthal1-11/+5
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.
2014-08-16Docx reader: Fix bug in character styles.Jesse Rosenthal1-2/+2
Style handling has been cleaned up, but introduced a bug here. There wasn't previously a test to catch it.
2014-08-16Rewrite Docx.hs and Reducible to use Builder.Jesse Rosenthal1-226/+193
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 reader: Interpret "Strong" and Emphasis run styles.Jesse Rosenthal1-2/+6
2014-08-12Docx Reader: Trim line breaks from the beginning and end of SectionJesse Rosenthal1-2/+10
Headers. We might also want to do this elsewhere (for pars, for example).
2014-08-12Docx: More robust handling of multiple bookmarks in header.Jesse Rosenthal1-6/+8
2014-08-12Docx reader: Check for null-id'd anchors too.Jesse Rosenthal1-1/+0
Otherwise they get left dangling in the document.
2014-08-12Docx reader: accept explicit "Italic" and "Bold" rStyles.Jesse Rosenthal1-5/+18
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: Add "BlockQuotation" to divs list.Jesse Rosenthal1-1/+1
2014-08-12Docx reader: move combining logic to ReducibleJesse Rosenthal1-3/+1
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-12Docx reader: Make dropcap combining more efficient.Jesse Rosenthal1-1/+3
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.
2014-08-11Docx reader: combine inlines properly in dropcaps.Jesse Rosenthal1-1/+1
Make sure that adjacent inlines are combined properly in dropcaps. This updates the test results as well.
2014-08-11Docx reader: Use dropcap state.Jesse Rosenthal1-9/+17
If we get to a dropcap, we keep hold the inlines until the next paragraph, and combine it there.
2014-08-08OMath parser: Change signature of exported function.Jesse Rosenthal1-5/+4
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-07Merge pull request #1494 from jkr/math-moduleJohn MacFarlane1-219/+27
Math module
2014-08-07Docx reader: Handle inline drawings.Jesse Rosenthal1-0/+7
Previous drawings that were under some other toplevel run (i.e., a hyperlink) wouldn't be properly handled. This should fix that.
2014-08-07Docx reader: Split math out into math module.Jesse Rosenthal1-194/+7
Could use some cleanup, but this is the first step for getting an OMML reader into TeXMath.
2014-08-06Docx Reader: Added Default instances and removed withDStateMatthew Pickering1-28/+23
Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
2014-08-06Get rid of unused docx variable.Jesse Rosenthal1-5/+3
Since changing the Docx type, this is no longer necessary. Thanks to Matthew Pickering for picking up on this.
2014-08-06Docx reader: remove now-unnecessary state variable.Jesse Rosenthal1-4/+2
This also introduces a `defaultDState` value.
2014-08-06Docx reader: Use TeXMath to write mathJesse Rosenthal1-155/+190
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-04Use `stripPrefix` where appropriate.Artyom Kazak1-7/+7
2014-07-31Docx Reader: Single underlines are "emph"Jesse Rosenthal1-1/+2
All other underlines are ignored.
2014-07-31New module, Text.Pandoc.MediaBag.John MacFarlane1-1/+3
Moved `MediaBag` definition and functions from Shared: `lookupMedia`, `mediaDirectory`, `insertMedia`, `extractMediaBag`. Removed `emptyMediaBag`; use `mempty` instead, since `MediaBag` is a Monoid.
2014-07-31Made MediaBag a newtype, and added mime type information to media.John MacFarlane1-2/+2
Shared now exports functions for interacting with a MediaBag: - `emptyMediaBag` - `lookuMedia` - `insertMedia` - `mediaDirectory` - `extractMediaBag`
2014-07-30Docx reader: Make docx reader put image data in MediaBag.Jesse Rosenthal1-32/+25
Image data will not be put in a media bag map, which will be output along with the pandoc output.