aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/EPUB.hs
AgeCommit message (Collapse)AuthorFilesLines
2019-11-25EPUB writer: Fix regression with `--css option.John MacFarlane1-9/+13
Closes #5937.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-77/+80
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
2019-11-03EPUB writer: ensure that `lang` variable is set on all chapters.John MacFarlane1-3/+5
2019-10-09Options.WriterOptions: Change type of writerVariables to Context Text.John MacFarlane1-31/+54
This will allow structured values. [API change]
2019-09-20Bug fixes to EPUB chapter splitting.John MacFarlane1-15/+16
2019-09-19EPUB writer: make --epub-chapter-level work again.John MacFarlane1-19/+15
It was temporarily broken by the latest change to chapter splitting code.
2019-09-19EPUB writer: improve splitting into chapters.John MacFarlane1-36/+23
+ Use makeSection from T.P.Shared. This deals better with embedded divs. (Closes #5761.) + Remove chapter-title class from chapter h1, for now. (Reverts one change made earlier; we may revisit this in light of #5749.) + Avoid issuing warning multiple times when title not set (see #5760).
2019-09-14Add chapter-title class to EPUB chapter title h1 elements.John MacFarlane1-3/+5
See #5269.
2019-09-14EPUB toChapters: don't treat "refs" Div specially.John MacFarlane1-1/+1
This should make toChapters work better if there are Divs around sections.
2019-09-08Replace Element and makeHierarchical with makeSections.John MacFarlane1-25/+29
Text.Pandoc.Shared: + Remove `Element` type [API change] + Remove `makeHierarchicalize` [API change] + Add `makeSections` [API change] + Export `deLink` [API change] Now that we have Divs, we can use them to represent the structure of sections, and we don't need a special Element type. `makeSections` reorganizes a block list, adding Divs with class `section` around sections, and adding numbering if needed. This change also fixes some longstanding issues recognizing section structure when the document contains Divs. Closes #3057, see also #997. All writers have been changed to use `makeSections`. Note that in the process we have reverted the change c1d058aeb1c6a331a2cc22786ffaab17f7118ccd made in response to #5168, which I'm not completely sure was a good idea. Lua modules have also been adjusted accordingly. Existing lua filters that use `hierarchicalize` will need to be rewritten to use `make_sections`.
2019-07-13Merge pull request #5590 from blmage/fix-4206John MacFarlane1-7/+16
Do not override "fileN" medias when writing to EPUB format (fix #4206)
2019-07-13EPUB writer: Use svg tag wrapper for cover image.John MacFarlane1-2/+12
In addition, the code generating the image has been moved to the template, to make it more customizable. Those who use custom EPUB templates will need to adjust their templates, adding the code to generate the cover image. (Previously this was just inserted into 'body'.) Closes #5643.
2019-06-18Do not override existing "fileN" medias when writing to EPUB format (fix #4206)blmage1-7/+16
2019-06-04Fix document section assignments in EPUB writer.John MacFarlane1-4/+7
For example, introduction should go in bodymatter, not frontmatter, and epigraph, conclusion, and afterward should go in bodymatter, not backmatter. For the full list of assignments, see the manual. Closes #5546.
2019-05-27EPUB writer: don't include 'landmarks' if there aren't any.John MacFarlane1-9/+10
Previously we could get an empty ol element, which caused validation errors with epubcheck.
2019-04-23EPUB writer: Ensure unique ids for styleesheets in content.opf.John MacFarlane1-3/+3
Closes #5463.
2019-03-01Remove license boilerplate.John MacFarlane1-18/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-01-08EPUB writer: ensure that picture transforms are done on metadata too.John MacFarlane1-6/+6
2019-01-02EPUB writer: small fixes to nav.xhtml.John MacFarlane1-0/+1
* Add 'landmarks' id attribute to the landmarks nav. * Replace old default CSS removing numbers from ol.toc li with new rules that match `nav#toc ol, nav#landmarks ol`. * We keep the `toc` class on `ol` for backwards compatibility.
2018-11-24EPUB writer: handle calibre metadata.John MacFarlane1-1/+22
Nodes of the form <meta name="calibre:series" content="Classics on War and Politics"/> are now included from an epub XML metadata file. You can also include this information in your YAML metadata, like so: calibre: series: Classics on War and Policitics In addition, ibooks-specific metadata can now be included via an XML file. (Previously, it could only be included via YAML metadata, see #2693.) Closes #5098.
2018-11-19For bibliography match Div with id 'refs', not class 'references'.John MacFarlane1-2/+2
This was a mismatch between pandoc's docx, epub, latex, and markdown writers and the behavior of pandoc-citeproc, which actually looks for a div with id 'refs' rather than one with class 'references'.
2018-11-11Text.Pandoc.Shared: add parameter to uniqueIdent, inlineListToIdentifier.John MacFarlane1-4/+4
The parameter is Extensions. This allows these functions to be sensitive to the settings of `Ext_gfm_auto_identifiers` and `Ext_ascii_identifiers`. This allows us to use `uniqueIdent` in the CommonMark reader, replacing some custom code. It also means that `gfm_auto_identifiers` can now be used in all formats. Semantically, `gfm_auto_identifiers` is now a modifier of `auto_identifiers`; for identifiers to be set, `auto_identifiers` must be turned on, and then the type of identifier produced depends on `gfm_auto_identifiers` and `ascii_identifiers` are set. Closes #5057.
2018-10-28EPUB writer: use metadata field `css` instead of `stylesheet`mb211-3/+4
closes #4990
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