summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Docx
Commit message (Collapse)AuthorAge
* Docx reader: Handle nested sdt tags.Jesse Rosenthal2018-02-28
| | | | | | | Previously we had only unwrapped one level of sdt tags. Now we recurse if we find them. Closes: #4415
* Docx reader: Use already imported operatorJesse Rosenthal2018-01-20
| | | | This fixes an import error in the last commit.
* Docx reader: small change to Fields hyperlink parserJesse Rosenthal2018-01-20
| | | | | | Previously, unquoted string required a space at the end of the line (and consumed it). Now we either take a space (and don't consume it), or end of input.
* hlint code improvements.John MacFarlane2018-01-19
|
* Docx reader: Parse instrText info in fldChar tags.Jesse Rosenthal2018-01-16
| | | | | | We introduce a new module, Text.Pandoc.Readers.Docx.Fields which contains a simple parsec parser. At the moment, only simple hyperlink fields are accepted, but that can be extended in the future.
* Docx reader: Parse fldChar tagsJesse Rosenthal2018-01-16
| | | | This will allow us to parse instrTxt inside fldChar tags.
* Update copyright notices to include 2018Albert Krewinkel2018-01-05
|
* Docx reader: Parse track changes info into paragraph props.Jesse Rosenthal2018-01-02
| | | | | | This will tell us whether a paragraph break was inserted or deleted. We add a generalized track-changes parsing function, and use it in `elemToParPart` as well.
* Docx reader: Extract tracked changes type from parpart.Jesse Rosenthal2018-01-02
| | | | | We're going to want to use it elsewhere as well, in upcoming tracking of paragraph insertion/deletion.
* Docx reader: Read multiple children of w:sdtContents`Jesse Rosenthal2017-12-30
| | | | | | | | Previously we had only read the first child of an sdtContents tag. Now we replace sdt with all children of the sdtContents tag. This changes the expected test result of our nested_anchors test, since now we read docx's generated TOCs.
* Docx Reader: preprocess Document body to unwrap "w:sdt" elementsJesse Rosenthal2017-12-27
| | | | | | | | | | We walk through the document (using the zipper in Text.XML.Light.Cursor) to unwrap the sdt tags before doing the rest of the parsing of the document. Note that the function is generically named `walkDocument` in case we need to do any further preprocessing in the future. Closes #4190
* Source code reformatting.John MacFarlane2017-10-29
|
* Fix warning for older GHC versions.John MacFarlane2017-10-28
|
* hlint suggestions.John MacFarlane2017-10-27
|
* hlint changes.John MacFarlane2017-10-27
|
* Docx reader: Avoid 0-level headers.Jesse Rosenthal2017-08-06
| | | | | | | | | | We used to parse paragraphs styled with "HeadingN" as "nth-level header." But if a document has a custom style named "Heading0", this will produce a 0-level header, which shouldn't exist. We only parse this style if N>0. Otherwise we treat it as a normal style name, and follow its dependencies, if any. Closes #3830.
* Use Control.Monad.State.Strict throughout.John MacFarlane2017-06-17
| | | | | This gives 20-30% speedup and reduction of memory usage in most of the writers.
* Update dates in copyright noticesAlbert Krewinkel2017-05-13
| | | | | This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
* Stylish-haskell automatic formatting changes.John MacFarlane2017-03-04
|
* Docx reader: handle local namespace declarations.John MacFarlane2017-02-03
| | | | | | | | | | | Previously we didn't recognize math, for example, when the xmlns declaration occured on the element and not the root. Now we recognize either. Closes #3365. This patch defines findChildByName, findChildrenByName, and findAttrByName in Util, and uses these in Parse.
* Docx reader: Don't drop smartTag contents.John MacFarlane2017-02-03
| | | | | | | | | This just parses inside smartTags and yields their contents, ignoring the attributes of the smartTag. @jkr, you may want to adjust this, but I wanted to get a fix in as fast as possible for the dropped content. Closes #2242; see also #3412.
* Deleted whitespace at end of source lines.John MacFarlane2017-01-25
|
* Use new module from texmath to lookup MS font codepoints.John MacFarlane2016-11-30
| | | | | | | | + Removed Text.Pandoc.Readers.Docx.Fonts + Moved its code to texmath; we now use (from texmath 0.9) Text.TeXMath.Unicode.Fonts + Use texmath 0.9 (currently from git). + Updated epub tests because texmath now handles more mathml.
* Docx reader: add a placeholder value for CHART.Jesse Rosenthal2016-11-10
| | | | | | We wrap `[CHART]` in a `<span class="chart">`. Note that it maps to inlines because, in docx, anything in a drawing tag can be part of a larger paragraph.
* Docx reader: Be more specific in parsing imagesJesse Rosenthal2016-11-10
| | | | | | | We not only want "w:drawing", because that could also include charts. Now we specify "w:drawing"//"pic:pic". This shouldn't change behavior at all, but it's a first step toward allowing other sorts of drawing data as well.
* Docx Reader: abstract out function to avoid code repetition.Jesse Rosenthal2016-11-02
|
* Docx reader: Handle Alt text and titles in images.Jesse Rosenthal2016-11-02
| | | | | | We use the "description" field as alt text and the "title" field as title. These can be accessed through the "Format Picture" dialog in Word.
* Docx reader utils: handle empty namespace in elemNameJesse Rosenthal2016-11-02
| | | | | | | | | | Previously, if given an empty namespace: (elemName ns "" "foo") `elemName` would output a QName with a `Just ""` namespace. This is never what we want. Now we output a `Nothing`. If someone *does* want a `Just ""` in the namespace, they can enter the QName value explicitly.
* Basic support for images in ODT documentsHubert Plociniczak2016-10-12
| | | | | Highly influenced by the docx support, refactored some code to avoid DRY.
* Remove Text.Pandoc.Compat.ExceptJesse Rosenthal2016-09-02
|
* Docx reader: update copyright.Jesse Rosenthal2016-08-28
|
* StyleMap: export functions on StyleMap instancesJesse Rosenthal2016-08-15
| | | | We're going to want `getMap` in the Docx Writer.
* Docx parser: Use xml convenience functionsJesse Rosenthal2016-08-13
| | | | | | The functions `isElem` and `elemName` (defined in Docx/Util.hs) make the code a lot cleaner than the original XML.Light functions, but they had been used inconsistently. This puts them in wherever applicable.
* Docx reader: add simple comment functionality.Jesse Rosenthal2016-06-23
| | | | | | | | | | | | | This adds simple track-changes comment parsing to the docx reader. It is turned on with `--track-changes=all`. All comments are converted to inlines, which can list some information. In the future a warning will be added for comments with formatting that seems like it will be excessively denatured. Note that comments can extend across blocks. For that reason there are two spans: `comment-start` and `comment-end`. `comment-start` will contain the comment. `comment-end` will always be empty. The two will be associated by a numeric id.
* Docx Reader: parse `moveTo` and `moveFrom`Jesse Rosenthal2016-04-15
| | | | | | | | `moveTo` and `moveFrom` are track-changes tags that are used when a block of text is moved in the document. We now recognize these tags and treat them the same as `insert` and `delete`, respectively. So, `--track-changes=accept` will show the moved version, while `--track-changes=reject` will show the original version.
* Docx reader: Handle alternate contentJesse Rosenthal2016-03-18
| | | | | | | | | | | | Some word functions -- especially graphics -- give various choices for content so there can be backwards compatibility. This follows the largely undocumented feature by working through the choices until we find one that works. Note that we had to split out the processing of child elems of runs into a separate function so we can recurse properly. Any processing of an element *within* a run (other than a plain run) should go into `childElemToRun`.
* Docx reader: Don't make numbered heads into lists.Jesse Rosenthal2016-03-16
| | | | | Word uses list numbering styles to number its headings. We only call something a numbered list if it does not also heave a heading style.
* Docx Reader: Add state to the parser, for warningsJesse Rosenthal2016-03-12
| | | | | | | | In order to be able to collect warnings during parsing, we add a state monad transformer to the D monad. At the moment, this only includes a list of warning strings (nothing currently triggers them, however). We use StateT instead of WriterT to correspond more closely with the warnings behavior in T.P.Parsing.
* Docx Reader: Get rid of Modifiable typeclass.Jesse Rosenthal2016-02-26
| | | | | | | | 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.
* Docx reader: Add a "Link" modifier to ReducibleJesse Rosenthal2016-02-02
| | | | | | | We want to make sure that links have their spaces removed, and are appropriately smushed together. This closes #2689
* Docx reader: image attributesmb212015-12-13
|
* Docx Reader: Remove DummyListItem typeJesse Rosenthal2015-11-23
| | | | | | | | | | | | | Change 5527465c introduced a `DummyListItem` type in Docx/Parse.hs. In retrospect, this seems like it mixes parsing and iterpretation excessively. What's *really* going on is that we have a list item without and associate level or numeric info. We can decide what to do what that in Docx.hs (treat it like a list paragraph), but the parser shouldn't make that decision. This commit makes what is going on a bit more explicit. `LevelInfo` is now a Maybe value in the `ListItem` type. If it's a Nothing, we treat it as a ListParagraph. If it's a Just, it's a normal list item.
* Docx reader: Clean up commented-out functionJesse Rosenthal2015-11-18
| | | | | A residue of a recent change was left around in the form of a commented-out function. Let's clean that up.
* Docx reader: Handle dummy list items.Jesse Rosenthal2015-11-18
| | | | | | | | | | | | 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.
* Follow relationships correctly in foot/endnotes.Jesse Rosenthal2015-11-14
| | | | | | There are separate relationship (link) files for foot and endnotes. These had previously been grouped together which led to links not working correctly in notes. This should finally fix that.
* Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane2015-11-09
| | | | This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
* Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane2015-11-08
| | | | | | | This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
* Use custom Prelude to avoid compiler warnings.John MacFarlane2015-10-14
| | | | | | | | | | | | | - 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.
* Docx Reader: Parse soft, no-break hyphen elementsOphir Lifshitz2015-10-04
|
* Docx Writer: Fix StyleMapNikolay Yakimov2015-03-24
| | | | | 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.