aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Docx.hs
AgeCommit message (Collapse)AuthorFilesLines
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.
2017-05-23Fixed handling of soft hyphen (0173) in docx writer.John MacFarlane1-7/+19
Closes #3691.
2017-05-18Docx writer: Change FigureWithCaption to CaptionedFigure (#3658)Ian1-1/+1
Edit styles.xml as part of the fix for #3656
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-2/+2
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-05-02Added PandocResourceNotFound error.John MacFarlane1-7/+4
Use this instead of PandocIOError when a resource is not found in path. This improves the error message in this case, see #3629.
2017-04-10Docx writer: don't take "distArchive" from datadir.John MacFarlane1-2/+3
The docx writer takes components from the distribution's version of reference.docx when it can't find them in a user's custom reference.docx. (This sometimes happens because Word will sometimes omit components needed for larger documents when saving a simple one.) Previously, we allowed a reference.docx in the data directory (e.g. `~/.pandoc`) to be used as the distribution's reference.docx. This led to a bizarre situation where pandoc would produce a good docx using `--template ~/.pandoc/ref.docx`, but if `ref.docx` were moved to `~/.pandoc/reference.docx`, it would then produce a corrupted docx. Closes #3322 (I think).
2017-03-30Allow dynamic loading of syntax definitions.John MacFarlane1-1/+2
See #3334. * Add writerSyntaxMap to WriterOptions. * Highlighting: added parameter for SyntaxMap to highlight. * Implemented --syntax-definition option. TODO: [ ] Figure out whether we want to have the xml parsing depend on the dtd (it currently does, and fails unless the language.dtd is found in the same directory). [ ] Add an option to read a KDE syntax highlighting theme as a custom style. [ ] Add tests.
2017-03-20docx writer: lang meta, see #1667 (#3515)Mauro Bieg1-1/+24
2017-03-13Highlighting: highlighting now returns an Either rather than Maybe.John MacFarlane1-3/+7
This allows us to display error information returned by the skylighting library. Display a warning if the highlighting library throws an error.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-71/+74
2017-03-03Docx writer: Don't include bookmarks on headers unless non-null id.John MacFarlane1-22/+25
Closes #3476.
2017-02-25Docx writer: use Set for dynamic styles to avoid duplicates.John MacFarlane1-8/+10
2017-02-25Docx writer: bookmarks for Span with id.John MacFarlane1-45/+58
And cleaned up code.
2017-02-25Docx writer bookmark improvements.John MacFarlane1-21/+29
- Bookmark start/end now surrounds content rather than preceding it. - Bookmarks generated for Div with id. Fixes jgm/pandoc-citeproc#205. - Cleaner code for handling dir and style attributes for Div.
2017-02-24Implemented `\graphicspath` in LaTeX reader.John MacFarlane1-68/+78
Closes #736.
2017-02-22imageSize interface changemb211-1/+1
`imageSize img` is now `imageSize opts img`
2017-02-22make imageSize recognize basic SVG dimensions, see #3462mb211-0/+1
2017-02-17Added warnings for non-rendered blocks to some writers.John MacFarlane1-4/+8
2017-02-11Use new warnings throughout the code base.John MacFarlane1-2/+3
2017-01-25Removed writerHighlight; made writerHighlightStyle a Maybe.John MacFarlane1-21/+8
API change. For no highlighting, set writerHighlightStyle to Nothing.
2017-01-25Revert "Added page breaks into Pandoc."John MacFarlane1-1/+0
This reverts commit f02a12aff638fa2339192231b8f601bffdfe3e14.
2017-01-25Text.Pandoc.Shared: Removed fetchItem, fetchItem'.John MacFarlane1-4/+5
Made changes where these are used, so that the version of fetchItem from PandocMonad can be used instead.
2017-01-25Removed `--normalize` option and normalization functions from Shared.John MacFarlane1-2/+2
* Removed normalize, normalizeInlines, normalizeBlocks from Text.Pandoc.Shared. These shouldn't now be necessary, since normalization is handled automatically by the Builder monoid instance. * Remove `--normalize` command-line option. * Don't use normalize in tests. * A few revisions to readers so they work well without normalize.
2017-01-25Class: Removed getDefaultReferenceDocx/ODT from PandocMonad.John MacFarlane1-2/+3
We don't need these, since the default docx and odt can be retrieved using `readDataFile datadir "reference.docx"` (or odt).
2017-01-25Class: removed 'fail' from PandocMonad.John MacFarlane1-1/+1
Do we need this? I don't see why. There's a name clash which would better be avoided.
2017-01-25Simplified reference-docx/reference-odt to reference-doc.John MacFarlane1-1/+1
* Text.Pandoc.Options.WriterOptions: removed writerReferenceDocx and writerReferenceODT, replaced them with writerReferenceDoc. This can hold either an ODT or a Docx. In this way, writerReferenceDoc is like writerTemplate, which can hold templates of different formats. [API change] * Removed `--reference-docx` and `--reference-odt` options. * Added `--reference-doc` option.
2017-01-25Class: rename addWarning[WithPos] to warning[WithPos].John MacFarlane1-1/+1
There's already a function addWarning in Parsing! Maybe we can dispense with that now, but I still like 'warning' better as a name.
2017-01-25Class: Renamed 'warn' to 'addWarning' and consolidated RTF writer.John MacFarlane1-1/+1
* Renaming Text.Pandoc.Class.warn to addWarning avoids conflict with Text.Pandoc.Shared.warn. * Removed writeRTFWithEmbeddedImages from Text.Pandoc.Writers.RTF. This is no longer needed; we automatically handle embedded images using the PandocM functions. [API change]
2017-01-25Refactored math conversion in writers.John MacFarlane1-12/+6
* Remove exported module `Text.Pandoc.Readers.TeXMath` * Add exported module `Text.Pandoc.Writers.Math` * The function `texMathToInlines` now lives in `Text.Pandoc.Writers.Math` * Export helper function `convertMath` from `Text.Pandoc.Writers.Math` * Use these functions in all writers that do math conversion. This ensures that warnings will always be issued for failed math conversions.
2017-01-25Fixes to compile after rebase.John MacFarlane1-1/+2
2017-01-25Convert writers to use PandocMonad typeclass.Jesse Rosenthal1-44/+38
Instead of Free Monad with runIO
2017-01-25Remove readFileStrict.Jesse Rosenthal1-1/+1
We only used it once, and then immediately converted to lazy.