| 1 |
%% |
| 2 |
%% This is file `documentmetadata-support.ltx', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% documentmetadata-support.dtx (with options: `code') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Copyright 2021-2025 LaTeX Project |
| 12 |
%% |
| 13 |
%% This file was generated from file(s) of the `LaTeX-lab Bundle'. |
| 14 |
%% ------------------------------------------------------------------------------------ |
| 15 |
%% |
| 16 |
%% It may be distributed and/or modified under the |
| 17 |
%% conditions of the LaTeX Project Public License, either version 1.3c |
| 18 |
%% of this license or (at your option) any later version. |
| 19 |
%% The latest version of this license is in |
| 20 |
%% http://www.latex-project.org/lppl.txt |
| 21 |
%% and version 1.3c or later is part of all distributions of LaTeX |
| 22 |
%% version 2008 or later. |
| 23 |
%% |
| 24 |
%% This file may only be distributed together with a copy of the LaTeX |
| 25 |
%% `LaTeX-lab Bundle'. You may however distribute the `LaTeX-lab Bundle' |
| 26 |
%% without such generated files. |
| 27 |
%% |
| 28 |
%% The newest sources can be found below |
| 29 |
%% |
| 30 |
%% https://github.com/latex3/latex2e/required/latex-lab |
| 31 |
%% |
| 32 |
%% where one can also log issues in case there are any. |
| 33 |
%% |
| 34 |
%% |
| 35 |
%% File: documentmetadata-support.dtx |
| 36 |
\def\documentmetadatasupportversion{1.0w} |
| 37 |
\def\documentmetadatasupportdate{2025-10-13} |
| 38 |
|
| 39 |
\RequirePackage{pdfmanagement-testphase} |
| 40 |
\ExplSyntaxOn\makeatletter |
| 41 |
|
| 42 |
\clist_if_exist:NF \g__pdfmanagement_firstaidoff_clist |
| 43 |
{ \clist_new:N \g__pdfmanagement_firstaidoff_clist } |
| 44 |
\tl_if_exist:NF \g__pdfmanagement_testphase_tl |
| 45 |
{ \tl_new:N \g__pdfmanagement_testphase_tl } |
| 46 |
\cs_new_protected:Npn \@kernel@before@DocumentMetadata |
| 47 |
{ |
| 48 |
\ifx\Umathcode\@undefined |
| 49 |
\fontencoding{T1} |
| 50 |
\renewcommand\encodingdefault{T1} |
| 51 |
\fi |
| 52 |
} |
| 53 |
|
| 54 |
\cs_set_protected:Npn \DocumentMetadata #1 |
| 55 |
{ |
| 56 |
\cs_if_eq:NNTF \documentclass \@twoclasseserror |
| 57 |
{ \msg_error:nn { meta } { after-class } } |
| 58 |
{ |
| 59 |
\@kernel@before@DocumentMetadata |
| 60 |
\bool_gset_true:N \g__pdfmanagement_active_bool |
| 61 |
\keys_set_groups:nnn { document / metadata} {init}{ #1 } |
| 62 |
%if no backend has been loaded force it now: |
| 63 |
\str_if_exist:NF \c_sys_backend_str |
| 64 |
{ |
| 65 |
\sys_load_backend:n {} |
| 66 |
} |
| 67 |
\ExplSyntaxOn\makeatletter |
| 68 |
\file_input:n {l3backend-testphase-\c_sys_backend_str.def} |
| 69 |
\ExplSyntaxOff\makeatother |
| 70 |
\pdf_version_gset:n { 2.0 } |
| 71 |
\keys_set_groups:nnn { document / metadata} {pdf}{ #1 } |
| 72 |
\RequirePackage{latex-lab-testphase-latest} |
| 73 |
\AddToDocumentProperties [document]{tagging}{inactive} |
| 74 |
\AddToDocumentProperties [document]{tagging/para}{inactive} |
| 75 |
\keys_set_exclude_groups:nnn { document / metadata } { init } { #1 } |
| 76 |
\g@addto@macro\@kernel@after@begindocument |
| 77 |
{ |
| 78 |
\pdfdict_get:nnN {g__pdf_Core/Catalog}{Lang}\l__pdfmanagement_tmpa_tl |
| 79 |
\quark_if_no_value:NT\l__pdfmanagement_tmpa_tl |
| 80 |
{ |
| 81 |
\tl_if_empty:eTF { \BCPdata{main.language} } |
| 82 |
{ \tl_set:Ne \l__pdfmanagement_tmpb_tl { \BCPdata{language} } } |
| 83 |
{ \tl_set:Ne \l__pdfmanagement_tmpb_tl { \BCPdata{main.language} } } |
| 84 |
\msg_warning:nne { meta } { lang-missing }{ \l__pdfmanagement_tmpb_tl } |
| 85 |
\exp_last_unbraced:Ne |
| 86 |
\AddToDocumentProperties{[document]{lang}{\l__pdfmanagement_tmpb_tl}} |
| 87 |
\pdfmanagement_add:nne {Catalog} {Lang}{(\l__pdfmanagement_tmpb_tl)} |
| 88 |
} |
| 89 |
} |
| 90 |
\hook_use_once:n {pdfmanagement/add} |
| 91 |
\cs_set_protected:Npn \DocumentMetadata ##1 |
| 92 |
{ |
| 93 |
\keys_set_exclude_groups:nnn { document / metadata } { init } { ##1 } |
| 94 |
} |
| 95 |
\g__pdfmanagement_testphase_tl |
| 96 |
\RequirePackage{pdfmanagement-firstaid} |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
\clist_map_inline:nn |
| 101 |
{ |
| 102 |
pdfmanagement-testphase.sty, |
| 103 |
color-ltx.sty, |
| 104 |
xcolor-patches-tmp-ltx.sty, |
| 105 |
tagpdf-base.sty, |
| 106 |
latex-lab-testphase-latest.sty, |
| 107 |
tagpdf.sty, |
| 108 |
tagpdf-mc-code-generic.sty, |
| 109 |
tagpdf-mc-code-lua.sty, |
| 110 |
latex-lab-testphase-names.sty, |
| 111 |
latex-lab-testphase-new-or-2.sty, |
| 112 |
latex-lab-testphase-block.sty, |
| 113 |
latex-lab-kernel-changes.sty, |
| 114 |
latex-lab-testphase-context.sty, |
| 115 |
latex-lab-testphase-sec.sty, |
| 116 |
latex-lab-testphase-toc.sty, |
| 117 |
latex-lab-testphase-minipage.sty, |
| 118 |
latex-lab-testphase-new-or-1.sty, |
| 119 |
latex-lab-testphase-graphic.sty, |
| 120 |
latex-lab-testphase-float.sty, |
| 121 |
latex-lab-testphase-bib.sty, |
| 122 |
latex-lab-testphase-text.sty, |
| 123 |
latex-lab-testphase-marginpar.sty, |
| 124 |
latex-lab-testphase-title.sty, |
| 125 |
latex-lab-testphase-table.sty, |
| 126 |
latex-lab-testphase-math.sty, |
| 127 |
latex-lab-testphase-firstaid.sty, |
| 128 |
latex-lab-testphase-tikz.sty, |
| 129 |
pdfmanagement-firstaid.sty, |
| 130 |
} |
| 131 |
{\expandafter\chardef\csname t@status@#1\endcsname8\relax } |
| 132 |
\tl_new:c {l__tag_status_0_tl} |
| 133 |
\tl_new:c {l__tag_status_1_tl} |
| 134 |
\tl_new:c {l__tag_status_2_tl} |
| 135 |
\tl_new:c {l__tag_status_3_tl} |
| 136 |
\tl_new:c {l__tag_status_4_tl} |
| 137 |
\tl_new:c {l__tag_status_-1_tl} |
| 138 |
\cs_new_protected:Npn\__tag_status_sort: |
| 139 |
{ |
| 140 |
\clist_map_inline:Nn\g__tag_status_filelist_tl |
| 141 |
{ |
| 142 |
\filename@parse{##1} |
| 143 |
\cs_if_exist:cTF { t@status@##1 } |
| 144 |
{ |
| 145 |
\str_if_eq:onF{\filename@ext}{cls} |
| 146 |
{ |
| 147 |
\tl_put_right:cn |
| 148 |
{l__tag_status_\int_use:c { t@status@##1 }_tl} |
| 149 |
{~~##1\iow_newline:} |
| 150 |
} |
| 151 |
} |
| 152 |
{ |
| 153 |
\str_if_eq:onT{\filename@ext}{sty} |
| 154 |
{ |
| 155 |
\tl_put_right:cn |
| 156 |
{l__tag_status_-1_tl} |
| 157 |
{~~##1\iow_newline:} |
| 158 |
} |
| 159 |
} |
| 160 |
} |
| 161 |
} |
| 162 |
\cs_new_protected:Npn \__tag_status_type:nn #1 #2 |
| 163 |
{ |
| 164 |
\iow_term:n{~~#2} |
| 165 |
\iow_term:n{~~--------------------------} |
| 166 |
\tl_if_empty:cTF{l__tag_status_#1_tl} |
| 167 |
{ |
| 168 |
\iow_term:e{~~NONE\iow_newline:} |
| 169 |
} |
| 170 |
{ |
| 171 |
\iow_term:e{\tl_use:c{l__tag_status_#1_tl}} |
| 172 |
} |
| 173 |
} |
| 174 |
\cs_new_protected:Npn \__tag_status_log: |
| 175 |
{ |
| 176 |
\file_if_exist_input:n {latex-tagging-status.ltx} |
| 177 |
\AddToHookNext{class/before} |
| 178 |
{ |
| 179 |
\tl_const:Ne \c__tag_current_class_tl{\@currname.\@currext} |
| 180 |
\tl_const:Ne \c__tag_status_class_tl |
| 181 |
{ |
| 182 |
\cs_if_exist:cTF { t@status@\@currname.\@currext } |
| 183 |
{ |
| 184 |
\int_case:nn { \int_use:c { t@status@\@currname.\@currext } } |
| 185 |
{ |
| 186 |
{0}{unknown} |
| 187 |
{1}{unsupported} |
| 188 |
{2}{currently~incompatible} |
| 189 |
{3}{partially~compatible} |
| 190 |
{4}{compatible} |
| 191 |
} |
| 192 |
} |
| 193 |
{ not~in~the~status~list} |
| 194 |
} |
| 195 |
} |
| 196 |
\AddToHook{begindocument}{\tl_gset_eq:NN \g__tag_status_filelist_tl\@filelist} |
| 197 |
\AddToHook{enddocument/info} |
| 198 |
{ |
| 199 |
\iow_term:n{} |
| 200 |
\iow_term:n |
| 201 |
{======================================} |
| 202 |
\iow_term:n{~~Status~report~of~the~tagging~support} |
| 203 |
\iow_term:n{======================================} |
| 204 |
\iow_term:n{~~Details~at~https://latex3.github.io/tagging-project/tagging-status} |
| 205 |
\iow_term:n{~~Report~erroneous~entries~at~https://github.com/latex3/tagging-project} |
| 206 |
\iow_term:n{} |
| 207 |
\iow_term:n{~~A.~CLASS} |
| 208 |
\iow_term:n{~~********} |
| 209 |
\iow_term:n{} |
| 210 |
\iow_term:e{~~\c__tag_current_class_tl\c_space_tl is~\c__tag_status_class_tl} |
| 211 |
\iow_term:n{} |
| 212 |
\iow_term:n{~~B.~PACKAGES,~LIBRARIES,~etc} |
| 213 |
\iow_term:n{~~***********} |
| 214 |
\iow_term:n{} |
| 215 |
\__tag_status_sort: |
| 216 |
\__tag_status_type:nn{1}{1.~Unsupported} |
| 217 |
\__tag_status_type:nn{2}{2.~Currently~incompatible} |
| 218 |
\__tag_status_type:nn{3}{3.~Partially~compatible} |
| 219 |
\__tag_status_type:nn{4}{4.~Compatible} |
| 220 |
\__tag_status_type:nn{0}{5.~Unknown} |
| 221 |
\__tag_status_type:nn{-1}{~6. Unclassified~files~with~extension~.sty} |
| 222 |
\iow_term:n{====================================} |
| 223 |
\iow_term:n{~~End~of~status~report} |
| 224 |
\iow_term:n{====================================} |
| 225 |
} |
| 226 |
} |
| 227 |
\keys_define:nn { document / metadata } |
| 228 |
{ |
| 229 |
backend .choices:nn = |
| 230 |
{ dvipdfmx , dvips , dvisvgm , luatex , pdftex , pdfmode , xdvipdfmx , xetex } |
| 231 |
{ |
| 232 |
\sys_load_backend:n {#1} |
| 233 |
}, |
| 234 |
backend .groups:n = { init } , |
| 235 |
} |
| 236 |
\keys_define:nn { document / metadata } |
| 237 |
{ |
| 238 |
,check-tagging-status .choice: |
| 239 |
,check-tagging-status / off .code:n = {} |
| 240 |
,check-tagging-status / listfiles .code:n = |
| 241 |
{ |
| 242 |
\__tag_status_log: |
| 243 |
} |
| 244 |
,check-tagging-status .default:n = {listfiles} |
| 245 |
} |
| 246 |
\keys_define:nn { document / metadata } |
| 247 |
{ |
| 248 |
,pdfversion .code:n = |
| 249 |
{ |
| 250 |
\pdf_version_gset:n { #1 } |
| 251 |
\AddToDocumentProperties[document]{pdfversion}{#1} |
| 252 |
} |
| 253 |
,pdfversion .groups:n = { pdf } |
| 254 |
,uncompress .code:n = |
| 255 |
{ |
| 256 |
\pdf_uncompress: |
| 257 |
} |
| 258 |
,uncompress .value_forbidden:n = true |
| 259 |
,lang .code:n = |
| 260 |
{ |
| 261 |
\pdfmanagement_add:nnn {Catalog} {Lang}{(#1)} |
| 262 |
\AddToDocumentProperties[document]{lang}{#1} |
| 263 |
} |
| 264 |
%,xmpmeta .bool_gset:N = \g_pdfmeta_xmp_bool %see pdfmeta unused and undefined for now! |
| 265 |
% this uses internal command from pdfmeta, it should probably move there ... |
| 266 |
,pdfstandard .code:n = |
| 267 |
{ |
| 268 |
\clist_map_inline:nn{#1} |
| 269 |
{ |
| 270 |
\keys_set:ne {document / metadata} {_pdfstandard=\str_uppercase:n{##1}} |
| 271 |
} |
| 272 |
} |
| 273 |
,_pdfstandard .choices:nn = |
| 274 |
{A-1B,A-2A,A-2B,A-2U,A-3A,A-3B,A-3U,A-4} |
| 275 |
{ |
| 276 |
\prop_gset_eq:Nc \g__pdfmeta_standard_prop { g__pdfmeta_standard_pdf/#1 _prop } |
| 277 |
\AddToDocumentProperties [document]{pdfstandard}{#1} |
| 278 |
} |
| 279 |
,_pdfstandard / A-4F .code:n = |
| 280 |
{ |
| 281 |
\prop_gset_eq:Nc \g__pdfmeta_standard_prop { g__pdfmeta_standard_pdf/A-4F_prop } |
| 282 |
\AddToDocumentProperties [document]{pdfstandard}{A-4F} |
| 283 |
} |
| 284 |
,_pdfstandard / A-4E .code:n = |
| 285 |
{ |
| 286 |
\prop_gset_eq:Nc \g__pdfmeta_standard_prop { g__pdfmeta_standard_pdf/A-4E_prop } |
| 287 |
\AddToDocumentProperties [document]{pdfstandard}{A-4E} |
| 288 |
} |
| 289 |
,_pdfstandard / unknown .code:n = |
| 290 |
{ |
| 291 |
\msg_error:nnn{pdf}{unknown-standard}{#1} |
| 292 |
} |
| 293 |
,testphase .multichoices:nn = |
| 294 |
{latest,tagpdf,phase-I,phase-II,phase-III} |
| 295 |
{ |
| 296 |
\keys_set:nn |
| 297 |
{document / metadata} |
| 298 |
{tagging=on} |
| 299 |
} |
| 300 |
,testphase / unknown .code:n = |
| 301 |
{ |
| 302 |
\tl_gput_right:Nn\g__pdfmanagement_testphase_tl |
| 303 |
{ |
| 304 |
\tl_if_empty:eT{\GetDocumentProperties{document/testphase/#1}} |
| 305 |
{ |
| 306 |
\AddToDocumentProperties [document]{testphase/#1}{loaded} |
| 307 |
\file_if_exist_input:nF {#1-latex-lab-testphase.ltx} |
| 308 |
{ |
| 309 |
\msg_warning:nnn{meta}{latex-lab-pkg-missing}{#1} |
| 310 |
\AddToDocumentProperties [document]{testphase/#1}{missing} |
| 311 |
} |
| 312 |
} |
| 313 |
} |
| 314 |
} |
| 315 |
} |
| 316 |
\cs_new_protected:Npn \__tag_document_set_tagging_off: |
| 317 |
{ |
| 318 |
\sys_if_engine_luatex:F |
| 319 |
{ \AddToHook{shipout/firstpage}[tagpdf/space]{} } |
| 320 |
\tagpdfsetup{activate/mc=false,activate/tree=false, |
| 321 |
activate/struct=false,activate/socket=false, |
| 322 |
activate/spaces=false, |
| 323 |
para/tagging=false,math/setup=} |
| 324 |
\AddToDocumentProperties [document]{tagging}{inactive} |
| 325 |
\AddToDocumentProperties [document]{tagging/para}{inactive} |
| 326 |
\AddToDocumentProperties [document]{tagging/interwordspace}{inactive} |
| 327 |
\tag_suspend:n {global} |
| 328 |
\cs_set_protected:Npn\tagpdfsetup##1{} |
| 329 |
} |
| 330 |
\cs_new_protected:Npn \__tag_document_set_tagging_on: |
| 331 |
{ |
| 332 |
\tagpdfsetup{activate,para/tagging,activate/spaces} |
| 333 |
\AddToDocumentProperties [document]{tagging}{active} |
| 334 |
\AddToDocumentProperties [document]{tagging/para}{active} |
| 335 |
\AddToDocumentProperties [document]{tagging/interwordspace}{active} |
| 336 |
} |
| 337 |
\cs_new_eq:NN \__tag_document_set_tagging:\__tag_document_set_tagging_off: |
| 338 |
\AddToHookNext{class/before}{\__tag_document_set_tagging:} |
| 339 |
\keys_define:nn { document / metadata } |
| 340 |
{ |
| 341 |
,tagging .choice:, |
| 342 |
,tagging / on .code:n = |
| 343 |
{ |
| 344 |
\cs_set_eq:NN \__tag_document_set_tagging:\__tag_document_set_tagging_on: |
| 345 |
} |
| 346 |
,tagging / off .code:n = |
| 347 |
{ |
| 348 |
\cs_set_eq:NN \__tag_document_set_tagging:\__tag_document_set_tagging_off: |
| 349 |
} |
| 350 |
,tagging / draft .code:n = |
| 351 |
{ |
| 352 |
\keys_set:nn { document / metadata }{ tagging=on } |
| 353 |
\AddToHook{shipout/lastpage}[tagging-setup]{\tagpdfsetup{activate/tree=false}} |
| 354 |
\DeclareHookRule{shipout/lastpage}{tagging-setup}{before}{tagpdf} |
| 355 |
} |
| 356 |
,tagging-setup .code:n = |
| 357 |
{ |
| 358 |
\keys_set:nn { document / metadata }{ tagging=on } |
| 359 |
\tl_gclear:N\g__pdfmanagement_testphase_tl |
| 360 |
\keys_set_groups:nnn{__tag/setup}{load}{#1} |
| 361 |
\AddToHook{class/before} |
| 362 |
{\keys_set_exclude_groups:nnn {__tag/setup}{load}{#1}} |
| 363 |
} |
| 364 |
,debug .code:n = |
| 365 |
{ |
| 366 |
\keys_set:nn { document / metadata / debug } {#1} |
| 367 |
} |
| 368 |
,debug / para .code:n = |
| 369 |
{ |
| 370 |
\AddToHook |
| 371 |
{ |
| 372 |
package/tagpdf/after |
| 373 |
} |
| 374 |
{ |
| 375 |
\tagpdfsetup{debug/show=para} |
| 376 |
} |
| 377 |
} |
| 378 |
,debug / log .code:n = |
| 379 |
{ |
| 380 |
\AddToHook |
| 381 |
{ |
| 382 |
package/tagpdf/after |
| 383 |
} |
| 384 |
{ |
| 385 |
\tagpdfsetup{debug/log=#1} |
| 386 |
} |
| 387 |
} |
| 388 |
,debug / tagpdf .code:n = |
| 389 |
{ |
| 390 |
\AddToHook |
| 391 |
{ |
| 392 |
package/tagpdf/after |
| 393 |
} |
| 394 |
{ |
| 395 |
\RequirePackage{tagpdf-debug} |
| 396 |
} |
| 397 |
} |
| 398 |
,debug / uncompress .code:n = |
| 399 |
{ |
| 400 |
\pdf_uncompress: |
| 401 |
} |
| 402 |
,debug / pdfmanagement .bool_gset:N = \g__pdfmanagement_active_bool |
| 403 |
,debug / firstaidoff .clist_gset:N = \g__pdfmanagement_firstaidoff_clist |
| 404 |
,debug / BBox .code:n = |
| 405 |
{ |
| 406 |
\AddToHook{package/latex-lab-testphase-graphic/after} |
| 407 |
{ \bool_set_true:N \l__tag_graphic_debug_bool} |
| 408 |
} |
| 409 |
} |
| 410 |
\keys_define:nn{__tag/setup} |
| 411 |
{ |
| 412 |
,modules .code:n = |
| 413 |
{ |
| 414 |
\keys_set:nn { document / metadata }{testphase={#1}} |
| 415 |
} |
| 416 |
,modules .groups:n = { load } |
| 417 |
,extra-modules .code:n = |
| 418 |
{ |
| 419 |
\keys_set:nn { document / metadata }{testphase={#1}} |
| 420 |
} |
| 421 |
,extra-modules .groups:n = { load } |
| 422 |
} |
| 423 |
\prop_gput:Nnn \g_msg_module_type_prop { meta } { LaTeX } |
| 424 |
\prop_gput:Nnn \g_msg_module_name_prop { meta } { DocumentMetadata } |
| 425 |
|
| 426 |
\msg_new:nnn { meta } { after-class } |
| 427 |
{ |
| 428 |
\token_to_str:N \DocumentMetadata \c_space_tl |
| 429 |
should~be~used~only~before~\token_to_str:N\documentclass |
| 430 |
} |
| 431 |
\msg_new:nnn { meta } { latex-lab-pkg-missing } |
| 432 |
{ |
| 433 |
LaTeX-lab~package~'#1'~not~found. |
| 434 |
} |
| 435 |
\msg_new:nnn { meta } { lang-missing } |
| 436 |
{ |
| 437 |
The~language~has~not~been~set~in~\token_to_str:N |
| 438 |
\DocumentMetadata.\\Setting~it~to~'#1'~as~fallback. |
| 439 |
} |
| 440 |
\ExplSyntaxOff\makeatother |
| 441 |
\endinput |
| 442 |
%% |
| 443 |
%% End of file `documentmetadata-support.ltx'. |