aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANUAL.txt26
-rw-r--r--data/templates/default.context9
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs5
-rw-r--r--test/writer.context3
-rw-r--r--test/writers-lang-and-dir.context3
5 files changed, 34 insertions, 12 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index cc329b972..a623fddfd 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -1,6 +1,6 @@
% Pandoc User's Guide
% John MacFarlane
-% June 11, 2019
+% July 6, 2019
Synopsis
========
@@ -1799,12 +1799,28 @@ Pandoc uses these variables when [creating a PDF] with ConTeXt.
repeat for multiple options
`pdfa`
-: adds to the preamble the setup necessary to generate PDF/A-1b:2005.
+: adds to the preamble the setup necessary to generate PDF/A of the type
+ specified, e.g. `1a:2005`, `2a`. If no type is specified (i.e. the value
+ is set to True, by e.g. `--metadata=pdfa` or `pdfa: true` in a YAML metadata
+ block), `1b:2005` will be used as default, for reasons of backwards
+ compatibility. Using `--variable=pdfa` without specified value is not supported.
To successfully generate PDF/A the required ICC color profiles have to
be available and the content and all included files (such as images)
- have to be standard conforming. The ICC profiles can be obtained
- from [ConTeXt ICC Profiles]. See also [ConTeXt PDFA] for more
- details.
+ have to be standard conforming. The ICC profiles and output intent
+ may be specified using the variables `pdfaiccprofile` and `pdfaintent'.
+ See also [ConTeXt PDFA] for more details.
+
+`pdfaiccprofile`
+: when used in conjunction with `pdfa', specifies the ICC profile to use
+ in the PDF, e.g. `default.cmyk'. If left unspecified, `sRGB.icc' is
+ used as default. May be repeated to include multiple profiles. Note that
+ the profiles have to be available on the system. They can be obtained
+ from [ConTeXt ICC Profiles].
+
+`pdfaintent'
+: when used in conjunction with `pdfa', specifies the output intent for
+ the colors, e.g. `ISO coated v2 300\letterpercent\space (ECI)'
+ If left unspecified, `sRGB IEC61966-2.1' is used as default.
`toc`
: include table of contents (can also be set using `--toc/--table-of-contents`)
diff --git a/data/templates/default.context b/data/templates/default.context
index 879269394..f54b55e74 100644
--- a/data/templates/default.context
+++ b/data/templates/default.context
@@ -27,7 +27,6 @@ $endif$
% make chapter, section bookmarks visible when opening document
\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
\setupinteractionscreen[option=bookmark]
-\setuptagging[state=start]
$if(papersize)$
\setuppapersize[$for(papersize)$$papersize$$sep$,$endfor$]
@@ -41,10 +40,12 @@ $endif$
$if(pdfa)$
% attempt to generate PDF/A
\setupbackend
- [format=PDF/A-1b:2005,
- intent=sRGB IEC61966-2.1,
- profile=sRGB.icc]
+ [format=PDF/A-$pdfa$,
+ profile={$if(pdfaiccprofile)$$for(pdfaiccprofile)$$pdfaiccprofile$$sep$,$endfor$$else$sRGB.icc$endif$},
+ intent=$if(pdfaintent)$$pdfaintent$$else$sRGB IEC61966-2.1$endif$]
$endif$
+\setupbackend[export=yes]
+\setupstructure[state=start,method=auto]
% use microtypography
\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 0b754dd21..7b84eb1f5 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -15,7 +15,7 @@ Conversion of 'Pandoc' format into ConTeXt.
module Text.Pandoc.Writers.ConTeXt ( writeConTeXt ) where
import Prelude
import Control.Monad.State.Strict
-import Data.Char (ord, isDigit)
+import Data.Char (ord, isDigit, toLower)
import Data.List (intercalate, intersperse)
import Data.Maybe (mapMaybe)
import Data.Text (Text)
@@ -93,6 +93,9 @@ pandocToConTeXt options (Pandoc meta blocks) = do
Just (('a':d:ds) :: String)
| all isDigit (d:ds) -> resetField "papersize"
(('A':d:ds) :: String)
+ _ -> id)
+ $ (case toLower <$> lookupMetaString "pdfa" meta of
+ "true" -> resetField "pdfa" ("1b:2005" :: String)
_ -> id) metadata
let context' = defField "context-dir" (toContextDir
$ getField "dir" context) context
diff --git a/test/writer.context b/test/writer.context
index d6a36f0dd..619124788 100644
--- a/test/writer.context
+++ b/test/writer.context
@@ -10,8 +10,9 @@
% make chapter, section bookmarks visible when opening document
\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
\setupinteractionscreen[option=bookmark]
-\setuptagging[state=start]
+\setupbackend[export=yes]
+\setupstructure[state=start,method=auto]
% use microtypography
\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]
diff --git a/test/writers-lang-and-dir.context b/test/writers-lang-and-dir.context
index 3b29763d7..d58164f38 100644
--- a/test/writers-lang-and-dir.context
+++ b/test/writers-lang-and-dir.context
@@ -8,8 +8,9 @@
% make chapter, section bookmarks visible when opening document
\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
\setupinteractionscreen[option=bookmark]
-\setuptagging[state=start]
+\setupbackend[export=yes]
+\setupstructure[state=start,method=auto]
% use microtypography
\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]