aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Docx.hs
AgeCommit message (Collapse)AuthorFilesLines
2014-06-19Docx writer: Use Compact style for empty table cells.John MacFarlane1-1/+3
Otherwise we get overly tall lines when there are empty table cells and the other cells are compact. Closes #1353.
2014-06-03Docx writer: Section numbering carries over from reference.docx.John MacFarlane1-1/+6
Closes #1305.
2014-06-03Docx writer: Combine reference.docx numbering with pandoc's.John MacFarlane1-6/+6
This should have fixed #1305, allowing the reference.docx to define section numbering, but it doesn't. Now the headings appear with proper indentation, but the numbers don't appear. Unclear why. styles.xml and numbering.xml basically match the docx which has the expected result.
2014-06-03Docx writer: pandoc uses only numIds >= 1000 for lists.John MacFarlane1-3/+8
This opens up the possiblity (with further code changes) of preserving some numbering from the reference.docx (e.g. header numbering.) See #1305.
2014-06-03Docx writer: Changed abstractNumId numbering scheme.John MacFarlane1-3/+3
Now the minimum id used by pandoc is 990. All ids start with "99". This gives some room for a reference.docx to define numbering styles. Note: this is not yet possible, since pandoc generates numbering.xml entirely on its own.
2014-06-03Docx writer: Simplified abstractNumId numbering.John MacFarlane1-19/+30
Instead of sequential numbering, we assign numbers based on the list marker styles. This simplifies some of the code and should make it easier to modify numbering in the future.
2014-06-02Docx writer: Create overrides per-image for media/ in ref docx.John MacFarlane1-13/+8
This should be somewhat more robust and cover more types of images.
2014-06-02Docx writer: Improved entryFromArchive to avoid parse.John MacFarlane1-2/+3
No need to parse the XML if we're just going to render it right away!
2014-06-02Docx writer: Make images work in reference.docx headers/footers.John MacFarlane1-8/+20
* All media from reference.docx are copied into result. * Added defaults for common image types to [Content Types]. * Avoided redundant XML parse + write for entries taken over from reference.docx, for better performance.
2014-06-01Docx writer: Improved handling of headers/footers.John MacFarlane1-52/+53
2014-06-01Docx writer: Header and footer are now carried over from reference.docx.John MacFarlane1-16/+38
2014-06-01Minor code reformat.John MacFarlane1-5/+5
2014-05-31Docx writer: Take over document formatting from reference.docx.John MacFarlane1-17/+30
This includes margins, page size, page orientation.
2014-05-09Update copyright notices for 2014, add missing noticesAlbert Krewinkel1-2/+2
2014-05-04Docx writer: Fall back on distribution reference.docx.John MacFarlane1-14/+15
* Undid changes to parseXml in last commit. * Instead of a string fallback, we have parseXml fall back on the reference.docx that comes with pandoc if the user's reference.docx does not contain a needed file. * Closes #1185.
2014-05-04Docx writer: Added ability to give fallback in parseXml.John MacFarlane1-16/+17
2014-01-07Fixed small regression in docx writer.John MacFarlane1-3/+6
2014-01-02Moved fixDisplayMath from Docx writer to Writer.Shared.John MacFarlane1-25/+2
2014-01-01Docx writer: Fixed problem with some modified reference docx files.John MacFarlane1-2/+7
Include `word/_rels/settings.xml.rels` if it exists, as well as other `rels` files besides the ones pandoc generates explicitly.
2013-12-19HLint: use fromMaybeHenry de Valence1-2/+4
Replace uses of `maybe x id` with `fromMaybe x`.
2013-11-23Docx writer: Implemented csl flipflopping spans.John MacFarlane1-1/+6
2013-11-19Docx writer: Use mime type info returned by fetchItem.John MacFarlane1-11/+13
2013-11-07Docx writer: fixed core metadata.John MacFarlane1-4/+5
- Don't create empty date nodes if no date given. - Don't create multiple dc:creator nodes; instead separate by semicolons. Closes #1046.
2013-11-06Docx writer: Fix URL for core-properties in `_rels/.rels`.John MacFarlane1-1/+1
Partially addresses #1046.
2013-11-01TexMath: Export readTeXMath', which attends to display/inline.John MacFarlane1-1/+1
Deprecate readTeXMath, and use readTeXMath' in all the writers. Require texmath >= 0.6.5.
2013-09-19DOCX writer: Add missing settings.xml to the zip container.John MacFarlane1-1/+3
Closes #990.
2013-08-11Options: Changed `writerSourceDir` to `writerSourceURL` (now a Maybe).John MacFarlane1-2/+1
Previously we used to store the directory of the first input file, even if it was local, and used this as a base directory for finding images in ODT, EPUB, Docx, and PDF. This has been confusing to many users. It seems better to look for images relative to the current working directory, even if the first file argument is in another directory. writerSourceURL is set to 'Just url' when the first command-line argument is an absolute URL. (So, relative links will be resolved in relation to the first page.) Otherwise, 'Nothing'. The ODT, EPUB, Docx, and PDF writers have been modified accordingly. Note that this change may break some existing workflows. If you have been assuming that relative links will be interpreted relative to the directory of the first file argument, you'll need to make that the current directory before running pandoc. Closes #942.
2013-08-10Use walk, walkM in place of bottomUp, bottomUpM when possible.John MacFarlane1-5/+6
They are significantly faster.
2013-08-10Adjustments for new Format newtype.John MacFarlane1-5/+5
2013-08-08Preliminary support for new Div and Span elements in writers.John MacFarlane1-0/+2
Currently these are "transparent" containers, except in HTML, where they produce div and span elements with attributes.
2013-08-08Added Text.Pandoc.Compat.Monoid.John MacFarlane1-1/+1
This allows pandoc to compile with base < 4.5, where Data.Monoid doesn't export `<>`. Thanks to Dirk Ullirch for the patch.
2013-07-18Improved fetching of external resources.John MacFarlane1-1/+1
* In Shared, openURL and fetchItem now return an Either, for better error handling. (API change.) * Better error message when fetching a URL fails with `--self-contained`. * EPUB writer: If resource not found, skip it, as in Docx writer. * Closes #916.
2013-07-16Text.Pandoc.ImageSize: Handle EPS.John MacFarlane1-0/+1
Closes #903. This change will make EPS images properly sized on conversion to Word.
2013-07-13Docx writer: Make `--no-highlight` work properly.John MacFarlane1-7/+11
2013-07-12Docx writer: Ignore most components of reference.docx.John MacFarlane1-24/+41
We take the word/styles.xml, docProps/app.xml, word/theme/theme1.xml, and word/fontTable.xml from reference.docx, ignoring everything else. Perhaps this will help with the corruption problems caused when different versions of Word resave the reference.docx and reorganize things.
2013-07-04Docx writer: Use w:br with w:type 'textWrapping' for linebreaks.John MacFarlane1-1/+1
Previously we used w:cr. I don't see a difference between these in my version of Word, but apparently some do. Closes #873.
2013-06-24Use new flexible metadata type.John MacFarlane1-7/+12
* Depend on pandoc 1.12. * Added yaml dependency. * `Text.Pandoc.XML`: Removed `stripTags`. (API change.) * `Text.Pandoc.Shared`: Added `metaToJSON`. This will be used in writers to create a JSON object for use in the templates from the pandoc metadata. * Revised readers and writers to use the new Meta type. * `Text.Pandoc.Options`: Added `Ext_yaml_title_block`. * Markdown reader: Added support for YAML metadata block. Note that it must come at the beginning of the document. * `Text.Pandoc.Parsing.ParserState`: Replace `stateTitle`, `stateAuthors`, `stateDate` with `stateMeta`. * RST reader: Improved metadata. Treat initial field list as metadata when standalone specified. Previously ALL fields "title", "author", "date" in field lists were treated as metadata, even if not at the beginning. Use `subtitle` metadata field for subtitle. * `Text.Pandoc.Templates`: Export `renderTemplate'` that takes a string instead of a compiled template.. * OPML template: Use 'for' loop for authors. * Org template: '#+TITLE:' is inserted before the title. Previously the writer did this.
2013-03-30Docx writer: Use Compact style for Plain block elements.John MacFarlane1-2/+8
This differentiates between tight and loose lists. Closes #775.
2013-03-18Docx writer: Fixed rendering of display math in lists.John MacFarlane1-13/+27
In 1.11 and 1.11.1, display math in lists rendered as a new list item. Now it always appears centered, just as outside of lists, and in proper display math style, no matter how far indented the containing list item is. Closes #784.
2013-02-26Docx writer: Better treatment of display math.John MacFarlane1-13/+19
Display math inside a paragraph is now put in a separate paragraph, so it will render properly (centered and without extra blank lines around it). Partially addresses #742.
2013-02-26Changed style names in reference docx.John MacFarlane1-4/+4
FootnoteReference -> FootnoteRef. Hyperlink -> Link. Why? Because the old names got changed by Word when the reference.docx was edited. I don't understand why, but this fixes things. Closes #414.
2013-02-26Docx writer: Create content types and document rels from scratch.John MacFarlane1-15/+79
This fixes problems that arise when you edit the reference.docx with Word. Word tends to remove things from the `[Content_Types].xml` and `word/_rels/document.xml.rels` files that are needed (e.g. references to the `footnotes.xml` file and image default mime types). So we regenerate these completely rather than taking them from the `reference.docx`. We also now encode mime types for each individual image rather than using defaults. This should allow us to handle a wider range of image types. This mostly addresses #414. The only remaining issue I can see is the issue of style IDs, which Word inexplicably changes in some cases when the reference.docx is saved. E.g. `FootnoteReference` becomes `FootnoteReference1`.
2013-02-25Refactoring in Docx writer.John MacFarlane1-24/+44
2013-02-23Docx writer: Handle PDF images.John MacFarlane1-0/+1
2013-01-15Use 'fig:' instead of '\SOH' in title to indicate figure.John MacFarlane1-2/+2
Revises 1a4b47e93368bfbd31daccdfedbd9527ee740201
2013-01-14Implemented Ext_implicit_figures.John MacFarlane1-2/+3
* In markdown reader, add a '\1' character to the beginning of the title of an image that is alone in its paragraph, if implicit_figures extension is selected. * In writers, check for Para [Image alt (src,'\1':tit)] and treat it as a figure if possible. * Updated tests. This is a bit of a hack, but it allows us to make implicit_figures an extension of the markdown reader, rather than the writers.
2013-01-11Refactoring:John MacFarlane1-8/+2
* Shared now exports fetchItem (instead of getItem) and openURL * fetchItem has different parameters than getItem and includes some logic formerly in the ODT and Docx writers * getItem still used in SelfContained
2013-01-11ODT, Docx writers: Properly handle URL refs for images.John MacFarlane1-2/+9
These images are now downloaded instead of being ignored (as used to happen in the docx reader) or causing an error (as used to happen in the odt reader).
2013-01-11Improvements to docx writer.John MacFarlane1-65/+63
Avoid reading image files again when we've already processed them.
2013-01-11Docx writer: Preliminary improvements.John MacFarlane1-18/+23
* Use getItem to fetch images, so we can get them over the net if they have absolute URLs. * Added TODO notes for cleaning up the logic.