summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/PDF.hs
AgeCommit message (Collapse)Author
2024-02-15PDF: internal cleanup of tex2pdf path.John MacFarlane
Distinguish tmpDir and outDir, since they can come apart in the latexmk case.
2024-02-14PDF: avoid readFileLazy.John MacFarlane
My hunch is that this is causing improperly cleaned up temp directory on Windows (#9460), but this will have to be confirmed.
2024-01-06T.P.PDF: reliably detect when TOC has changed.John MacFarlane
Sometimes the TOC changes but there are no warnings: this happens when no labels are present. In this case we must rerun LaTeX. So we now take the sha1 hash of the TOC file and rerun LaTeX if it changes between runs. Closes #9295.
2024-01-05T.P.PDF: increase max number of LaTeX runs to 4.John MacFarlane
On some documents, 4 runs are needed (e.g. when a LastPage reference is used). Closes #9299.
2024-01-04PDF: expand list of environment variables to display in verbose output.John MacFarlane
Closes #9303.
2023-12-24T.P.PDF: Ensure that we find all the LaTeX warnings requiring rerun.John MacFarlane
This should fix a regression from 3.1.9 that led to incorrect alignments in tables (and possibly other issues). Closes #9284.
2023-12-15Logging: add MakePDFWarning constructor to LogMessage.John MacFarlane
[API change] Use this to pass LaTeX warnings on to user as warnings.
2023-12-15Logging: add MakePDFInfo constructor to LogMessage.John MacFarlane
[API change] Use this with `report` in Text.Pandoc.PDF instead of manually writing to stderr.
2023-12-15PDF: Refactored PDF generation via LaTeX.John MacFarlane
2023-12-15Text.Pandoc.PDF: parse logs to determine whether additional runs needed.John MacFarlane
Previously we ran a fixed number of times. Closes #9255.
2023-11-03LaTeX template: include bookmark package unconditionally.John MacFarlane
This package produces better PDF bookmarks than hyperref and does it on the first pass. As a consequence, we now default to running LaTeX only once in producing a PDF (instead of twice). If a table of contents is present, we still have to run three times to get the page numbers.
2023-09-14Ms writer: improvements in image handling.John MacFarlane
See #4475. + PDFPIC is now used for PDF images in figures. + Inline images that are postscript or PDF are rendered using PSPIC or PDFPIC. This isn't ideal, because they will still be rendered as if in a separate paragraph, but it's probably better than just printing the image name. + Units are included in height. For further improvement, we might consider in Text.Pandoc.PDF using something like `convertImages` (which we currently use for converting to PDF via LaTeX) to convert SVG (and other?) images to PDF so they can be rendered in this way.
2023-04-05Fix pdf output via typst for the typst 0.1.0 release.John MacFarlane
One must now use `typst compile` rather than `typst`. Closes #8754.
2023-03-26Support typst as a pdf-engine.John MacFarlane
2023-01-10Update copyright years, it's 2023!Albert Krewinkel
2022-10-27T.P.PDF: fix papersize on PDF generation via ms.John MacFarlane
We need to set an option in pdfroff in addition to including a macro in the ms file. With this fix, `-Vpapersize=a4` should be sufficient to produce A4 PDF via ms. Closes #8403.
2022-08-13PDF: Use some standard PandocMonad functions instead of liftIO.John MacFarlane
2022-06-24PDF: use sha1 hash of filename when converting svg.John MacFarlane
The previous code threw away the directory component of the filename in constructing a new one. This led to surprising results if you had e.g. `foo/pic.svg` and `bar/pic.svg`; in the final PDF they'd be the same image, because the latter would overwrite the former in the temp directory.
2022-01-17PDF: support pagedjs-cli as pdf engine (#7838)Albert Krewinkel
PagedJS is a polyfill and supports the Paged Media standards by the W3C. <https://www.pagedjs.org/>
2022-01-02Copyright notices: update for 2022Albert Krewinkel
2021-08-24PDF: generalize type of makePDF...John MacFarlane
instead of PandocIO, it can be used in any instance of PandocMonad, MonadIO, and MonadMask. [API change]
2021-08-22Clean up PDF module.John MacFarlane
Previously we had to run runIOorExplode inside withTempDir. Now that PandocIO is an instance of MonadMask, this is no longer necessary.
2021-07-16PDF: Fix svgIn path error.John MacFarlane
We were duplicating the temp directory; this didn't show up on macOS or linux because there we use absolute paths for the temp directory. Closes #7431.
2021-07-06T.P.PDF, convertImage: normalize paths.John MacFarlane
This will avoid paths on Windows with mixed path separators, which may cause problems with SVG conversion. See #7431.
2021-06-02Text.Pandoc.PDF: only print relevant part of environment on `--verbose`.John MacFarlane
2021-06-02Fix regression in 2.14 for generation of PDFs with SVGs.John MacFarlane
Closes #7344.
2021-02-22Text.Pandoc.UTF8: change IO functions to return Text, not String.John MacFarlane
[API change] This affects `readFile`, `getContents`, `writeFileWith`, `writeFile`, `putStrWith`, `putStr`, `putStrLnWith`, `putStrLn`. `hPutStrWith`, `hPutStr`, `hPutStrLnWith`, `hPutStrLn`, `hGetContents`. This avoids the need to uselessly create a linked list of characters when emiting output.
2021-02-18T.P.PDF: disable `smart` when building PDF via LaTeX.John MacFarlane
This is to prevent accidental creation of ligatures like `` ?` `` and `` !` `` (especially in languages with quotations like German), and similar ligature issues. See jgm/citeproc#54.
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel
2020-11-15Text.Pandoc.PDF: Fix `changePathSeparators` for Windows.John MacFarlane
Previously a path beginning with a drive, like `C:\foo\bar`, was translated to `C:\/foo/bar`, which caused problems. With this fix, the backslashes are removed. Closes #6173.
2020-09-13Fix hlint suggestions, update hlint.yaml (#6680)Christian Despres
* Fix hlint suggestions, update hlint.yaml Most suggestions were redundant brackets. Some required LambdaCase. The .hlint.yaml file had a small typo, and didn't ignore camelCase suggestions in certain modules.
2020-06-28PDF: all verbose output now goes to stderr, not stdout.John MacFarlane
Closes #6483.
2020-06-22Use --enable-local-file-access in invoking wkhtmltopdf.John MacFarlane
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 Krewinkel
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 Krewinkel
* 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 Krewinkel
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-03-02PDF via wkhtmltopdf: put user-specified options last.John MacFarlane
Certain options (e.g. "cover") need to come after flags on the command line. Closes #6171.
2020-02-07Resolve HLint warningsAlbert Krewinkel
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. Sible
* 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. Sible
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 MacFarlane
2020-01-03PDF: fix runTeXProgram so that the input source is always overwritten.John MacFarlane
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 MacFarlane
This may fix #5997.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc
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 MacFarlane
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 MacFarlane
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 MacFarlane
2019-09-16PDF: Fix test for Cygwin. See #5451.John MacFarlane
2019-09-10Pass value of --dpi to rsvg-convert...John MacFarlane
when converting SVG to PDF in the process of creating a PDF. Closes #5721.
2019-08-31html2pdf: ensure temp file is deleted...John MacFarlane
even if the pdf program is not found. Closes #5720.