aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/FB2.hs
AgeCommit message (Collapse)AuthorFilesLines
2018-09-04hlint some writersAlexander Krotov1-1/+1
2018-08-24FB2 writer: put coverpage element between title and date...John MacFarlane1-2/+3
...rather than in document-info element. Closes #4854.
2018-06-12FB2 writer: convert Plain to Para in annotationAlexander Krotov1-1/+6
Address #2424
2018-06-12FB2 writer: fix order of items in title-infoAlexander Krotov1-1/+1
Address issue #2424
2018-04-26Merge branch 'fb2-hrblankline' of https://github.com/labdsf/pandoc into ↵John MacFarlane1-7/+4
labdsf-fb2-hrblankline
2018-04-19FB2 writer: convert metadata value "abstract" to book annotationAlexander Krotov1-1/+4
2018-04-07FB2 writer: output links inline instead of producing notesAlexander Krotov1-19/+2
Previously all links were turned into footnotes with unclickable URLs inside.
2018-04-05FB2 writer: represent HorizontalRule as empty lineAlexander Krotov1-7/+4
HorizontalRule corresponds to <hr> element in the default output format, HTML. Current HTML standard defines <hr> element as "paragraph-level thematic break". In typography it is often represented by extra space or centered asterism ("⁂"), but since FB2 does not support text centering, empty line (similar to extra space) is the only solution. Line breaks, on the other hand, don't generate <empty-line /> anymore. Previously line breaks generated <empty-line /> element inside paragraph, which is not allowed. So, this commit addresses issue #2424 ("FB2 produced by pandoc doesn't validate"). FB2 does not have a way to represent line breaks inside paragraphs. They are replaced with LF character, which is not rendered by FB2 readers, but at least preserves some information.
2018-04-04FB2 writer: allow emphasis and notes in titlesAlexander Krotov1-6/+4
Only <p> and <empty-line /> are allowed in titles, but <p> has the same type as an ordinary paragraphs. Therefore, there is no need to remove emphasis from titles. Also, don't intersperse paragraph with empty lines.
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-01-19hlint code improvements.John MacFarlane1-2/+1
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-12-28FB2 writer: add cover image specified by "cover-image" metaAlexander Krotov1-1/+10
Fixes #4195
2017-11-01hlintAlexander Krotov1-1/+1
2017-11-01FB2 writer: Add "unrecognised" genre to <title-info>Alexander Krotov1-1/+2
XML schema requires at least one genre.
2017-11-01FB2 writer: remove <annotation> from <body>Alexander Krotov1-11/+2
<annotation> is not allowed inside <body> according to FictionBook2 XML schema. Besides that, the same information is already placed inside <description>. Related bug: #2424
2017-11-01Merge pull request #4008 from labdsf/fb2-bulletsJohn MacFarlane1-8/+4
FB2 writer: make bullet lists consistent with ordered lists
2017-10-31FB2 writer: write blocks outside of <p> in definitionsAlexander Krotov1-18/+2
2017-10-31FB2 writer: make bullet lists consistent with ordered listsAlexander Krotov1-8/+4
Previously bullet lists interacted in odd way with ordered lists. For example, bullet lists nested in ordered list had incorrect indentation. Besides that, indentation with spaces is not rendered by FBReader and fbless. To avoid this problem, bullet lists are indented by appending bullets to marker just the same way it is done for ordered lists.
2017-10-29hlint suggestions.John MacFarlane1-4/+4
2017-10-29Write FB2 lists without nesting blocks inside <p> (#4004)Alexander1-16/+32
According to FB2 XML schema <empty-line /> cannot be placed inside <p>. Linux FBReader can't display such paragraphs, e.g. any "loose" lists produced by pandoc prior to this commit. Besides that, FB2 writer placed <p> inside <p> when writing nested lists, this commit fixes the bug. Also this commit removes leading non-breaking space from ordered lists for consistency with bullet lists. Definition lists are not affected at all.
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-5/+4
2017-10-11FB2 Writer: format LineBlock as poemAlexander Krotov1-2/+6
Previously writer produced one paragraph with <empty-line/> elements, which are not allowed inside <p> according to FB2 schema.
2017-10-09FB2 writer: replace concatMap with cMapAlexander Krotov1-10/+10
2017-10-09hlint FB2 writerAlexander Krotov1-50/+50
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-06-20Removed redundant import.John MacFarlane1-1/+0
2017-06-20FB2 writer: don't fail with an error on interior headers (e.g. in list).John MacFarlane1-3/+5
Instead, omit them with an INFO message. Closes #3750.
2017-06-17Use Control.Monad.State.Strict throughout.John MacFarlane1-2/+2
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-3/+4
* 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-23Shared: Provide custom isURI that rejects unknown schemes [isURI]Albert Krewinkel1-2/+1
We also export the set of known `schemes`. The new function replaces the function of the same name from `Network.URI`, as the latter did not check whether a scheme is well-known. E.g. MediaWiki wikis frequently feature pages with names like `User:John`. These links were interpreted as URIs, thus turning internal links into global links. This is prevented by also checking whether the scheme of a URI is frequently used (i.e. is IANA registered or an otherwise well-known scheme). Fixes: #2713 Update set of well-known URIs from IANA list All official IANA schemes (as of 2017-05-22) are included in the set of known schemes. The four non-official schemes doi, isbn, javascript, and pmid are kept.
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-13Add haddock module description to FB2 writerAlbert Krewinkel1-1/+11
Copyright, maintainer etc. were missing in haddock docs for this module.
2017-05-02FB2 writer: Add support for "lang" metadata (#3625)Alexander Krotov1-2/+7
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-43/+43
2017-02-17FB2 writer: don't render RawBlock as code.John MacFarlane1-4/+7
2017-02-11Use new warnings throughout the code base.John MacFarlane1-6/+4
2017-01-25Revert "Added page breaks into Pandoc."John MacFarlane1-2/+0
This reverts commit f02a12aff638fa2339192231b8f601bffdfe3e14.
2017-01-25Text.Pandoc.Shared: Removed fetchItem, fetchItem'.John MacFarlane1-5/+13
Made changes where these are used, so that the version of fetchItem from PandocMonad can be used instead.
2017-01-25Fix rebasing errors.Jesse Rosenthal1-1/+1
2017-01-25Unify Errors.Jesse Rosenthal1-1/+2
2017-01-25Implement Errors in PandocMonadJesse Rosenthal1-2/+3
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 writers to use PandocMonad typeclass.Jesse Rosenthal1-30/+27
Instead of Free Monad with runIO
2017-01-25Finish pure writer of FB2.Jesse Rosenthal1-10/+17
2017-01-25FB2 writer: Rewrite image-fetching to use fetchItem.Jesse Rosenthal1-43/+11
This uses the function from shared, which will allow us to convert it over to the free monad.
2017-01-25Continue refactoring FB2 writer.Jesse Rosenthal1-8/+14
2017-01-25FB2 writer: bring functions to toplevel.Jesse Rosenthal1-47/+53
This is the first of a number of changes to bring the FB2 writer a bit closer to the idioms used elsewhere in pandoc, so it can be more easily converted to using the pure functions from Free.
2017-01-25Adds support for pagebreaks (when it makes sense)Hubert Plociniczak1-0/+2
Update all writers to take into account page breaks. A straightforwad, far from complete, implementation of page breaks in selected writers. Readers will have to follow in the future as well.
2016-11-30Options: Removed writerStandalone, made writerTemplate a Maybe.John MacFarlane1-1/+1
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-13Add support for the LineBlock element to writersAlbert Krewinkel1-1/+3
The following markup features are used to output the lines of the `LineBlock` element: - AsciiDoc: a `[verse]` block, - ConTeXt: text surrounded by `\startlines` and `\endlines`, - HTML: `div` with an per-element style setting to interpret the content as pre-wrapped, - Markdown: line blocks if the `line_blocks` extension is enabled, a simple paragraph with hard linebreaks otherwise, - Org: VERSE block, - RST: a line block, and - all other formats: a paragraph, containing hard linebreaks between lines. Custom lua writers should be updated to use the `LineBlock` element.