Skip to content

Commit 173fe94

Browse files
committed
add support for tagpdf
1 parent 75fbfd0 commit 173fe94

File tree

8 files changed

+118
-19
lines changed

8 files changed

+118
-19
lines changed

src/resources/editor/tools/vs-code.mjs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22458,6 +22458,8 @@ var require_yaml_intelligence_resources = __commonJS({
2245822458
"Names of customizeable logos",
2245922459
"Path or brand.yml logo resource name.",
2246022460
"Alternative text for the logo, used for accessibility.",
22461+
"Path or brand.yml logo resource name.",
22462+
"Alternative text for the logo, used for accessibility.",
2246122463
"Any of the ways a logo can be specified: string, object, or\nlight/dark object of string or object",
2246222464
"Specification of a light logo",
2246322465
"Specification of a dark logo",
@@ -24292,6 +24294,7 @@ var require_yaml_intelligence_resources = __commonJS({
2429224294
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019.",
2429324295
"When defined, run axe-core accessibility tests on the document.",
2429424296
"If set, output axe-core results on console. <code>json</code>:\nproduce structured output; <code>console</code>: print output to\njavascript console; <code>document</code>: produce a visual report of\nviolations in the document itself.",
24297+
"The logo image.",
2429524298
"Project configuration.",
2429624299
"Project type (<code>default</code>, <code>website</code>,\n<code>book</code>, or <code>manuscript</code>)",
2429724300
"Files to render (defaults to all files)",
@@ -24638,9 +24641,10 @@ var require_yaml_intelligence_resources = __commonJS({
2463824641
"Manuscript configuration",
2463924642
"internal-schema-hack",
2464024643
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019.",
24641-
"Path or brand.yml logo resource name.",
24642-
"Alternative text for the logo, used for accessibility.",
24643-
"The logo image."
24644+
{
24645+
short: "If true, enable <code>tagpdf</code> support for accessible PDFs",
24646+
long: "If true, enable <code>tagpdf</code> support for accessible PDFs. This\nwill ensure that the PDF is tagged and that images have alt text. Note\nthat this requires a LaTeX engine that supports PDF tagging (e.g.,\n<code>lualatex</code>)."
24647+
}
2464424648
],
2464524649
"schema/external-schemas.yml": [
2464624650
{
@@ -24869,12 +24873,12 @@ var require_yaml_intelligence_resources = __commonJS({
2486924873
mermaid: "%%"
2487024874
},
2487124875
"handlers/mermaid/schema.yml": {
24872-
_internalId: 197511,
24876+
_internalId: 197463,
2487324877
type: "object",
2487424878
description: "be an object",
2487524879
properties: {
2487624880
"mermaid-format": {
24877-
_internalId: 197503,
24881+
_internalId: 197455,
2487824882
type: "enum",
2487924883
enum: [
2488024884
"png",
@@ -24890,7 +24894,7 @@ var require_yaml_intelligence_resources = __commonJS({
2489024894
exhaustiveCompletions: true
2489124895
},
2489224896
theme: {
24893-
_internalId: 197510,
24897+
_internalId: 197462,
2489424898
type: "anyOf",
2489524899
anyOf: [
2489624900
{
@@ -24954,6 +24958,20 @@ var require_yaml_intelligence_resources = __commonJS({
2495424958
]
2495524959
},
2495624960
description: "When defined, run axe-core accessibility tests on the document."
24961+
},
24962+
{
24963+
name: "tagpdf",
24964+
tags: {
24965+
formats: [
24966+
"pdf"
24967+
]
24968+
},
24969+
schema: "boolean",
24970+
default: true,
24971+
description: {
24972+
short: "If true, enable `tagpdf` support for accessible PDFs",
24973+
long: "If true, enable `tagpdf` support for accessible PDFs. This will\nensure that the PDF is tagged and that images have alt text.\nNote that this requires a LaTeX engine that supports PDF tagging\n(e.g., `lualatex`).\n"
24974+
}
2495724975
}
2495824976
],
2495924977
"schema/document-typst.yml": [

src/resources/editor/tools/yaml/all-schema-definitions.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/resources/editor/tools/yaml/web-worker.js

Lines changed: 24 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/resources/editor/tools/yaml/yaml-intelligence-resources.json

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15430,6 +15430,8 @@
1543015430
"Names of customizeable logos",
1543115431
"Path or brand.yml logo resource name.",
1543215432
"Alternative text for the logo, used for accessibility.",
15433+
"Path or brand.yml logo resource name.",
15434+
"Alternative text for the logo, used for accessibility.",
1543315435
"Any of the ways a logo can be specified: string, object, or\nlight/dark object of string or object",
1543415436
"Specification of a light logo",
1543515437
"Specification of a dark logo",
@@ -17264,6 +17266,7 @@
1726417266
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto’s default order\nis ‘knitr’, ‘jupyter’, ‘markdown’, ‘julia’.",
1726517267
"When defined, run axe-core accessibility tests on the document.",
1726617268
"If set, output axe-core results on console. <code>json</code>:\nproduce structured output; <code>console</code>: print output to\njavascript console; <code>document</code>: produce a visual report of\nviolations in the document itself.",
17269+
"The logo image.",
1726717270
"Project configuration.",
1726817271
"Project type (<code>default</code>, <code>website</code>,\n<code>book</code>, or <code>manuscript</code>)",
1726917272
"Files to render (defaults to all files)",
@@ -17610,9 +17613,10 @@
1761017613
"Manuscript configuration",
1761117614
"internal-schema-hack",
1761217615
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto’s default order\nis ‘knitr’, ‘jupyter’, ‘markdown’, ‘julia’.",
17613-
"Path or brand.yml logo resource name.",
17614-
"Alternative text for the logo, used for accessibility.",
17615-
"The logo image."
17616+
{
17617+
"short": "If true, enable <code>tagpdf</code> support for accessible PDFs",
17618+
"long": "If true, enable <code>tagpdf</code> support for accessible PDFs. This\nwill ensure that the PDF is tagged and that images have alt text. Note\nthat this requires a LaTeX engine that supports PDF tagging (e.g.,\n<code>lualatex</code>)."
17619+
}
1761617620
],
1761717621
"schema/external-schemas.yml": [
1761817622
{
@@ -17841,12 +17845,12 @@
1784117845
"mermaid": "%%"
1784217846
},
1784317847
"handlers/mermaid/schema.yml": {
17844-
"_internalId": 197511,
17848+
"_internalId": 197463,
1784517849
"type": "object",
1784617850
"description": "be an object",
1784717851
"properties": {
1784817852
"mermaid-format": {
17849-
"_internalId": 197503,
17853+
"_internalId": 197455,
1785017854
"type": "enum",
1785117855
"enum": [
1785217856
"png",
@@ -17862,7 +17866,7 @@
1786217866
"exhaustiveCompletions": true
1786317867
},
1786417868
"theme": {
17865-
"_internalId": 197510,
17869+
"_internalId": 197462,
1786617870
"type": "anyOf",
1786717871
"anyOf": [
1786817872
{
@@ -17926,6 +17930,20 @@
1792617930
]
1792717931
},
1792817932
"description": "When defined, run axe-core accessibility tests on the document."
17933+
},
17934+
{
17935+
"name": "tagpdf",
17936+
"tags": {
17937+
"formats": [
17938+
"pdf"
17939+
]
17940+
},
17941+
"schema": "boolean",
17942+
"default": true,
17943+
"description": {
17944+
"short": "If true, enable `tagpdf` support for accessible PDFs",
17945+
"long": "If true, enable `tagpdf` support for accessible PDFs. This will\nensure that the PDF is tagged and that images have alt text.\nNote that this requires a LaTeX engine that supports PDF tagging\n(e.g., `lualatex`).\n"
17946+
}
1792917947
}
1793017948
],
1793117949
"schema/document-typst.yml": [

src/resources/filters/layout/pandoc3_figure.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ function render_pandoc3_figure()
153153
if scope_utils.lookup_class(scope, "column-margin") then
154154
image.classes:insert("column-margin")
155155
end
156+
if image.attributes['fig-alt'] ~= nil then
157+
image.attributes['alt'] = image.attributes['fig-alt']
158+
image.attributes['fig-alt'] = nil
159+
end
156160
return latexImageFigure(image)
157161
end
158162

src/resources/formats/pdf/pandoc/passoptions.latex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ $endif$
77
$if(CJKmainfont)$
88
\PassOptionsToPackage{space}{xeCJK}
99
$endif$
10+
$if(tagpdf)$
11+
\DocumentMetadata{%
12+
lang = en-us,
13+
pdfversion = 2.0,
14+
pdfstandard = ua-2,
15+
tagging = on,
16+
tagging-setup = {math/setup=mathml-SE}
17+
}
18+
\tagpdfsetup{activate, tabsorder=structure}
19+
$endif$

src/resources/schema/document-a11y.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@
88
enum: [json, console, document]
99
description: "If set, output axe-core results on console. `json`: produce structured output; `console`: print output to javascript console; `document`: produce a visual report of violations in the document itself."
1010
description: "When defined, run axe-core accessibility tests on the document."
11+
12+
- name: tagpdf
13+
tags:
14+
formats: [pdf]
15+
schema: boolean
16+
default: true
17+
description:
18+
short: "If true, enable `tagpdf` support for accessible PDFs"
19+
long: |
20+
If true, enable `tagpdf` support for accessible PDFs. This will
21+
ensure that the PDF is tagged and that images have alt text.
22+
Note that this requires a LaTeX engine that supports PDF tagging
23+
(e.g., `lualatex`).
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
format:
3+
latex:
4+
tagpdf: true
5+
title: This is a tagpdf test
6+
_quarto:
7+
tests:
8+
latex:
9+
ensureFileRegexMatches:
10+
-
11+
- "tagging = on"
12+
- 'alt={alt text 2 here}'
13+
- []
14+
---
15+
16+
## This is a test
17+
18+
![A caption](./an-image.png){fig-alt="alt text 2 here"}

0 commit comments

Comments
 (0)