aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/PDF.hs
AgeCommit message (Collapse)AuthorFilesLines
2020-06-28PDF: all verbose output now goes to stderr, not stdout.John MacFarlane1-21/+21
Closes #6483.
2020-06-22Use --enable-local-file-access in invoking wkhtmltopdf.John MacFarlane1-1/+2
wkhtmltopdf changed in recent versions to require this for access to local files. This fixes PDF via HTML5 with `--css`. Closes #6474.
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-3/+3
This should speed-up recompilation after changes in `Text.Pandoc.Class`, as the number of modules affected by a change will be smaller in general. It also offers faster insights into the parts of `T.P.Class` used within a module.
2020-03-15Use implicit Prelude (#6187)Albert Krewinkel1-2/+0
* Use implicit Prelude The previous behavior was introduced as a fix for #4464. It seems that this change alone did not fix the issue, and `stack ghci` and `cabal repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded for these versions. Given this, it seems cleaner to revert to the implicit Prelude. * PandocMonad: remove outdated check for base version Only base versions 4.9 and later are supported, the check for `MIN_VERSION_base(4,8,0)` is therefore unnecessary. * Always use custom prelude Previously, the custom prelude was used only with older GHC versions, as a workaround for problems with ghci. The ghci problems are resolved by replacing package `base` with `base-noprelude`, allowing for consistent use of the custom prelude across all GHC versions.
2020-03-13Update copyright year (#6186)Albert Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-03-02PDF via wkhtmltopdf: put user-specified options last.John MacFarlane1-2/+2
Certain options (e.g. "cover") need to come after flags on the command line. Closes #6171.
2020-02-07Resolve HLint warningsAlbert Krewinkel1-2/+2
All warnings are either fixed or, if more appropriate, HLint is configured to ignore them. HLint suggestions remain. * Ignore "Use camelCase" warnings in Lua and legacy code * Fix or ignore remaining HLint warnings * Remove redundant brackets * Remove redundant `return`s * Remove redundant as-pattern * Fuse mapM_/map * Use `.` to shorten code * Remove redundant `fmap` * Remove unused LANGUAGE pragmas * Hoist `not` in Text.Pandoc.App * Use fewer imports for `Text.DocTemplates` * Remove redundant `do`s * Remove redundant `$`s * Jira reader: remove unnecessary parentheses
2020-02-07Various minor cleanups and refactoring (#6117)Joseph C. Sible1-4/+1
* Use concatMap instead of reimplementing it * Replace an unnecessary multi-way if with a regular if * Use sortOn instead of sortBy and comparing * Use guards instead of lots of indents for if and else * Remove redundant do blocks * Extract common functions from both branches of maybe Whenever both the Nothing and the Just branch of maybe do the same function, do that function on the result of maybe instead. * Use fmap instead of reimplementing it from maybe * Use negative forms instead of negating the positive forms * Use mapMaybe instead of mapping and then using catMaybes * Use zipWith instead of mapping over the result of zip * Use unwords instead of reimplementing it * Use <$ instead of <$> and const * Replace case of Bool with if and else * Use find instead of listToMaybe and filter * Use zipWithM instead of mapM and zip * Inline lambda wrappers into the real functions * We get zipWithM from Text.Pandoc.Writers.Shared * Use maybe instead of fromMaybe and fmap I'm not sure how this one slipped past me. * Increase a bit of indentation
2020-02-03Clean up overcomplicated maybe logic (#6105)Joseph C. Sible1-8/+6
We're using maybe in redundant ways. Remove it altogether in one case and simplify it to fromMaybe in another.
2020-01-04Remove unneeded import.John MacFarlane1-1/+1
2020-01-03PDF: fix runTeXProgram so that the input source is always overwritten.John MacFarlane1-22/+23
Previously it wasn't overridden if the file already existed, which led to bad results on subsequent runs when `pdf-engine-opt=-output-directory=` was used to specify an explicit temp dir. Closes #6027.
2019-12-17PDF: Ensure UTF8 when printing source in --verbose mode.John MacFarlane1-1/+1
This may fix #5997.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-17/+16
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-03PDF: don't assume tex log file is UTF8-encoded.John MacFarlane1-2/+11
Fall back to latin1 if it can't be read as UTF-8. Closes #5872.
2019-10-29Changes to build with new doctemplates/doclayout.John MacFarlane1-1/+5
The new version of doctemplates adds many features to pandoc's templating system, while remaining backwards-compatible. New features include partials and filters. Using template filters, one can lay out data in enumerated lists and tables. Templates are now layout-sensitive: so, for example, if a text with soft line breaks is interpolated near the end of a line, the text will break and wrap naturally. This makes the templating system much more suitable for programatically generating markdown or other plain-text files from metadata.
2019-10-04Fix compiler warnings on ghc 8.8.John MacFarlane1-21/+12
2019-09-16PDF: Fix test for Cygwin. See #5451.John MacFarlane1-2/+2
2019-09-10Pass value of --dpi to rsvg-convert...John MacFarlane1-11/+15
when converting SVG to PDF in the process of creating a PDF. Closes #5721.
2019-08-31html2pdf: ensure temp file is deleted...John MacFarlane1-34/+35
even if the pdf program is not found. Closes #5720.
2019-08-25Use new doctemplates, doclayout.John MacFarlane1-8/+8
+ Remove Text.Pandoc.Pretty; use doclayout instead. [API change] + Text.Pandoc.Writers.Shared: remove metaToJSON, metaToJSON' [API change]. + Text.Pandoc.Writers.Shared: modify `addVariablesToContext`, `defField`, `setField`, `getField`, `resetField` to work with Context rather than JSON values. [API change] + Text.Pandoc.Writers.Shared: export new function `endsWithPlain` [API change]. + Use new templates and doclayout in writers. + Use Doc-based templates in all writers. + Adjust three tests for minor template rendering differences. + Added indentation to body in docbook4, docbook5 templates. The main impact of this change is better reflowing of content interpolated into templates. Previously, interpolated variables were rendered independently and intepolated as strings, which could lead to overly long lines. Now the templates interpolated as Doc values which may include breaking spaces, and reflowing occurs after template interpolation rather than before.
2019-07-20PDF: Better detection of a Cygwin environment.John MacFarlane1-1/+8
Should close #5451. Unlike the earlier fix, this one doesn't spill out to stderr when 'uname -o' fails.
2019-07-20Revert "PDF: create temp dir in . on Cygwin."John MacFarlane1-4/+1
This reverts commit 50885eabde6e9ba524d74a234154766f4c522627. Reopens #5451. The problem with the previous commit is that it would lead to spurious messages on stderr on platforms like macOS.
2019-07-19PDF: create temp dir in . on Cygwin.John MacFarlane1-1/+4
See #5451.
2019-06-08PDF via ms: make TOC appear at beginning and in PDF bookmarks.John MacFarlane1-2/+2
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 #5553.
2019-05-30Add unicode code point in "Missing character" warning.John MacFarlane1-1/+8
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 #5538.
2019-04-23Allow use of -output-directory in --pdf-engine-opt.John MacFarlane1-4/+6
This is currently possible with `mklatex` and `-outdir`, but was not yet possible with xelatex and `-output-directory`. Closes #5462.
2019-04-16Text.Pandoc.PDF: replace `</>` with literal "/".John MacFarlane1-2/+2
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 #5451. Thanks to @cc2x for noticing and diagnosing the problem.
2019-03-27Drop support for ghc < 8.John MacFarlane1-4/+0
2019-03-07Add tectonic as an option for --pdf-engine. (#5346)Cormac Relf1-29/+81
Closes #5345 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-01PDF: change types of subsidiary functions to PandocIO,...John MacFarlane1-70/+70
...to allow warnings to be threaded through. Additional fix for #5343.
2019-03-01Make `--fail-if-warnings` work for PDF output.John MacFarlane1-4/+10
Closes #5343.
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-27Add latexmk as an option for --pdf-engine.John MacFarlane1-79/+72
Closes #3195. Note that you can use --pdf-engine-opt=-outdir=bar to specify a persistent temp dir.
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-02-02PDF: More conservative solution to #777.John MacFarlane1-2/+11
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 #1192.
2019-02-02PDF: use system temp dir and set TEXMFOUTPUT.John MacFarlane1-8/+5
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 #1192.
2018-08-24PDF: fix reference to rsvg-convert (#4855)Antonio Terceiro1-1/+1
When rsvg-convert is not available, pandoc would tell the user to check for rsvg2pdf instead
2018-07-06PDF: revert fix for #4484 (only compress images on last run).John MacFarlane1-6/+1
Closes #4755. 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-06PDF: Fix logic error in runTeXProgram.John MacFarlane1-1/+1
We were running the tex program one more time than requested. This should speed up pdf production.
2018-06-03Regression: make --pdf-engine work with full paths (#4682)Mauro Bieg1-51/+60
Fixes #4681.
2018-05-05Revert piping html to pdf-engine (#4628)Mauro Bieg1-50/+46
* 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 (#4443)" Fixes #4413
2018-04-21makePDF: Don't try to convert eps files.John MacFarlane1-0/+2
pdflatex converts them itself, and JuicyPixels can't do it. See #2067.
2018-04-21makePDF: For pdflatex, use a temp dir in the working directory.John MacFarlane1-3/+5
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-09PDF: Use withTempDir in html2pdf.John MacFarlane1-38/+39
This is intended to help with #4524, a problem on Windows where using weasyprint led to a blank PDF.
2018-03-23PDF: with xelatex, don't compress images til the last run.John MacFarlane1-1/+6
This saves time for image-heavy documents. Closes #4484.
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-16Monoid/Semiground cleanup relying on custom Prelude.John MacFarlane1-1/+0
2018-03-11html2pdf: inject base tag wih current working directory (#4443)Mauro Bieg1-1/+9
fixes #4413
2018-01-10Add header and footer parametersnewmana1-0/+4
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2