Commit graph

83 commits

Author SHA1 Message Date
John MacFarlane
6b72c5e35b Support svg in PDF output, converting with rsvg2pdf.
Closes #1793.
2017-08-09 12:13:49 -07:00
John MacFarlane
abd2e94f5a In producing PDFs, warn if the font is missing some characters.
* Added `MissingCharacter` to `LogMessage` in Text.Pandoc.Logging.
* Parse the (xe)latex log for missing character warnings and issue
  the warning.

Closes #3742.
2017-06-18 11:17:00 +02:00
John MacFarlane
fa719d0264 Switched Writer types to use Text.
* 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-06-11 00:46:31 +02:00
John MacFarlane
6a7f980247 PDF: Got --resource-path working with pdf output.
See #852.
2017-05-20 23:46:51 +02:00
John MacFarlane
d109c8be8f PDF: better error message for non-converted svg images. 2017-05-20 23:24:20 +02:00
John MacFarlane
5c44fd554f PDF: Refactoring, makePDF is now in PandocIO [API change]. 2017-05-20 22:42:50 +02:00
Albert Krewinkel
965f1ddd4a
Update dates in copyright notices
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-13 23:30:13 +02:00
John MacFarlane
6b086acae8 Rename fillMedia -> fillMediaBag. 2017-05-07 21:03:18 +02:00
John MacFarlane
a902109c6d PDF: use fillMedia and extractMedia to extract media to tmp dir.
This reduces code duplication.
We should be able to do something similar in ODT, Docx, EPUB writers.
2017-05-07 20:57:16 +02:00
John MacFarlane
0ae448e638 PDF: when running pdfroff, don't do second pass to relocate toc. 2017-03-26 20:00:40 +02:00
John MacFarlane
1d659bec01 Ms writer: Implement header identifiers and internal links. 2017-03-25 22:16:44 +01:00
John MacFarlane
7de9a6ef5f PDF via groff ms: use -t and -KUTF-8 options to pdfroff. 2017-03-24 09:35:30 +01:00
John MacFarlane
f0abbe7533 Allow creation of pdf via groff ms and pdfroff.
pandoc -t ms -o output.pdf input.txt
2017-03-23 21:24:01 +01:00
John MacFarlane
e256c8ce17 Stylish-haskell automatic formatting changes. 2017-03-04 13:03:41 +01:00
John MacFarlane
e1304aa59c Fetch images when generating PDF via context.
To do this, we create the temp directory as a subdirectory
of the working directory. Since context mk IV by default looks
for images in the parent directory, this works.

Closes #3380.
2017-02-25 21:46:41 +01:00
John MacFarlane
a3741a45ab Removed unnecessary import. 2017-02-24 15:57:10 +01:00
John MacFarlane
b8674519d5 Removed useless TEXINPUTS stuff for context2pdf.
mkiv context doesn't use TEXINPUTS.
2017-02-24 14:34:58 +01:00
John MacFarlane
72af7b4ee5 Shared: remove 'warn'.
PDF writer: Use 'report' instead of 'warn', make it sensitive
to verbosity settings.
2017-02-24 14:29:56 +01:00
John MacFarlane
2d964dd4ee PDF: make sure that verbosity is respected when we fetch items. 2017-02-23 15:06:49 +01:00
John MacFarlane
5e1249481b Added Text.Pandoc.Logging (exported module).
This now contains the Verbosity definition previously
in Options, as well as a new LogMessage datatype that
will eventually be used instead of raw strings for
warnings.

This will enable us, among other things, to provide
machine-readable warnings if desired.

See #3392.
2017-02-10 20:59:54 +01:00
John MacFarlane
70b86f48e1 Removed readerVerbosity and writerVerbosity.
API change.

Also added a verbosity parameter to makePDF.
2017-01-25 17:07:43 +01:00
John MacFarlane
8280d6a489 Changes to verbosity in writer and reader options.
API changes: Text.Pandoc.Options:

* Added Verbosity.
* Added writerVerbosity.
* Added readerVerbosity.
* Removed writerVerbose.
* Removed readerTrace.

pandoc CLI:  The `--trace` option sets verbosity to DEBUG;
the `--quiet` option sets it to ERROR, and the `--verbose`
option sets it to INFO.  The default is WARNING.
2017-01-25 17:07:43 +01:00
John MacFarlane
a3c3694024 Removed writerMediaBag from WriterOpts.
...since this is now handled through PandocMonad.

Added an explicit MediaBag parameter to makePDF and makeSelfContained.
2017-01-25 17:07:42 +01:00
John MacFarlane
6aff97e4e1 Text.Pandoc.Shared: Removed fetchItem, fetchItem'.
Made changes where these are used, so that the version
of fetchItem from PandocMonad can be used instead.
2017-01-25 17:07:42 +01:00
John MacFarlane
753c14cb63 PDF: put makePDF in MonadIO. 2017-01-25 17:07:41 +01:00
John MacFarlane
9570f59066 Process.pipeProcess: stream stderr rather than capturing.
Signature of pipeProcess has changed: the return value is
now IO (ExitCode, ByteString) -- with only stdout. Stderr
is just inherited from the parent.

This means that stderr from filters will now be streamed
as the filters are run.

Closes #2729.
2017-01-25 17:07:41 +01:00
Jesse Rosenthal
04487779b2 Convert all writers to use PandocMonad.
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-25 17:07:39 +01:00
Jesse Rosenthal
45c7108b4f Remove Compat.Monoid
This was only necessary for GHC versions with base below 4.5
(i.e., ghc < 7.4).
2016-09-02 09:18:08 -04:00
John MacFarlane
b0013bfb13 PDF: Don't crash with nonexistent image.
Instead, emit the alt text, emphasized.  This accords with what
the ODT writer currently does.

The user will still get a warning about a nonexistent image,
but will no longer get a LaTeX crash.

Closes #3100.
2016-09-02 11:44:50 +02:00
John MacFarlane
499985c1a3 Updated copyright dates to include 2016. 2016-03-22 17:20:39 -07:00
John MacFarlane
4990350fc7 Fixed v1.16 reversion with --latex-engine.
In 1.16 --latex-engine raises an error if a full path is
given. This commit fixes this reversion. Closes #2618.
2016-01-04 22:44:50 -08:00
John MacFarlane
46e38d0a0a Improved treatment of margins in wkhtmltopdf. 2015-12-21 23:47:03 -08:00
John MacFarlane
8b8bdca56a Allow setting margins from metadata variables for wkhtmltopdf.
Variables margin-top, margin-bottom, margin-left, margin-right.
Setting them with css inside @page doesn't seem to work, at least
with the released wkhtmltopdf.
2015-12-21 22:59:01 -08:00
John MacFarlane
0596b65a74 pdf via wkhtmltopdf: take title and page-size from metadata.
Adjusted default `page-size` to `letter`, to match current LaTeX
template.
2015-12-21 22:13:44 -08:00
John MacFarlane
0a768f1cc5 Added preliminary support for PDF creation via wkhtmltopdf.
To use this:

    pandoc -t html5 -o result.pdf

(and add `--mathjax` if you have math.)
2015-12-21 17:22:12 -08:00
John MacFarlane
f7e37141e5 hlint fixes 2015-11-22 07:42:11 -08:00
John MacFarlane
244cd5644b Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into 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-19 23:14:23 -08:00
John MacFarlane
c1e474f005 Restored Text.Pandoc.Compat.Monoid.
Don't use custom prelude for latest ghc.

This is a better approach to making 'stack ghci' and 'cabal repl'
work.  Instead of using NoImplicitPrelude, we only use the custom
prelude for older ghc versions.  The custom prelude presents a
uniform API that matches the current base version's prelude.
So, when developing (presumably with latest ghc), we don't
use a custom prelude at all and hence have no trouble with ghci.

The custom prelude no longer exports (<>):  we now want to
match the base 4.8 prelude behavior.
2015-11-09 11:19:25 -08:00
John MacFarlane
23b693c029 Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."
This reverts commit c423dbb5a3.
2015-11-09 10:08:22 -08:00
John MacFarlane
c423dbb5a3 Use -XNoImplicitPrelude and 'import Prelude' explicitly.
This is needed for ghci to work with pandoc, given that we
now use a custom prelude.

Closes #2503.
2015-11-08 16:56:59 -08:00
John MacFarlane
8193ebcd99 Allow use of ConTeXt to generate PDFs.
pandoc my.md -t context -o my.pdf

will now create a PDF using ConTeXt rather than LaTeX.

Closes #2463.
2015-10-20 08:16:17 -07:00
John MacFarlane
82b3e0ab97 Use custom Prelude to avoid compiler warnings.
- 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-14 09:09:10 -07:00
John MacFarlane
12df4054ad PDF: Modified for new image size attributes parameter.
(mb21)
2015-08-05 16:08:46 +02:00
John MacFarlane
ac79429a12 PDF: Make sure --latex-engine-opt goes before the filename...
on the command line.  LaTeX needs the argument to come after
the options.

Closes #1779 - again!  Thanks to squisher for pointing
out the problem.
2015-07-08 17:37:54 -07:00
John MacFarlane
57e16e3287 PDF writer: Print temp dir on --verbose.
This might help diagnose #777.
2015-05-20 15:43:42 -07:00
John MacFarlane
1868cb5e42 Updated copyright notices to -2015. Closes #2111. 2015-04-26 10:18:29 -07:00
John MacFarlane
5ae48b7eaf Fixed warning. 2015-04-12 22:06:44 -07:00
John MacFarlane
a9628d0745 Text.Pandoc.PDF: more comprehensible errors on image conversion.
Closes #2067.
EPS can't be supported without shelling out to something like
ImageMagick, but at least we can avoid mysterious error messages.

We now get:

    pandoc: Unable to convert `circle.eps' for use with pdflatex.
    ! Package pdftex.def Error: File `circle-eps-converted-to.pdf' not found.

which seems more straightforward.
2015-04-12 21:18:21 -07:00
Sumit Sahrawat
ad9e4cde9d Fix issue #969, #1779 by providing --latex-engine-opt 2015-03-04 15:25:56 +05:30
mb21
6aa41b86d0 don't log Try xelatex if xelatex already in use, closes #1832 2015-01-11 15:24:04 +01:00