aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/EPUB.hs
AgeCommit message (Collapse)AuthorFilesLines
2018-09-04hlint some writersAlexander Krotov1-1/+1
2018-08-28EPUB writer: set epub:type on body element intelligently.John MacFarlane1-6/+22
epub:type of first section epub:type of body -------------------------- ------------------ prologue frontmatter abstract frontmatter acknowledgments frontmatter copyright-page frontmatter dedication frontmatter foreword frontmatter halftitle, frontmatter introduction frontmatter preface frontmatter seriespage frontmatter titlepage frontmatter afterword backmatter appendix backmatter colophon backmatter conclusion backmatter epigraph backmatter Otherwise body will have epub:type 'bodymatter'. This only affects epub3. See http://www.idpf.org/epub/profiles/edu/structure/#h.l0bzsloklt10 Closes #4823.
2018-05-12EPUB writer: properly escape pagetitle.John MacFarlane1-3/+6
Previously we weren't escaping `&` and other XML characters in the pagetitle, so a title containing a `&` would be invalid.
2018-03-23EPUB writer: ensure that pagetitle is always set...John MacFarlane1-6/+12
even when structured titles are used. This prevents spurious warnings about empty title elements. Closes #4486.
2018-03-18EPUB writer: remove notes from TOC in nav.xhtml (#4463)Mauro Bieg1-4/+5
fixes #4453
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-2/+2
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-11-14EPUB writer: Fixed path for cover image.John MacFarlane1-1/+1
It was previously `media/media/imagename`, and should have been `media/imagename`.
2017-11-14EPUB writer: fix paths for cover image.John MacFarlane1-2/+2
Closes #4069.
2017-11-08EPUB writer: fixed modified paths for raw HTML tagsJohn MacFarlane1-2/+2
(src, poster, etc.) This had not been updated for the new EPUB container layout, with a separate text/ subdirectory. Closes #4050. Closes #4055.
2017-11-07EPUB writer: fixed EPUB OCF structure.John MacFarlane1-65/+82
The structure of the EPUBs was messed up, and #3720 was improperly implemented. This commit fixes things.
2017-11-07EPUB writer: fix image paths with empty `--epub-subdirectory`.John MacFarlane1-3/+9
2017-10-30EPUB writer: fixed filepaths for nonstandard epub-subdirectory values.John MacFarlane1-16/+23
2017-10-30EPUB writer fixes:John MacFarlane1-23/+32
- Ensure that epub2 is recognized as a non-text format, so that a template is used. - Don't include "prefix" attribute for ibooks for epub2. It doesn't validate. - Fix stylesheet paths; previously we had an incorrect stylesheet path for the cover page and nav page.
2017-10-29Source code reformatting.John MacFarlane1-1/+1
2017-10-29hlint suggestions.John MacFarlane1-24/+25
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-8/+8
2017-09-30EPUB writer: simplified some functions.John MacFarlane1-24/+18
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-10Removed datadir param from readDataFile and getDefaultTemplate.John MacFarlane1-2/+1
In Text.Pandoc.Class and Text.Pandoc.Template, resp. We now get the datadir from CommonState.
2017-08-09EPUB writer: don't strip formatting in TOC.John MacFarlane1-10/+23
Closes #1611.
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.