Commit graph

122 commits

Author SHA1 Message Date
John MacFarlane
b6f9318c9b PDF: Better detection of a Cygwin environment.
Should close .

Unlike the earlier fix, this one doesn't spill out to stderr
when 'uname -o' fails.
2019-07-20 16:50:53 -07:00
John MacFarlane
fb73b5c27b Revert "PDF: create temp dir in . on Cygwin."
This reverts commit 50885eabde.

Reopens .

The problem with the previous commit is that it would lead to
spurious messages on stderr on platforms like macOS.
2019-07-20 12:59:34 -07:00
John MacFarlane
50885eabde PDF: create temp dir in . on Cygwin.
See .
2019-07-19 09:41:19 -07:00
John MacFarlane
931030d95d PDF via ms: make TOC appear at beginning and in PDF bookmarks.
Previously the TOC appeared at the end of the document,
and was not bookmarked.

If you want it to continue appearing at the end, add
`--pdf-engine-opt=--no-toc-relocation` to your command
line.

Closes .
2019-06-08 11:53:37 -07:00
John MacFarlane
39a3a025da Add unicode code point in "Missing character" warning.
If the character isn't in the console font, the
message is pretty useless, so we show the code
point for anything non-ASCII.

Closes .
2019-05-30 17:31:09 -07:00
John MacFarlane
d88a601642 Allow use of -output-directory in --pdf-engine-opt.
This is currently possible with `mklatex` and `-outdir`, but
was not yet possible with xelatex and `-output-directory`.
Closes .
2019-04-23 10:08:25 -07:00
John MacFarlane
e1cc73ed97 Text.Pandoc.PDF: replace </> with literal "/".
We use forward-slash for a directory separator in tmpDir,
even on Windows (because that's what tex likes).  So we
should not put a backslash between the tmpDir and the
filename on Windows.  This is harmless enough in normal
Windows setups, but it breaks on Cygwin.

Closes .  Thanks to @cc2x for noticing and diagnosing
the problem.
2019-04-16 21:12:42 -07:00
John MacFarlane
3ecc8d154b Drop support for ghc < 8. 2019-03-27 11:38:24 -07:00
Cormac Relf
d638873433 Add tectonic as an option for --pdf-engine. ()
Closes 

Runs tectonic on STDIN instead of a temporary .tex file, so that it
looks in the working directory for `\include` and `\input` like the rest
of the engines.

Allows overriding the output directory without messing up the args
with `--pdf-engine-opt=--outdir --pdf-engine-opt="$DIR"`.
2019-03-07 10:16:40 -07:00
John MacFarlane
1eae1e53b3 PDF: change types of subsidiary functions to PandocIO,...
...to allow warnings to be threaded through.

Additional fix for .
2019-03-01 11:20:34 -08:00
John MacFarlane
89ccbc171b Make --fail-if-warnings work for PDF output.
Closes .
2019-03-01 10:57:10 -08:00
John MacFarlane
f3080c0c22 Remove license boilerplate.
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-03-01 10:27:06 -08:00
John MacFarlane
11aa5fd288 Add latexmk as an option for --pdf-engine.
Closes .

Note that you can use --pdf-engine-opt=-outdir=bar to specify
a persistent temp dir.
2019-02-27 23:55:17 -08:00
Albert Krewinkel
37a82b0b11 Add missing copyright notices and remove license boilerplate ()
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 .
2019-02-04 13:52:31 -08:00
John MacFarlane
cb1ede5b08 PDF: More conservative solution to .
Now, instead of always creating temp dirs in the home
directory on Windows, we only do it if the system tempdir
name contains tildes.  (This will be the case for longer
usernames only.)

Closes .
2019-02-02 12:35:27 -08:00
John MacFarlane
737c0a684e PDF: use system temp dir and set TEXMFOUTPUT.
Previously the temp directory was created inside the working
directory, so that programs like epstopdf.pl would be allowed
to run in restricted mode.  However, setting TEXMFOUTPUT allows
these programs to run in the tmpdir inside the system temp
directory.

This is a better solution than cd51983.  Using the system
temp dir prevents problems when pandoc is run inside a synced
directory (e.g. dropbox).

Partially addresses .
2019-02-02 11:31:29 -08:00
Antonio Terceiro
4dddfbc435 PDF: fix reference to rsvg-convert ()
When rsvg-convert is not available, pandoc would tell the user to check for rsvg2pdf instead
2018-08-24 09:43:29 -07:00
John MacFarlane
146555e636 PDF: revert fix for (only compress images on last run).
Closes .

This will mean some increase in the time it takes to
produce an image-heavy PDF with xelatex, but it will
make tables of contents correct, which is more important.

Note that the production time should also be decreased
by the previous commit, which fixed a logic error
affecting the number of runs.  That change might mitigate
the effect of this one.
2018-07-06 23:51:20 +02:00
John MacFarlane
55e8cb07d0 PDF: Fix logic error in runTeXProgram.
We were running the tex program one more time than requested.
This should speed up pdf production.
2018-07-06 23:43:43 +02:00
Mauro Bieg
764bf86177 Regression: make --pdf-engine work with full paths ()
Fixes .
2018-06-03 13:59:11 -07:00
Mauro Bieg
7c0ef68311 Revert piping html to pdf-engine ()
* Revert "PDF: Use withTempDir in html2pdf."  We're going back to using tmpFile instead of piping
* Revert "html2pdf: inject base tag wih current working directory ()"

Fixes 
2018-05-05 09:31:17 -07:00
John MacFarlane
229db80ac2 makePDF: Don't try to convert eps files.
pdflatex converts them itself, and JuicyPixels can't do it.
See .
2018-04-21 12:28:30 -07:00
John MacFarlane
cd51983afe makePDF: For pdflatex, use a temp dir in the working directory.
Otherwise we can have problems with things like epstopdf.pl,
which pdflatex runs to convert eps files and which won't run
on a file above the working directory in restricted mode.
2018-04-21 12:27:30 -07:00
John MacFarlane
72878adc63 PDF: Use withTempDir in html2pdf.
This is intended to help with , a problem on Windows
where using weasyprint led to a blank PDF.
2018-04-09 09:49:09 -07:00
John MacFarlane
2ae0c0d433 PDF: with xelatex, don't compress images til the last run.
This saves time for image-heavy documents.  Closes .
2018-03-23 12:58:05 -07:00
John MacFarlane
7e389cb3db Use NoImplicitPrelude and explicitly import Prelude.
This seems to be necessary if we are to use our custom Prelude
with ghci.

Closes .
2018-03-18 10:46:28 -07:00
John MacFarlane
f0b6e0ee49 Monoid/Semiground cleanup relying on custom Prelude. 2018-03-16 12:17:58 -07:00
Mauro Bieg
15f700d8ed html2pdf: inject base tag wih current working directory ()
fixes 
2018-03-11 18:21:15 -07:00
newmana
6b40b8c27c Add header and footer parameters 2018-01-10 13:58:35 +10:00
Albert Krewinkel
0d935bd081
Update copyright notices to include 2018 2018-01-05 20:39:12 +01:00
John MacFarlane
cbcb9b36c0 hlint suggestions. 2017-10-27 23:13:55 -07:00
John MacFarlane
b201a8aa58 hlint changes. 2017-10-27 21:32:53 -07:00
John MacFarlane
ff16db1aa3 Automatic reformating by stylish-haskell. 2017-10-27 20:28:29 -07:00
John MacFarlane
424e94bd45 makePDF: add argument for pdf options, remove writerPdfArgs.
- Removed writerPdfArgs from WriterOptions (API change).
- Added parameter for pdf args to makePDF.
2017-10-26 11:11:45 -07:00
John MacFarlane
dfe816163c Removed Verbosity and MediaBag params from makePDF.
They can be obtained from CommonState since we're
in PandocIO.
2017-09-30 17:17:39 -05:00
John MacFarlane
f3a80034ff Removed writerSourceURL, add source URL to common state.
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-09-30 16:11:20 -05:00
Mauro Bieg
c7e3c1ec17 Support for PDF generation via weasyprint and prince ()
* Rename --latex-engine to --pdf-engine
* In `Text.Pandoc.Options.WriterOptions`, rename `writerLaTeXEngine` to `writerPdfEngine` and `writerLaTeXArgs` to `writerPdfArgs`.
 * Add support for `weasyprint` and `prince`, in addition to `wkhtmltopdf`, for PDF generation via HTML (closes ).
* `Text.Pandoc.PDF.html2pdf`: use stdin instead of intermediate HTML file
2017-09-11 20:18:42 -07:00
John MacFarlane
708bb8afe4 Fix import in PDF. 2017-08-16 10:13:16 -07:00
John MacFarlane
f8b6a224ae Remove initial check for pdf creating program.
Instead, just try running it and raise the exception if it
isn't found at that point.

This improves things for users of Cygwin on Windows, where
the executable won't be found by `findExecutable` unless
`.exe` is added.

The same exception is raised as before, but at a later
point.

Closes .
2017-08-15 21:17:20 -07:00
John MacFarlane
6b72c5e35b Support svg in PDF output, converting with rsvg2pdf.
Closes .
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 .
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 .
2017-06-11 00:46:31 +02:00
John MacFarlane
6a7f980247 PDF: Got --resource-path working with pdf output.
See .
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