Skip to content

Commit

Permalink
Emit PDF metadata
Browse files Browse the repository at this point in the history
Via the **hyperref** package (why oh why?) we set various metadata
fields for the resultant PDF indicating the version of **publish** that
was used and that we are now rendering via lualatex.
  • Loading branch information
istathar committed Jul 19, 2020
1 parent 297b6e2 commit 47f7fef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: publish
version: 2.1.2
version: 2.1.3
synopsis: Publishing tools for papers, books, and presentations
description: |
Tools for rendering markdown-centric documents into PDFs.
Expand Down
16 changes: 15 additions & 1 deletion src/LatexPreamble.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}

module LatexPreamble
( preamble,
Expand All @@ -8,6 +10,7 @@ module LatexPreamble
)
where

import Core.Program.Metadata
import Core.Text

preamble :: Rope
Expand Down Expand Up @@ -92,6 +95,14 @@ preamble =

|]

#ifdef __GHCIDE__
version :: Version
version = "0"
#else
version :: Version
version = $(fromPackage)
#endif

beginning :: Rope
beginning =
[quote|
Expand Down Expand Up @@ -148,8 +159,11 @@ beginning =
\usepackage[normalem]{ulem}
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}

\begin{document}
|]
<> "\\hypersetup{pdfproducer={Markdown and Latex rendered via Publish "
<> intoRope (versionNumberFrom version)
<> "},pdfcreator={lualatex}}\n"
<> "\\begin{document}\n"

ending :: Rope
ending =
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
resolver: lts-15.16
resolver: lts-16.5
packages:
- .

0 comments on commit 47f7fef

Please sign in to comment.