aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Docx.hs
AgeCommit message (Collapse)AuthorFilesLines
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.
2013-01-09Added Attr field to Header.John MacFarlane1-2/+4
Previously header ids were autogenerated by the writers. Now they are generated (unless supplied explicitly) in the markdown parser, if the `header_identifiers` extension is selected. In addition, the textile reader now supports id attributes on headers.
2013-01-06Docx writer: Use rIdNN identifiers for r:embed in images.John MacFarlane1-1/+1
2013-01-06Docx writer: Use separate footnotes.xml for notes.John MacFarlane1-21/+32
This seems to help LibreOffice convert the file, even though it was valid docx before. Note that the references in notes must be in word/_rels/footnotes.xml.rel. We handle this now by simply making that file contain all the references in word/_rels/document.xml.rel. Something better could be done eventually, but this works. Closes #637.
2012-12-29Data files changes.John MacFarlane1-11/+2
* Added `embed_data_files` flag. (not yet used) * Shared no longer exports `findDataFile`. * `readDataFile` now returns a strict bytestring. * Shared now exports `readDataFileUTF8` which returns a string like the old `readDataFile`. * Rewrote modules to use new data file functions and to avoid using functions from Paths_pandoc directly.
2012-10-02Docx writer: Added nsid to abstractNum elements.John MacFarlane1-11/+16
This helps when merging word documents with numbered or bulleted lists. Closes #627.
2012-10-02Use integer ids for bookmarks.John MacFarlane1-6/+8
Closes #626.
2012-09-25Removed need for utf8-string package.John MacFarlane1-11/+10
* Depend on text. * Expose Text.Pandoc.UTF8. * Text.Pandoc.UTF8 now exports toString, fromString, toStringLazy, fromStringLazy. * These are used instead of the old utf8-string functions.
2012-09-23Revert "More intelligent handling of text encodings."John MacFarlane1-2/+3
This reverts commit 7272735b3d413a644fd9ab01eeae8ae9cd5a925b.
2012-09-23More intelligent handling of text encodings.John MacFarlane1-3/+2
Previously, UTF-8 was enforced for both input and output. The new system: * For input, UTF-8 is tried first; if an error is raised, the locale encoding is tried. * For output, the locale encoding is always used.
2012-09-05Docx writer: Fixed bug with nested lists.John MacFarlane1-20/+19
Previously a list like 1. one - a - b 2. two would come out with a bullet instead of "2." Thanks to Russell Allen for reporting the bug.
2012-08-17Docx line breaks: Use w:cr in w:r instead of w:br.John MacFarlane1-5/+6
This seems to fix a problem viewing pandoc-generated docx files in LibreOffice.
2012-07-26Moved WriterOptions and associated types Shared -> Options.John MacFarlane1-0/+1
2012-07-24Changed signatures of writeODT, writeDocx, writeEPUB.John MacFarlane1-4/+3
These now take WriterOptions and Pandoc only. The extra parameters for epub stylesheet, epub fonts, reference Docx, and reference ODT have been removed, since these things are now in WriterOptions. Note: breaking API change!
2012-06-01Simplified bullet characters so they work with Word 2007.John MacFarlane1-7/+7
Closes #520.
2012-04-21Docx writer: Fixed error message when style file can't be parsed.John MacFarlane1-1/+2
2012-04-07Docx writer: Fixed multi-paragraph list items.John MacFarlane1-1/+4
Previously they each got a list marker. Closes #457.
2012-02-14Add TableNormal style to tables.John MacFarlane1-2/+3
Needs testing with Word.
2012-02-11Fix _rels/.rels if it has been screwed up by Word.John MacFarlane1-1/+10
Closes #414. Previously, if you edited the reference.docx with Word, then created a new docx using the edited reference.docx, Word would complain about the file being corrupt. The problem seems to be that Word changes _rels/.rels, changing the Type of the Relationship to docProps/core.xml from "http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties" to "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties". As far as I can see, this is a bug in Word, since the latter is not valid. (See http://idippedut.dk/post/2010/04/22/Correct-according-to-spec-or-implementation.aspx.) This change simply does a global replace on _rels/.rels that reverts the change Word makes. And now producing docx files with Word-modified reference.docx seems to work.
2012-01-28Remove dependency on old-time.John MacFarlane1-2/+2
2012-01-28Put date in YYYY-MM-DD format if possible for HTML, docx metadata.John MacFarlane1-3/+4
Added normalizeDate to Text.Pandoc.Shared.
2012-01-20Docx: Put display math on separate line.John MacFarlane1-5/+9
2012-01-20Docx writer: Fixed styles in footnotes.John MacFarlane1-0/+6
Previously a footnote in a list item would be a list item, etc.!
2012-01-20Docx: Adjusted list spacing for less cramped number markers.John MacFarlane1-1/+1
2012-01-20Docx writer: Start bullet lists with solid bullet.John MacFarlane1-6/+7