Skip to content

Commit

Permalink
rename keys WIP [ci-skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Feb 16, 2024
1 parent 9161fde commit 752ea9a
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 33 deletions.
17 changes: 16 additions & 1 deletion doc/tagpdfsetup-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

The keys are split in a number of key pathes.

## Unhandled key

root-AF (in tagpdf-struct)

## activate key path

`activate` is used for keys that enable general, typically document wide tagging options related
Expand All @@ -27,13 +31,24 @@ The (new) debug key aligns various logging and debugging option with the debug k
of `\DocumentMetadata`-

```
debug/show = {para,spaces,false} (old: paratagging-show, show-spaces)
debug/show = {para,spaces,paraOff,spacesOff} (old: paratagging-show, show-spaces)
debug/log = v|vv|vvv|none|all (old: log)
debug/uncompress (old: uncompress, not really needed anymore)
```

Check: does both `debug / show=` and `debug={show=, log=}` work?

## role key path

These are keys related to tags and attribute names.

```
role/new-tag (old: add-new-tag)
role/new-attribute (old: newattribute)
role/mathml-tags (old: mathml-tags)
role/tagset (choice, default is latex, with pdf only PDF-tags are used)
```

## viewer keys

viewer keys influence some display options in a pdf viewer. There is an overlap with
Expand Down
2 changes: 1 addition & 1 deletion tagpdf-checks.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
% \cs{tag_if_box_tagged:N}\Arg{box}
% \end{syntax}
% This tests if a box contains tagging commands.
% It relies currently on that the code that saved the box correctly set
% It relies currently on that the code, that saved the box, correctly sets
% the command \verb+\l_tag_box_\int_use:N #1_tl+ to a positive value.
% The LaTeX commands will do that automatically
% at some time but it is in the responsability of the user to
Expand Down
1 change: 1 addition & 0 deletions tagpdf-data.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
% \section{The LaTeX namespace}
% This is the main new namespace. It is bound to change a lot!
% It lists the new tag, the rolemap and the namespace of the rolemap.
% latex-lab has also a namespace module, which takes precendence!
% \begin{macrocode}
%<*ns-latex>
%% \ProvidesExplFile {tagpdf-ns-latex.def} {2024-02-04} {0.98v}
Expand Down
15 changes: 12 additions & 3 deletions tagpdf-roles.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,8 @@
% tag-namespace (rolemap-key),
% role (rolemap-key),
% role-namespace (rolemap-key),
% add-new-tag (setup-key)}
% role/new-tag (setup-key),
% add-new-tag (deprecated)}
% \begin{macrocode}
\keys_define:nn { @@ / tag-role }
{
Expand All @@ -1251,8 +1252,8 @@

\keys_define:nn { @@ / setup }
{
mathml-tags .bool_gset:N = \g_@@_role_add_mathml_bool
,add-new-tag .code:n =
role/mathml-tags .bool_gset:N = \g_@@_role_add_mathml_bool
,role/new-tag .code:n =
{
\keys_set_known:nnnN
{@@/tag-role}
Expand Down Expand Up @@ -1298,6 +1299,14 @@
\l_@@_role_role_namespace_tmpa_tl
}
}
,tagset .choice:n
,tagset/latex .code:n = { \socket_assign_plug:nn { tag/struct/tag } {latex-tags} }
,tagset/pdf .code:n = { \socket_assign_plug:nn { tag/struct/tag } {pdf-tags} }
% \end{macrocode}
% deprecated names
% \begin{macrocode}
, mathml-tags .bool_gset:N = \g_@@_role_add_mathml_bool
, add-new-tag .meta:n = {role/new-tag={#1}}
}
%</package>
% \end{macrocode}
Expand Down
58 changes: 44 additions & 14 deletions tagpdf-struct.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -254,19 +254,19 @@
% must be declared first in \cs{tagpdfsetup}.
% \end{function}
% \subsection{Setup keys}
% \begin{function}{newattribute (setup-key)}
% \begin{function}{role/new-attribute (setup-key), newattribute (deprecated)}
% \begin{syntax}
% newattribute = \Arg{name}\Arg{Content}
% role/new-attribute = \Arg{name}\Arg{Content}
% \end{syntax}
% This key can be used in the setup command \cs{tagpdfsetup} and allow to declare a
% new attribute, which can be used as attribute or attribute class.
% The value are two brace groups, the first contains the name, the second the content.
% \begin{verbatim}
% \tagpdfsetup
% {
% newattribute =
% role/new-attribute =
% {TH-col}{/O /Table /Scope /Column},
% newattribute =
% role/new-attribute =
% {TH-row}{/O /Table /Scope /Row},
% }
% \end{verbatim}
Expand Down Expand Up @@ -1113,6 +1113,32 @@
% This are the keys for the user commands.
% we store the tag in a variable. But we should be careful, it is only reliable
% at the begin.
%
% This socket is used by the tag key. It allows to switch between
% the latex-tabs and the standard tags.
% \begin{macrocode}
\socket_new:nn { tag/struct/tag }{0}
\socket_new_plug:nnn { tag/struct/tag }{ latex-tags }
{
\seq_set_split:Nne \l_@@_tmpa_seq { / } {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}}
\tl_gset:Ne \g_@@_struct_tag_tl { \seq_item:Nn\l_@@_tmpa_seq {1} }
\tl_gset:Ne \g_@@_struct_tag_NS_tl{ \seq_item:Nn\l_@@_tmpa_seq {2} }
\@@_check_structure_tag:N \g_@@_struct_tag_tl
}

\socket_new_plug:nnn { tag/struct/tag }{ pdf-tags }
{
\seq_set_split:Nne \l_@@_tmpa_seq { / } {#1/\prop_item:Ne\g_@@_role_tags_NS_prop{#1}}
\tl_gset:Ne \g_@@_struct_tag_tl { \seq_item:Nn\l_@@_tmpa_seq {1} }
\tl_gset:Ne \g_@@_struct_tag_NS_tl{ \seq_item:Nn\l_@@_tmpa_seq {2} }
\@@_role_get:VVNN \g_@@_struct_tag_tl\g_@@_struct_tag_NS_tl\l_@@_tmpa_tl\l_@@_tmpb_tl
\tl_gset:Ne \g_@@_struct_tag_tl {\l_@@_tmpa_tl}
\tl_gset:Ne \g_@@_struct_tag_NS_tl{\l_@@_tmpb_tl}
\@@_check_structure_tag:N \g_@@_struct_tag_tl
}
\socket_assign_plug:nn { tag/struct/tag } {latex-tags}
% \end{macrocode}

% \begin{macro}
% {
% label (struct-key),
Expand Down Expand Up @@ -1152,10 +1178,7 @@
parent .default:n = {-1},
tag .code:n = % S property
{
\seq_set_split:Nne \l_@@_tmpa_seq { / } {#1/\prop_item:Ne\g__tag_role_tags_NS_prop{#1}}
\tl_gset:Ne \g_@@_struct_tag_tl { \seq_item:Nn\l_@@_tmpa_seq {1} }
\tl_gset:Ne \g_@@_struct_tag_NS_tl{ \seq_item:Nn\l_@@_tmpa_seq {2} }
\@@_check_structure_tag:N \g_@@_struct_tag_tl
\socket_use:n { tag/struct/tag }
},
title .code:n = % T property
{
Expand Down Expand Up @@ -1921,7 +1944,7 @@
% |\g_@@_attr_class_used_seq| will hold the attributes which have been used as
% class name.
% |\l_@@_attr_value_tl| is used to build the attribute array or key.
% Everytime an attribute is used for the first time, and object is created
% Every time an attribute is used for the first time, and object is created
% with its content, the name-object reference relation is stored in
% |\g_@@_attr_objref_prop|
% \begin{macrocode}
Expand All @@ -1933,9 +1956,9 @@
% \end{macrocode}
% \end{variable}
% \subsection{Commands and keys}
% \begin{macro}{\@@_attr_new_entry:nn,newattribute (setup-key)}
% \begin{macro}{\@@_attr_new_entry:nn,role/new-attribute (setup-key), newattribute (deprecated)}
% This allows to define attributes. Defined attributes
% are stored in a global property. |newattribute| expects
% are stored in a global property. |role/new-attribute| expects
% two brace group, the name and the content. The content typically
% needs an |/O| key for the owner. An example look like
% this.
Expand All @@ -1945,9 +1968,9 @@
% \begin{verbatim}
% \tagpdfsetup
% {
% newattribute =
% role/new-attribute =
% {TH-col}{/O /Table /Scope /Column},
% newattribute =
% role/new-attribute =
% {TH-row}{/O /Table /Scope /Row},
% }
% \end{verbatim}
Expand All @@ -1961,10 +1984,17 @@
\cs_generate_variant:Nn \__tag_attr_new_entry:nn {ee}
\keys_define:nn { @@ / setup }
{
newattribute .code:n =
role/new-attribute .code:n =
{
\@@_attr_new_entry:nn #1
}
% \end{macrocode}
% deprecated name
% \begin{macrocode}
,newattribute .code:n =
{
\@@_attr_new_entry:nn #1
},
}
% \end{macrocode}
% \end{macro}
Expand Down
22 changes: 12 additions & 10 deletions tagpdf-user.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
% \begin{function}{activate (setup-key)}
% And additional setup key which combine the other activate keys
% |activate/mc|, |activate/tree|, |activate/struct| and additionally
% add a document structure.
% adds a document structure.
% \end{function}
%
% \begin{function}{\tag_tool:n,\tagtool}
Expand Down Expand Up @@ -109,7 +109,7 @@
% \end{syntax}
% These are direct wrappers around |\tag_struct_begin:n|,
% |\tag_struct_end:| and |\tag_struct_use:n|.
% The commands and their argument are documentated in the \pkg{tagpdf-struct} module.
% The commands and their argument are documented in the \pkg{tagpdf-struct} module.
% \end{function}


Expand Down Expand Up @@ -183,22 +183,24 @@
% pdftex.
% \end{function}
%
% \subsection{Paratagging}
% \subsection{Tagging of paragraphs}
%
% This is a first try to make use of the new paragraph hooks in a current LaTeX to
% This makes use of the paragraph hooks in LaTeX to
% automate the tagging of paragraph. It requires sane paragraph nesting,
% faulty code, e.g. a missing |\par| at the end of a low-level vbox can highly
% confuse the tagging. The tags should be carefully checked if this is used.
%
% \begin{function}{paratagging (setup-key),paratagging-show (setup-key)}
% \begin{function}{para/tagging (setup-key),paratagging-show (deprecated),paratagging (deprecated)}
% \begin{syntax}
% |paratagging| = |true|\verb+|+|false|\\
% |paratagging-show| = |true|\verb+|+|false|\\
% |para/tagging| = |true|\verb+|+|false|\\
% |debug/show=para|\\
% |debug/show=paraOff|
% \end{syntax}
% This keys can be used in |\tagpdfsetup| and enable/disable paratagging.
% |paratagging-show| puts small red numbers at the begin and end of a paragraph.
% The |para/tagging| key can be used in |\tagpdfsetup| and enable/disables tagging
% of paragraphics.
% |debug/show=para| puts small colored numbers at the begin and end of a paragraph.
% This is meant as a debugging help. The number are boxes and have a (tiny) height,
% so they can affect typesetting.
% so they can affect typesetting.
% \end{function}
%
% \begin{function}{\tagpdfparaOn,\tagpdfparaOff}
Expand Down
9 changes: 5 additions & 4 deletions tagpdf.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,12 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{debug/show (setup-key)}
% Subkeys are defined in various other places.
% Subkeys/values are defined in various other places.
% \begin{macrocode}
debug/show .choice:,
% \end{macrocode}
% \end{macro}
% \begin{macro}{debug/log (setup-key)}
% \begin{macro}{debug/log (setup-key), debug/uncompress (setup-key), log (deprecated), uncompress (deprecated)}
% The |log| takes currently the values |none|, |v|, |vv|, |vvv|, |all|.
% The description of the log levels is in tagpdf-checks.
% \begin{macrocode}
Expand All @@ -601,10 +601,12 @@
debug/log / vv .code:n = {\int_set:Nn \l_@@_loglevel_int { 2 }},
debug/log / vvv .code:n = {\int_set:Nn \l_@@_loglevel_int { 3 }},
debug/log / all .code:n = {\int_set:Nn \l_@@_loglevel_int { 10 }},
debug/uncompress .code:n = { \pdf_uncompress: },
% \end{macrocode}
% deprecated but still needed as the documentmetadata key argument uses it.
% \begin{macrocode}
log .meta:n = {debug/log={#1}},
uncompress .code:n = { \pdf_uncompress: },
% \end{macrocode}
% \end{macro}
% \begin{macro}{activate/tagunmarked (setup-key),tagunmarked (deprecated)}
Expand Down Expand Up @@ -637,8 +639,7 @@
% \end{macrocode}
% deprecated name
% \begin{macrocode}
tabsorder .meta:n = {page/tabsorder={#1}},
uncompress .code:n = { \pdf_uncompress: },
tabsorder .meta:n = {page/tabsorder={#1}},
}
% \end{macrocode}
% \end{macro}
Expand Down

0 comments on commit 752ea9a

Please sign in to comment.