diff options
| author | John MacFarlane <[email protected]> | 2025-05-15 11:37:50 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2025-05-15 11:37:50 -0700 |
| commit | cf795b0cf5bb76ced10578385e82acc6e327efcb (patch) | |
| tree | 037b0c282d10c7f8586ff2a3ecd104d9b217c390 | |
| parent | 2918ac41b39a1828b7bf30391a7fca4d06a21134 (diff) | |
Fix context writer/template to produce tagged PDFs.
As before, the `tagging` extension must be enabled.
We now add the command that tells ConTeXt to start tagging.
Closes #10846.
| -rw-r--r-- | MANUAL.txt | 5 | ||||
| -rw-r--r-- | data/templates/default.context | 4 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/ConTeXt.hs | 1 |
3 files changed, 7 insertions, 3 deletions
diff --git a/MANUAL.txt b/MANUAL.txt index 5c14f9dc7..0891a8096 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -7590,10 +7590,9 @@ ConTeXt always produces tagged PDFs, but the quality depends on the input. The default ConTeXt markup generated by pandoc is optimized for readability and reuse, not tagging. Enable the [`tagging`](#extension--tagging) format extension to force markup -that is optimized for tagging. This can be combined with the -`pdfa` variable to generate standard-compliant PDFs. E.g.: +that is optimized for tagging. For example: - pandoc --to=context+tagging -V pdfa=3a + pandoc -t context+tagging doc.md -o doc.pdf A recent `context` version should be used, as older versions contained a bug that lead to invalid PDF metadata. diff --git a/data/templates/default.context b/data/templates/default.context index 4814333cd..a2a5a45bb 100644 --- a/data/templates/default.context +++ b/data/templates/default.context @@ -1,3 +1,7 @@ +$if(tagging)$ +\setupbackend[format=pdf/ua-2] +\setuptagging[state=start] +$endif$ $if(context-lang)$ \mainlanguage[$context-lang$] $endif$ diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index 9e35c803b..65a0fa9dd 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -117,6 +117,7 @@ pandocToConTeXt options (Pandoc meta blocks) = do "subsubsubsection","subsubsubsubsection"]) $ defField "body" main $ defField "layout" layoutFromMargins + $ defField "tagging" (isEnabled Ext_tagging options) $ defField "number-sections" (writerNumberSections options) $ defField "csl-refs" (stHasCslRefs st) $ defField "csl-hanging-indent" (stCslHangingIndent st) |
