aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Docx.hs
AgeCommit message (Collapse)AuthorFilesLines
2018-10-09Docx writer: added framework for custom properties.John MacFarlane1-1/+20
So far, we don't actually write any custom properties, but we have the infrastructure to add this. See #3034.
2018-10-07Docx writer: handle tables in table cells.John MacFarlane1-2/+7
Although this is not documented in the spec, some versions of Word require a 'w:p' element inside every table cell. Thus, we add one when the contents of a cell do not already include one (e.g. when a table cell contains a table). Closes #4953.
2018-10-04Add lookupMeta* functions to Text.Pandoc.Writers.Shared (#4907)Mauro Bieg1-22/+7
Remove exported functions `metaValueToInlines`, `metaValueToString`. Add new exported functions `lookupMetaBool`, `lookupMetaBlocks`, `lookupMetaInlines`, `lookupMetaString`. Use these whenever possible for uniformity in writers. API change (major, because of removed function `metaValueToInlines`. `metaValueToString` wasn't in any released version.)
2018-09-15Docx writer: add MetaString case for abstract, subtitle (#4905)Mauro Bieg1-0/+2
fixes #4900
2018-08-17Docx writer: properly handle display math in spans.John MacFarlane1-4/+6
Closes #4826. This isn't a complete solution, since other nestings of display math may still cause problems, but it should work for what is by far the most common case. Note that this also involves an API change: `isDisplayMath` is now exported from Text.Pandoc.Writers.Shared.
2018-07-02Spellcheck commentsAlexander Krotov1-1/+1
2018-05-14Docx writer: be sensitive to `toc` in YAML metadata.John MacFarlane1-4/+11
Closes #4645.
2018-05-08Support underline in docx writer.John MacFarlane1-0/+3
Updated golden test and confirmed validity of file. Closes #4633.
2018-03-18Removed old-locale flag and Text.Pandoc.Compat.Time.John MacFarlane1-1/+1
This is no longer necessary since we no longer support ghc 7.8.
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-03-17hlint fixes.John MacFarlane1-3/+3
2018-03-08Fixed formatting of DefaultStyle ordered lists in docx writer.John MacFarlane1-6/+6
We want decimal for the top level, not lower roman.
2018-02-23Docx writer: trim trailing whitespace.Jesse Rosenthal1-14/+14
2018-02-23Docx writer: fix #3930laptop1\Andrew1-84/+100
Fixes an issuue regarding image sizing if the same image is included more than once. Previously, a record was kept, indexed by image source, which would include the XML for that image. For every image element in the document, this record was checked, and if the image was the same as previous examples, the same XML would be included twice. The information in this XML incudes the image description, title text, and size on the page, thus all images from the same source would always be sized the same, and have the same description. This commit fixes this by generating unique XML every time, but keeping the image ID and path if it is the same image.
2018-02-18EMF Image size support (#4375)Andrew Pritchard1-0/+1
2018-01-27Docx writer: make more deterministic to facilitate testingJesse Rosenthal1-10/+16
This will allow us to compare files directly in a golden test. Times are still based on IO, but we will be able to safely skip those. Changes: - `getUniqueId` now calls to the state to get an incremented digit, instead of calling to P.uniqueHash. - we always start the PRNG in mkNumbering/mkAbstractNum with the same seed (1848), so our randoms should be the same each time.
2018-01-27Docx writer: Fix ids in comment writingJesse Rosenthal1-9/+17
Comments from `--track-changes=all` were producing corrupt docx, because the writer was trying to get id from the `(ID,_,_)` field of the attributes, and ignoring the "id" entry in the key-value pairs. We now check both. There is a larger conversation to be had about the right way to treat "id" and "class" entries in kvs, but this fix will correctly interpret the output of the docx reader work.
2018-01-25Dock writer: Fix deletion track changesJesse Rosenthal1-6/+6
This had been mistakenly written as a second insertion function. Closes: #4303
2018-01-19hlint code improvements.John MacFarlane1-8/+5
2018-01-12Move `metaValueToInlines` to T.P.W.SharedJesse Rosenthal1-11/+1
This will allow the Powerpoint writer to use it as well.
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2018-01-02Merge pull request #4219 from stalmon/masterJohn MacFarlane1-4/+2
fixes for docx writer
2018-01-02firstRow table definition compatibility for Word 2016Sebastian Talmon1-1/+1
Word 2016 seems to use a default value of "1" for table headers, if there is no firstRow definition (although a default value of 0 is documented), so all tables get the first Row formatted as header. Setting the parameter to 0 if the table has no header row fixes this for Word 2016
2018-01-01Docx writer: Fix custom styles with spaces in the name.John MacFarlane1-1/+1
Custom styles with spaces worked for divs but not for spans. This commit fixes the problem. Closes #3290.
2018-01-02Removed redundant subtitle in titlestalmon1-3/+1
subtitle is allready used to create a subtitle for the document appending the subtitle to the main title leads to double subtitle in the document
2017-12-21Docx writer: ensure that `distArchive` is the one that comes with pandoc.John MacFarlane1-2/+6
Previously a `reference.docx` in `~/.pandoc` (or the user data dir) would be used instead, and this could cause problems because a user-modified docx sometimes lacks vital sections that we count on the `distArchive` to supply. Closes #4182.
2017-12-11Remove redundant imports from Docx writer.Jesse Rosenthal1-3/+0
These were a result of moving functions to the OOXML module.
2017-12-11Create shared OOXML writer file.Jesse Rosenthal1-33/+1
This is for functions used by both Powerpoint and Docx writers.
2017-12-10Changes for skylighting-0.5.John MacFarlane1-3/+3
This fixes a bug in 2.0.4, whereby pandoc could not read the theme files generated with `--print-highlight-style`. It also fixes some CSS issues involving line numbers. Highlighted code blocks are now enclosed in a div with class sourceCode. Highlighting CSS no longer sets a generic color for pre and code; we only set these for class `sourceCode`. This will close #4133 and #4128.
2017-12-04Add `empty_paragraphs` extension.John MacFarlane1-13/+16
* Deprecate `--strip-empty-paragraphs` option. Instead we now use an `empty_paragraphs` extension that can be enabled on the reader or writer. By default, disabled. * Add `Ext_empty_paragraphs` constructor to `Extension`. * Revert "Docx reader: don't strip out empty paragraphs." This reverts commit d6c58eb836f033a48955796de4d9ffb3b30e297b. * Implement `empty_paragraphs` extension in docx reader and writer, opendocument writer, html reader and writer. * Add tests for `empty_paragraphs` extension.
2017-12-02Docx writer: allow empty paragraphs.John MacFarlane1-2/+0
See #2252. This also changes fixDisplayMath from Text.Pandoc.Writers.Shared so that it no longer produces empty Para as an artifact. (That was the original reason the writer omitted them.)
2017-10-29hlint suggestions.John MacFarlane1-114/+114
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-5/+5
2017-10-10docx writer - activate evenAndOddHeaders from reference docAgustín Martín Barbero1-0/+1
Fixes #3901 by checking for the evenAndOddHeaders mark in the reference doc, and copying it to the resulting docx if present.
2017-09-30Removed writerSourceURL, add source URL to common state.John MacFarlane1-1/+1
Removed `writerSourceURL` from `WriterOptions` (API change). Added `stSourceURL` to `CommonState`. It is set automatically by `setInputFiles`. Text.Pandoc.Class now exports `setInputFiles`, `setOutputFile`. The type of `getInputFiles` has changed; it now returns `[FilePath]` instead of `Maybe [FilePath]`. Functions in Class that formerly took the source URL as a parameter now have one fewer parameter (`fetchItem`, `downloadOrRead`, `setMediaResource`, `fillMediaBag`). Removed `WriterOptions` parameter from `makeSelfContained` in `SelfContained`.
2017-08-15Docx writer: fixed a regression (infinite loop on certain lists).John MacFarlane1-2/+2
Bug was introduced by commit a868b238f253423281b2648896f184e7cdc05014.
2017-08-12Docx writer: pass through comments.John MacFarlane1-8/+47
We assume that comments are defined as parsed by the docx reader: I want <span class="comment-start" id="0" author="Jesse Rosenthal" date="2016-05-09T16:13:00Z">I left a comment.</span>some text to have a comment <span class="comment-end" id="0"></span>on it. We assume also that the id attributes are unique and properly matched between comment-start and comment-end. Closes #2994.
2017-08-11Added support for translations (localization) (see #3559).John MacFarlane1-2/+2
* readDataFile, readDefaultDataFile, getReferenceDocx, getReferenceODT have been removed from Shared and moved into Class. They are now defined in terms of PandocMonad primitives, rather than being primitve methods of the class. * toLang has been moved from BCP47 to Class. * NoTranslation and CouldNotLoudTranslations have been added to LogMessage. * New module, Text.Pandoc.Translations, exporting Term, Translations, readTranslations. * New functions in Class: translateTerm, setTranslations. Note that nothing is loaded from data files until translateTerm is used; setTranslation just sets the language to be used. * Added two translation data files in data/translations. * LaTeX reader: Support `\setmainlanguage` or `\setdefaultlanguage` (polyglossia) and `\figurename`.
2017-08-10Remove writerUserDataDir from WriterOptions.John MacFarlane1-1/+0
It is now carried in CommonState in PandocMonad instances. (And thus it can be used by readers too.)
2017-08-10Removed datadir param from readDataFile and getDefaultTemplate.John MacFarlane1-1/+1
In Text.Pandoc.Class and Text.Pandoc.Template, resp. We now get the datadir from CommonState.
2017-08-10Expose getDefaultDataFile in both Shared and Class.John MacFarlane1-1/+1
2017-06-27Docx writer: Allow 9 list levels.John MacFarlane1-3/+9
Closes #3519.
2017-06-25BCP47: split toLang from getLang, rearranged types.John MacFarlane1-3/+3
2017-06-25Moved BCP47 specific functions from Writers.Shared to new module.John MacFarlane1-1/+2
Text.Pandoc.BCP47 (unexported, internal module). `getLang`, `Lang(..)`, `parseBCP47`.
2017-06-25Writers.Shared: refactored getLang, splitLang...John MacFarlane1-3/+5
into `Lang(..)`, `getLang`, `parceBCP47`.
2017-06-25Support `lang` attribute in OpenDocument and ODT writers.John MacFarlane1-5/+2
This adds the required attributes to the temporary styles, and also replaces existing language attributes in styles.xml. Support for lang attributes on Div and Span has also been added. Closes #1667.
2017-06-17Use Control.Monad.State.Strict throughout.John MacFarlane1-1/+1
This gives 20-30% speedup and reduction of memory usage in most of the writers.
2017-06-02Fixed keywords in docx writer.John MacFarlane1-1/+6
(See #3719)
2017-06-02Add keywords metadata to docx document propertiesIan1-0/+1
Hi, I don't know haskell so possibly this is wrong, but DOCX stores keywords in cp:keywords in core.xml, and this should be easy to add from the pandoc metadata (I copy and paste the author code). As far as I can tell (no clear documentation, just a few refs), keywords should be separated with a comma.
2017-05-25Docx writer: Use Table rather than "Table Normal" for table style.John MacFarlane1-1/+1
"Table Normal" is the default table style and can't be modified. Closes #3275, further testing welcome.