aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/ODT.hs
AgeCommit message (Collapse)AuthorFilesLines
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-5/+1
Use this instead of PandocIOError when a resource is not found in path. This improves the error message in this case, see #3629.
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-20/+20
2017-03-01ODT writer: calculate aspect ratio for percentage-sized images (#3478)Mauro Bieg1-2/+2
closes #3239
2017-02-24Use catchError instead of runExceptT.John MacFarlane1-10/+12
2017-02-22imageSize interface changemb211-1/+1
`imageSize img` is now `imageSize opts img`
2017-02-11Use new warnings throughout the code base.John MacFarlane1-4/+4
2017-01-25Text.Pandoc.Shared: Removed fetchItem, fetchItem'.John MacFarlane1-3/+4
Made changes where these are used, so that the version of fetchItem from PandocMonad can be used instead.
2017-01-25Class: Removed getDefaultReferenceDocx/ODT from PandocMonad.John MacFarlane1-1/+2
We don't need these, since the default docx and odt can be retrieved using `readDataFile datadir "reference.docx"` (or odt).
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-2/+2
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-2/+2
* 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-25Convert all writers to use PandocMonad.Jesse Rosenthal1-1/+1
Since PandocMonad is an instance of MonadError, this will allow us, in a future commit, to change all invocations of `error` to `throwError`, which will be preferable for the pure versions. At the moment, we're disabling the lua custom writers (this is temporary). This requires changing the type of the Writer in Text.Pandoc. Right now, we run `runIOorExplode` in pandoc.hs, to make the conversion easier. We can switch it to the safer `runIO` in the future. Note that this required a change to Text.Pandoc.PDF as well. Since running an external program is necessarily IO, we can be clearer about using PandocIO.
2017-01-25Convert writers to use PandocMonad typeclass.Jesse Rosenthal1-15/+12
Instead of Free Monad with runIO
2017-01-25ODT Writer: fix compiler complaint.Jesse Rosenthal1-1/+0
2017-01-25Implement runTest functions.Jesse Rosenthal1-4/+2
These work with a State monad and a Reader monad to produce deterministic results. It can probably be simplified somewhat.
2017-01-25Remove IORef from ODT writer.Jesse Rosenthal1-24/+38
We want pure writers, so IORef shouldn't be in there. We switch to using a normal State Monad. If this produces performance problems, we can look into trying STRefs, but that seems like unnecessary complication at the moment.
2017-01-25Introduce pure versions of IO Writers.Jesse Rosenthal1-20/+28
Using Text.Pandoc.Free, introduce pure versions of Docx, EPUB, ICML, and ODT writers. Each of the pure versions is exported along with the IO version (produced by running `runIO` on the pure reader). Ideally, this should make the writers easier to test.
2015-12-13ODT/OpenDocument writer: improved image attributesmb211-13/+25
- support for percentage widths/heights - use Attr instead of title to get dimensions from ODT walker to writeOpenDocument
2015-12-12Restore no wrapping of XML in Docx, ODT.John MacFarlane1-1/+1
It's possible that wrapping causes problems; safer to turn it off.
2015-12-11Implemented SoftBreak and new `--wrap` option.John MacFarlane1-2/+2
Added threefold wrapping option. * Command line option: deprecated `--no-wrap`, added `--wrap=[auto|none|preserve]` * Added WrapOption, exported from Text.Pandoc.Options * Changed type of writerWrapText in WriterOptions from Bool to WrapOption. * Modified Text.Pandoc.Shared functions for SoftBreak. * Supported SoftBreak in writers. * Updated tests. * Updated README. Closes #1701.
2015-11-19Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into ↵John MacFarlane1-8/+9
mb21-new-image-attributes * Bumped version to 1.16. * Added Attr field to Link and Image. * Added `common_link_attributes` extension. * Updated readers for link attributes. * Updated writers for link attributes. * Updated tests * Updated stack.yaml to build against unreleased versions of pandoc-types and texmath. * Fixed various compiler warnings. Closes #261. TODO: * Relative (percentage) image widths in docx writer. * ODT/OpenDocument writer (untested, same issue about percentage widths). * Update pandoc-citeproc.
2015-11-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane1-1/+0
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane1-0/+1
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane1-1/+0
- The (non-exported) prelude is in prelude/Prelude.hs. - It exports Monoid and Applicative, like base 4.8 prelude, but works with older base versions. - It exports (<>) for mappend. - It hides 'catch' on older base versions. This allows us to remove many imports of Data.Monoid and Control.Applicative, and remove Text.Pandoc.Compat.Monoid. It should allow us to use -Wall again for ghc 7.10.
2015-08-07Updated readers and writers for new image attribute parameter.John MacFarlane1-8/+9
(mb21)
2015-06-28Removed unneeded import.John MacFarlane1-1/+1
2015-06-28Let reference.docx/odt behave as if they are virtual data files.John MacFarlane1-19/+2
Now they are constructed on the fly from their components, but we now allow them to be printed with `--print-default-data-file` and to override the defaults if placed in the user data directory. Shared now exports getDefaultReferenceDocx and getDefaultReferenceODT (API change). These functions have been removed from the Docx and ODT writers. Shared.readDataFile has been modified so that requests to read a reference.odt or reference.docx will use these functions to generate the files.
2015-05-28Better fix for #2187.John MacFarlane1-4/+21
* Reverted kludgy change to make-windows-installer.bat. * Removed make-reference-fiels.hs. * Moved the individual ingredients of reference.docx and reference.odt to the data directory. * Removed reference.docx and reference.odt from data directory. * We now build the reference archives from their ingredient pieces in the docx and odt writers, instead of having a reference.docx or reference.odt intermediary. This should fix #2187. It also simplifies the bulid procedure. The one thing users may notice is different is that you can no longer get the reference.docx or reference.odt using `--print-default-data-file`. Instead, simply generate a docx or odt using pandoc with a blank or minimal input, and use that (or a customized version) with `--reference-docx` or `--reference-odt`.
2015-05-09Improved warnings when image size can't be determined.John MacFarlane1-2/+4
Closes #1834.
2015-05-09ImageSize: make imageSize return an Either, not a Maybe.John MacFarlane1-2/+4
This will give us better error reporting options. This is part of a fix for #1834.
2015-04-26Updated copyright notices to -2015. Closes #2111.John MacFarlane1-2/+2
2015-04-12ODT Writer: Figure captionsNikolay Yakimov1-2/+4
Works pretty much the same as Word writer. Following styles are used for figures: Figure -- for figure with empty caption FigureWithCaption (based on Figure) -- for figure with caption FigureCaption (based on Caption) -- for figure captions Also, TableCaption (based on Caption) is used for table captions. We need FigureWithCaption to set keepWithNext, in order to keep caption with figure.
2014-10-30ODT writer: Correctly handle images without extensions.John MacFarlane1-5/+6
Closes #1729.
2014-10-28Strip querystring in ODT writeTodd Sifleet1-1/+2
* Resolve #1682 * Strip querystring from filename before rendering ODT files, ODT cannot handle querystrings in files.
2014-08-17MIME cleanup.Artyom Kazak1-6/+2
* Create a type synonym for MIME type (instead of `String`). * Add `getMimeTypeDef` function. * Avoid recreating MIME type `Map`s every time. * Move “Formula-...” case handling into `getMimeType`.
2014-08-04Use texmath 0.7 interface.John MacFarlane1-1/+2
2014-07-30PDF, Docx, EPUB, and ODT writers now automatically use MediaBag.John MacFarlane1-2/+2
The MediaBag is thread through from the reader, with no need to extract to files.
2014-05-09Update copyright notices for 2014, add missing noticesAlbert Krewinkel1-2/+2
2014-01-02ODT writer: Use mathml for proper rendering of formulas.John MacFarlane1-8/+42
Note: LibreOffice's support for this seems a bit buggy. But it should be better than what we had before.
2013-12-19HLint: use fromMaybeHenry de Valence1-1/+2
Replace uses of `maybe x id` with `fromMaybe x`.
2013-08-11ODT/OpenDocument writer: Minor changes for ODF 1.2 conformance.John MacFarlane1-6/+14
See #939. We leave the nonconforming contextual-spacing attribute, which is provided by LibreOffice itself and seems to be supported.
2013-08-11Options: Changed `writerSourceDir` to `writerSourceURL` (now a Maybe).John MacFarlane1-5/+4
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-2/+2
They are significantly faster.
2013-07-18Improved fetching of external resources.John MacFarlane1-3/+2
* 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-06-24Use new flexible metadata type.John MacFarlane1-1/+2
* 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-15Fixed regression in ODT writer.John MacFarlane1-2/+2
This was due to a change in the Show instance for Text.Pandoc.Pretty.Doc, which led 1.11 to produce corrupt ODTs. Closes #780.
2013-01-11Refactoring:John MacFarlane1-11/+5
* 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-18/+29
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).
2012-12-29Data files changes.John MacFarlane1-12/+3
* 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.