aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Docx.hs
AgeCommit message (Collapse)AuthorFilesLines
2014-07-29Docx reader: Make metavalues out of styled paragraphs.Jesse Rosenthal1-11/+73
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.
2014-07-16Docx Reader: Fix hdr auto-id when already auto-id.Jesse Rosenthal1-11/+19
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.
2014-07-16Docx Reader: Change state handling.Jesse Rosenthal1-16/+12
We don't need `updateDState` -- the built-in `modify` works just fine. And we redefine `withDState` to use modify.
2014-07-12Removed space at ends of lines in source.John MacFarlane1-9/+9
2014-07-12Docx Reader: A nicer Docx type.Jesse Rosenthal1-66/+42
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.
2014-07-02Docx Reader: Write LaTeX based on equations in word.Jesse Rosenthal1-4/+172
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.
2014-06-30Docx reader: clean up parStyle processing.Jesse Rosenthal1-45/+36
This gets rid of `divAttrToContainers`: an internal convenience function which had become pretty inconvenient. Rather than converting classes and indentations to string lists and back, we deal with the `pPr` attribute directly.
2014-06-29Merge pull request #1386 from jkr/hanging_indentJohn MacFarlane1-10/+25
Fix hanging indent behavior
2014-06-29Docx reader: Make use of new ParIndentation info.Jesse Rosenthal1-10/+25
Here, when hanging indents are greater than or equal to left indents, we don't set it to block quote. Such indents are frequently used in academic bibliographies. (Thanks to Caleb McDaniel.)
2014-06-29Docx Reader: Update state properlyJesse Rosenthal1-3/+8
Previously, a fresh state was created for the purpose of updating. In the future, when there is more than one field in the state, this obviously won't work.
2014-06-28Docx Reader: All headers get auto id.Jesse Rosenthal1-1/+10
Previously, only those with an anchor got an auto id. Now, all do, which puts it in line with pandoc's markdown extension.
2014-06-28Docx Reader: Introduce link rewriting.Jesse Rosenthal1-7/+30
2014-06-28make makeHeaderAnchors make an auto idJesse Rosenthal1-3/+7
Record relationship between original id and auto id, so we can fix links after.
2014-06-28Rewrote header generation.Jesse Rosenthal1-25/+25
In preparation for auto ids.
2014-06-28Docx Reader: Simplify makeHeaderAnchorsJesse Rosenthal1-8/+5
Using pattern guard, in preparation for doing some more complicated stuff with it (recording header anchors, so we can change them to auto ids.)
2014-06-28Docx Reader: Clean up guardsJesse Rosenthal1-9/+9
Use PatternGuards to get rid of need for `isJust`, `fromJust` altogether.
2014-06-28Docx rdr: Avoid mapping makeHeaderAnchors globallyJesse Rosenthal1-4/+4
It only applies to headers, so we can just apply it when we make a header.
2014-06-28Move Docx reader to DocxContext monadJesse Rosenthal1-107/+140
This is a ReaderT State stack, which keeps track of some environment info, such as the options and the docx doc. The state will come in handy in the future, for a couple of planned features (rewriting the section anchors as auto_idents, and hopefully smart-quoting).
2014-06-25Docx reader: Make use of track-changes option.Jesse Rosenthal1-3/+16
2014-06-25Docx reader: Add rudimentary track changes support.Jesse Rosenthal1-0/+3
This will only read the insertions, and ignore the deletions.
2014-06-24Docx reader: Ignore zero (or negative) indentJesse Rosenthal1-5/+8
If a block has an indentation less than or equal to zero, it should not be treated as a block quote.
2014-06-24Docx reader: remove T.P.Generic import.Jesse Rosenthal1-1/+0
This marks the removal of the final tree-walk in the code. (Though there is still one in the Lists module.)
2014-06-24Docx reader: pass definition test.Jesse Rosenthal1-8/+13
This commit also fixes a problem with the previous code pushes, which wouldn't allow code blocks to share a div.
2014-06-24Docx reader: pass code tests.Jesse Rosenthal1-33/+47
2014-06-23Use Reducible in docx reader.Jesse Rosenthal1-273/+111
This cleans up them implementation, and cuts down on tree-walking. Anecdotally, I've seen about a 3-fold speedup.
2014-06-22Docx reader: Fix spacing in formatting.Jesse Rosenthal1-1/+1
The normalizing tests revealed a problem with unformatted spaces, brought about by `spanTrim`. This fixes by not trimming the spaces out of spans until they are in their final form.
2014-06-22Implement new normalization.Jesse Rosenthal1-11/+57
There were some problems with the old str normalization. This fixes those problems. Also, since it drills down on its own, it only needs to be mapped over the blocks, not walked over the tree.
2014-06-20Make strNormalize go bottomUp.Jesse Rosenthal1-5/+5
This was how it used to be before it was folded into blockNormalize.
2014-06-20Docx reader: Add a comment explaining strNormalizeJesse Rosenthal1-0/+4
`normalize` from Text.Pandoc.Shared is more general. In tests, though, it more than doubles the run time. `strNormalize` does less, but it does what we need. This comment is added for future maintainability.
2014-06-20Docx Reader: Normalize DefinitionListsJesse Rosenthal1-0/+2
Previously DefinitionList had been left out of `blockNormalize`. Now it is included.
2014-06-20Docx reader: simplify blockNormalizeJesse Rosenthal1-10/+8
Use a function `stripSpaces`, instead of recursion. Makes it a bit easier to read and mantain, and simplify normalizing DefinitionList, which was left out the first time.
2014-06-20Docx reader: Fix hdr handling in block normJesse Rosenthal1-0/+2
`blockNormalize` previously forgot to account for the case in which a Header's inlines did not start with a space.
2014-06-19Introduce blockNormalizeJesse Rosenthal1-1/+14
This will help take care of spaces introduced at the beginning of strings.
2014-06-19Have Docx reader properly interpret tabs.Jesse Rosenthal1-0/+2
2014-06-16Fixed compiler warning.John MacFarlane1-1/+3
2014-06-16Naming: Use Docx instead of DocX.John MacFarlane1-0/+479
For consistency with the existing writer.