aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
AgeCommit message (Collapse)AuthorFilesLines
2017-01-25Fix rebasing errors.Jesse Rosenthal2-2/+2
2017-01-25Unify Errors.Jesse Rosenthal8-8/+16
2017-01-25Deleted whitespace at end of source lines.John MacFarlane3-4/+4
2017-01-25Fixed regression in OPML writer.John MacFarlane1-1/+1
OPML writer should note include `_notes` attribute when there's no content.
2017-01-25Texinfo writer: restore former behavior for headers level > 4.John MacFarlane1-19/+21
The recent changes made the writer fail with an error if it encountered a header with level 5. Better to do as we did before and just print a paragraph in that case. Eventually we should emit a warning here.
2017-01-25Fixes to compile after rebase.John MacFarlane2-3/+4
2017-01-25Implement Errors in PandocMonadJesse Rosenthal8-127/+168
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 Rosenthal22-186/+222
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 Rosenthal6-142/+122
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 readFileStrict.Jesse Rosenthal1-1/+1
We only used it once, and then immediately converted to lazy.
2017-01-25Remove IO UUID functions.Jesse Rosenthal1-1/+2
2017-01-25ODT Writer: fix compiler complaint.Jesse Rosenthal1-1/+0
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-25Make pure rtf writer using free.Jesse Rosenthal1-4/+13
2017-01-25Implement runTest functions.Jesse Rosenthal4-25/+16
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-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 Rosenthal4-90/+124
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.
2017-01-25Adds support for pagebreaks (when it makes sense)Hubert Plociniczak22-11/+48
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.
2017-01-25Added page breaks into Pandoc.Hubert Plociniczak1-3/+25
This requires an updated version of pandoc-types that introduces PageBreak definition. Not that this initial commit only introduces ODT pagebreaks and distinguishes for it page breaks before, after, or both, the paragraph, as read from the style definition.
2017-01-24OpenDocument writer: small refactoring.John MacFarlane1-8/+11
Removed separate 'parent' param in paraStyle.
2017-01-23OpenDocument writer: don't profilerate text styles unnecessarily.John MacFarlane1-25/+62
This change makes the writer create only as many temporary text styles as are absolutely necessary. It also consolidates adjacent nodes with the same style. Closes #3371.
2016-12-30DocBook5 writer: make id attribute xml:id, fixes #3329 (#3330)Mauro Bieg1-1/+4
2016-12-24HTML writer: don't process pars with empty RawInline, fixes #1040 (#3327)Mauro Bieg1-3/+8
2016-12-23Updates to use skylighting rather than highlighting-kate.John MacFarlane2-5/+5
So far this just reproduces capacity. Later we'll be able to add features like warning messages, dynamic loading of xml syntax definitions, and dynamic loading of themes.
2016-12-21Org writer: prefix footnote numbers with `fn:`Albert Krewinkel1-2/+2
Unprefixed numbers where used by older org-mode versions, but are no longer supported.
2016-12-16LaTeX writer: allow tables with empty cells to count as "plain."John MacFarlane1-0/+1
This addresses a problem of too-wide tables when empty cells are used. Thanks to Joost Kremers for reporting the issue.
2016-12-11Fix display math with --webtex in markdown output.John MacFarlane1-9/+13
Closes #3298.
2016-12-05Man writer: Ensure that periods are escaped at beginning of line.John MacFarlane1-4/+2
Closes #3270.
2016-12-04LaTeX writer: Fix unnumbered headers when used with `--top-level`Albert Krewinkel1-1/+1
Fix interaction of top-level divisions `part` or `chapter` with unnumbered headers when emitting LaTeX. Headers are ensured to be written using stared commands (like `\subsection*{}`). Fixes: #3272
2016-12-04Markdown writer: Fixed incorrect word wrapping.John MacFarlane1-1/+1
Previously pandoc would sometimes wrap lines too early due to this bug. Closes #3277.
2016-11-30Options: Removed writerStandalone, made writerTemplate a Maybe.John MacFarlane26-110/+99
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-11-27Updated renderHtml import in HTML writer to avoid deprecated function.John MacFarlane1-2/+1
2016-11-27Refactor top-level division selection (#3261)Albert Krewinkel4-29/+33
The "default" option is no longer represented as `Nothing` but via a new type constructor, making the `Maybe` wrapper superfluous. The default behavior of using heuristics can now be enabled explicitly by setting `--top-level-division=default`. API change (`Text.Pandoc.Options`): The `Division` type was renamed to `TopLevelDivision`. The `Section`, `Chapter`, and `Part` constructors were renamed to `TopLevelSection`, `TopLevelChapter`, and `TopLevelPart`, respectively. An additional `TopLevelDefault` constructor was added, which is now also the new default value of the `writerTopLevelDivision` field in `WriterOptions`.
2016-11-26Revert "Open Document writer: set first level of blockquotes to not use ↵John MacFarlane1-2/+3
indent (#2757)" This reverts commit fee0b913c5dd95e50845f6f35430b7582322ef0b. The previous commit did not provide a good way to get increased indentation for nested block quotes. Rolling it back for now. @jjsheets feel free to submit something that handles multiple levels of block quote smoothly, if you like.
2016-11-26Open Document writer: set first level of blockquotes to not use indent (#2757)Jeff Sheets1-3/+2
* Open Document writer: set first level of blockquotes to not use indent Nested blockquotes start using indents like before. Quotation style is still in use, so the style's indent settings take effect on the first level of blockquotes. * Removed list construction to improve pull request to fix #2747
2016-11-26[Tex] Remove invalid inlines in sections (#3218)hubertp-lshift1-4/+6
Latex doesn't like when hypertargets or images are put in the options list of the section. They are not lost since they were actually duplicated and present also in the second argument list. Note on the implementation: I had to inline the definiton of 'foldMap' since it is not implemented in every version of Haskell that Pandoc supports.
2016-11-26[odt] Infer table's caption from the paragraph (#3224)hubertp-lshift1-1/+1
ODT's reader always put empty captions for the parsed tables. This commit 1) checks paragraphs that follow the table definition 2) treats specially a paragraph with a style named 'Table' 3) does some postprocessing of the paragraphs that combines tables followed immediately by captions The ODT writer used 'TableCaption' style name for the caption paragraph. This commit follows the open office approach which allows for appending captions to table but uses a built-in style named 'Table' instead of 'TableCaption'. Any users of odt format (both writer and reader) are therefore required to change the style's name to 'Table', if necessary.
2016-11-26Allow to overwrite top-level division type heuristics (#3258)Albert Krewinkel4-11/+17
Pandoc uses heuristics to determine the most resonable top-level division type when emitting LaTeX or Docbook markup. It is now possible to overwrite this implicitly set top-level division via the `top-level-division` command line parameter. API change (`Text.Pandoc.Options`): the type of the `writerTopLevelDivision` field in of the `WriterOptions` data type is altered from `Division` to `Maybe Division`. The field's default value is changed from `Section` to `Nothing`. Closes: #3197
2016-11-24LaTeX writer: use `\autocites*` when "suppress-author" citation used.John MacFarlane1-2/+3
2016-11-23Fixed some bugs in Pretty that caused blank lines in tables.John MacFarlane1-1/+1
The bugs caused spurious blank lines in grid tables when we had things like blankline $$ blankline Closes #3251.
2016-11-22Docx writer: Give full detail when there are errors converting tex math.John MacFarlane1-1/+2
2016-11-22Put 'warn' in MonadIO. Add warnings for math conversions in docx.John MacFarlane2-4/+6
2016-11-20LaTeX writer: ensure that simple tables have simple cells.John MacFarlane1-1/+8
If cells contain more than a single Plain or Para, then we need to set nonzero widths and put contents into minipages. Closes #2666.
2016-11-19Fix for calculation of column widths for aligned multiline tablesBjörn Peemöller1-8/+20
This also fixes excessive CPU and memory usage for tables when --columns is set in such a way that cells must be very tiny. Now cells are guaranteed to be big enough so that single words don't need to line break, even if this pushes the line length above the column width. Closes #1911.
2016-11-18Docx writer: fixed XML markup for empty cells.John MacFarlane1-1/+1
Closes #3238. Previously the Compact style wasn't being applied properly to empty cells.