aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/EPUB.hs
AgeCommit message (Collapse)AuthorFilesLines
2017-06-30Allow ibooks-specific metadata in epubs. Closes #2693.John MacFarlane1-5/+20
You can now have the following fields in your YAML metadata, and it will be treated appropriately in the generated EPUB. ``` ibooks: version: 1.3.4 specified-fonts: false ipad-orientation-lock: portrait-only iphone-orientation-lock: landscape-only binding: true scroll-axis: vertical ``` This commit also fixes a regression in stylesheet paths.
2017-06-22EPUB writer: put title_page.xhtml in text/.John MacFarlane1-2/+2
2017-06-22EPUB writer: Fixed various things with new EPUB structure.John MacFarlane1-6/+6
2017-06-22Added `writerEpubSubdirectory` to `WriterOptions`.John MacFarlane1-8/+8
[API change] The EPUB writer now takes its EPUB subdirectory from this option. Also added `PandocEpubSubdirectoryError` to `PandocError`. This is raised if the EPUB subdirectory is not all ASCII alphanumerics. See #3720.
2017-06-21Change default EPUB directory structure in OCF container.John MacFarlane1-11/+22
See #3720. We now put all EPUB related content in an EPUB/ subdirectory by default (later this will be configurable). mimetype META-INF/ com.apple.ibooks.display-options.xml container.xml EPUB/ <<--configurable-->> fonts/ <<--static-->> font.otf media/ <<--static-->> cover.jpg fig1.jpg styles/ <<--static-->> stylesheet.css content.opf toc.ncx text/ <<--static-->> ch001.xhtml
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-11Switched Writer types to use Text.John MacFarlane1-2/+3
* XML.toEntities: changed type to Text -> Text. * Shared.tabFilter -- fixed so it strips out CRs as before. * Modified writers to take Text. * Updated tests, benchmarks, trypandoc. [API change] Closes #3731.
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-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-93/+95
2017-02-27Removed `--epub-stylesheet`; use `--css` instead.John MacFarlane1-24/+28
* Removed writerEpubStylesheet in WriterOptions. * Removed `--epub-stylesheet` option. * Allow `--css` to be used with epub. * Allow multiple stylesheets to be used. * Stylesheets will be taken both from `--css` and from the `stylesheet` metadata field (which can contain either a file path or a list of them). Closes #3472, #847.
2017-02-11Use new warnings throughout the code base.John MacFarlane1-4/+4
2017-02-04Changed writerEpubMetadata to a Maybe String.John MacFarlane1-1/+1
API change.
2017-01-30`--mathml` and MathML in HTMLMathMethod longer take an argument.John MacFarlane1-1/+1
The argument was for a bridge javascript that used to be necessary in 2004. We have removed the script already.
2017-01-27HTML writer: export writeHtmlStringForEPUB.John MacFarlane1-20/+16
Options: Remove writerEPUBVersion.
2017-01-26EPUB writer: split writeEPUB into writeEPUB2, writeEPUB3.John MacFarlane1-7/+24
Also include explicit epub2 output format in CLI tool.
2017-01-25Provide explicit separate functions for HTML 4 and 5.John MacFarlane1-5/+6
* Text.Pandoc.Writers.HTML: removed writeHtml, writeHtmlString, added writeHtml4, writeHtml4String, writeHtml5, writeHtml5String. * Removed writerHtml5 from WriterOptions. * Renamed default.html template to default.html4. * "html" now aliases to "html5"; to get the old HTML4 behavior, you must now specify "-t html4".
2017-01-25Text.Pandoc.Shared: Removed fetchItem, fetchItem'.John MacFarlane1-18/+15
Made changes where these are used, so that the version of fetchItem from PandocMonad can be used instead.
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-25Unify Errors.Jesse Rosenthal1-1/+2
2017-01-25Deleted whitespace at end of source lines.John MacFarlane1-2/+2
2017-01-25Implement Errors in PandocMonadJesse Rosenthal1-12/+16
Errors can be thrown purely with `throwError`. At the moment there are only three kinds of errors: 1. PandocFileReadError FilePath (for problems reading a file from the filesystem) 2. PandocShouldNeverHappenError String (for stuff that should never happen but we need to pattern-match anyway) 3. PandocSomeError String (a grab bag of everything else) Of course, we need to subdivide the third item in this list.
2017-01-25Convert all writers to use PandocMonad.Jesse Rosenthal1-22/+22
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-24/+25
Instead of Free Monad with runIO
2017-01-25Free: Remove readFileUTF8.Jesse Rosenthal1-1/+1
This is just defined in term of a bytestring, so we convert when necessary.
2017-01-25Remove IO UUID functions.Jesse Rosenthal1-1/+2
2017-01-25Implement runTest functions.Jesse Rosenthal1-5/+3
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 EPUB writer.Jesse Rosenthal1-51/+62
2017-01-25Introduce pure versions of IO Writers.Jesse Rosenthal1-37/+44
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.
2016-11-30Options: Removed writerStandalone, made writerTemplate a Maybe.John MacFarlane1-1/+0
Previously setting writerStandalone = True did nothing unless a template was provided in writerTemplate. Now a fragment will be generated if writerTemplate is Nothing; otherwise, the specified template will be used and standalone output generated. [API change]
2016-10-02EPUB writer: use stringify instead of plain writer for metadata.John MacFarlane1-6/+4
This means that underscores won't be used for emphasis, or CAPS for bold. The metadata fields will just have unadorned text. Closes #3066.
2016-07-14Fixed compiler warnings.John MacFarlane1-1/+1
2016-03-26EPUB writer: set 'navpage' variable on nav page.John MacFarlane1-1/+2
This allows templates to treat it differently.
2016-01-22Changed type of Shared.uniqueIdent argument from [String] to Set String.John MacFarlane1-2/+3
This avoids performance problems in documents with many identically named headers. Closes #2671.
2015-12-11Implemented SoftBreak and new `--wrap` option.John MacFarlane1-1/+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-6/+6
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-12EPUB writer: don't download linked media when `data-external` attribute set.John MacFarlane1-1/+2
By default pandoc downloads all linked media and includes it in the EPUB container. This can be disabled by setting `data-external` on the tags linking to media that should not be downloaded. Example: <audio controls="1"> <source src="http://www.sixbarsjail.it/tmp/bach_toccata.mp3" type="audio/mpeg"></source> </audio> Closes #2473.
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-14More changes to avoid compiler warnings on ghc 7.10.John MacFarlane1-2/+1
* CPP around deprecated `parseTime`. * Text.Pandoc.Compat.Locale -> Text.Pandoc.Compat.Time, now exports Data.Time.
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-10-13epub with `--webtex`: include image file rather than data: URI.John MacFarlane1-12/+8
Closes #2363.
2015-08-07Updated readers, writers and README for link attributemb211-3/+3
2015-08-07Updated readers and writers for new image attribute parameter.John MacFarlane1-2/+2
(mb21)
2015-05-27Fixed compiler warning.John MacFarlane1-1/+1
2015-05-27EPUB writer: Improved chapter splitting and internal link rewriting.John MacFarlane1-53/+34
Closes #1887. Closes #2163. Closes #2162.
2015-05-21EPUB writer: Split references into separate chapter.John MacFarlane1-0/+4
Previously the div-enclosed reference section produced by pandoc-citeproc would not be split into its own chapter, which caused various problems. See #2162, #2163. I'm not sure this is a complete fix. I note that the bibliography doesn't appear in nav or toc, which seems bad.
2015-05-13EPUB writer: Properly handle image URLs without an extension.John MacFarlane1-36/+42
We now look at the mime type from the server and attach an appropriate extension. Closes #1855.
2015-05-09Revert "EPUB writer: stylesheet changes. Closes #2040."John MacFarlane1-26/+18
This reverts commit 1c2951dfd9ee72e5270cb974a06098adb9178f89. See #2040. The semantics was too squishy. `--css` takes a URL, but for EPUB we need files that we can read. I prefer keeping the old system for now, with `--epub-stylesheet`.
2015-05-08EPUB writer: stylesheet changes. Closes #2040.John MacFarlane1-18/+26
* Allow `--css` to be used to specify stylesheets. * Deprecated `--epub-stylesheet` and made it a synoynym of `--css`. * If a code block with class "css" is given as contents of the `stylesheet` metadata field, use its literal code as contents of the epub stylesheet. Otherwise, treat it as a filename and read the file. * Note: `--css` and `stylesheet` in metadata are not compatible. `stylesheet` takes precedence.