[latex3-commits] [latex3/tagpdf] renamekeys: work on key renaming, WIP (4eae256)

github at latex-project.org github at latex-project.org
Thu Feb 8 20:12:04 CET 2024


Repository : https://github.com/latex3/tagpdf
On branch  : renamekeys
Link       : https://github.com/latex3/tagpdf/commit/4eae256a88ec6c721e452e903ac3429781acfcf8

>---------------------------------------------------------------

commit 4eae256a88ec6c721e452e903ac3429781acfcf8
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Feb 8 20:12:04 2024 +0100

    work on key renaming, WIP


>---------------------------------------------------------------

4eae256a88ec6c721e452e903ac3429781acfcf8
 CHANGELOG.md     |  7 +++++++
 doc/tagpdf.tex   | 14 +++++++++++++-
 tagpdf-space.dtx | 49 ++++++++++++++++++++++++++++---------------------
 tagpdf.dtx       | 21 +++++++++++++--------
 4 files changed, 61 insertions(+), 30 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index da1d996..4a6b64e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ All notable changes to the `tagpdf` package since the
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 this project uses date-based 'snapshot' version identifiers.
 
+## [Unreleased]
+### Changed
+ - various keys have been deprecated
+   * interwordspace (new name: activate/spaces)
+   * show-spaces    (new: debug/show=spaces)
+   *
+
 ## [2024-02-04]
 Version 0.98v
 
diff --git a/doc/tagpdf.tex b/doc/tagpdf.tex
index 054d511..9efdd50 100644
--- a/doc/tagpdf.tex
+++ b/doc/tagpdf.tex
@@ -493,12 +493,13 @@ The key-val list understands the following keys:
 \item[\PrintKeyName{add-new-tag}] Allows to define new tag names, see
   section \ref{sec:new-tag} for a description.
 
-\item[\PrintKeyName{interwordspace}] Choice key, possible values are
+\item[\PrintKeyName{activate/spaces}] Choice key, possible values are
   \PrintKeyName{true}/""\PrintKeyName{on} and
   \PrintKeyName{false}/\PrintKeyName{off}. The key
   activates/deactivates the insertion of space glyphs, see
   section~\ref{sec:spacechars}. In the luamode it only works if at
   least \PrintKeyName{activate-mc} has been used.
+  The old name of the key |interwordspace| is still supported but deprecated.
 
 \item[\PrintKeyName{log}] Choice key, possible values
   \PrintKeyName{none}, \PrintKeyName{v}, \PrintKeyName{vv},
@@ -557,6 +558,17 @@ The key-val list understands the following keys:
   and the \PDF{} objcompresslevel to 0 and so allows to inspect the
   \PDF{}.
 
+\item[\PrintKeyName{debug}] This keys knows a number of sub-keys to
+  set various debug options. 
+  \begin{description}
+  \item[\PrintKeyName{debug/show}] This takes a comma list of keywords:
+  
+  \texttt{spaces}: \sidenote{luamode} 
+   That helps in lua mode to see where space glyph will be
+   inserted if \PrintKeyName{activate/spaces} is activated. 
+   This can also be activate with the now deprecated key |show-spaces|
+  
+   \end{description}
 
 \end{description}
 
diff --git a/tagpdf-space.dtx b/tagpdf-space.dtx
index 00ca1c2..8190de2 100644
--- a/tagpdf-space.dtx
+++ b/tagpdf-space.dtx
@@ -49,11 +49,13 @@
 % \date{Version 0.98v, released 2024-02-04}
 % \maketitle
 % \begin{documentation}
-% \begin{function}{interwordspace (setup-key)}
+% \begin{function}{activate/space (setup-key),interwordspace (deprecated)}
 % This key allows to activate/deactivate the real space chars if the engine supports
 % it. The allowed values are |true|, |on|, |false|, |off|.
+% The old name of the key |interwordspace| is still supported but deprecated.
 % \end{function}
-% \begin{function}{show-spaces (setup-key)}
+% \begin{function}{show-spaces (deprecated)}
+% This key is deprecated. Use |debug/show=spaces| instead. 
 % This key works only with luatex and shows with small red
 % bars where spaces have been inserted. This is only for debugging and
 % is not completly reliable (and change affect other literals and tagging), so it
@@ -73,17 +75,26 @@
 % support real space chars. Most of the code for luatex which uses attributes
 % is in the lua code, here are only the keys.
 %
-% \begin{macro}{interwordspace (setup-key),show-spaces (setup-key)}
+% \begin{macro}{activate/spaces (setup-key),interwordspace (deprecated),show-spaces (deprecated)}
 %    \begin{macrocode}
 %<*package>
 \keys_define:nn { @@ / setup }
   {         
-    interwordspace .choices:nn = { true, on }
+    activate/spaces .choices:nn = { true, on }
       { \msg_warning:nne {tag}{sys-no-interwordspace}{\c_sys_engine_str}  },
-    interwordspace .choices:nn = { false, off }
+    activate/spaces .choices:nn = { false, off }
       { \msg_warning:nne {tag}{sys-no-interwordspace}{\c_sys_engine_str}  },
-    interwordspace .default:n = true,
-    show-spaces .bool_set:N = \l_@@_showspaces_bool
+    activate/spaces .default:n = true,    
+    debug/show/spaces     .code:n = {\bool_set_true:N \l_@@_showspaces_bool},
+    debug/show/spacesOff  .code:n = {\bool_set_false:N \l_@@_showspaces_bool},
+%    \end{macrocode}
+% deprecated versions:
+%    \begin{macrocode}
+    interwordspace .meta:n = {activate/spaces={#1}},
+    interwordspace .default:n = {true},
+    show-spaces    .choice:,
+    show-spaces/true .meta:n =  {debug/show=spaces},
+    show-spaces/false .meta:n = {debug/show=spacesOff},
   }
 \sys_if_engine_pdftex:T
   {
@@ -92,19 +103,17 @@
         \pdfglyphtounicode{space}{0020}
         \keys_define:nn { @@ / setup }
           {
-            interwordspace .choices:nn = { true, on }  { \pdfinterwordspaceon },
-            interwordspace .choices:nn = { false, off }{ \pdfinterwordspaceon },
-            interwordspace .default:n = true,
-            show-spaces .bool_set:N = \l_@@_showspaces_bool
+            activate/spaces .choices:nn = { true, on }  { \pdfinterwordspaceon },
+            activate/spaces .choices:nn = { false, off }{ \pdfinterwordspaceon },
+            activate/spaces .default:n = true,
           }
       }
       {
         \keys_define:nn { @@ / setup }
           {
-            interwordspace .choices:nn = { true, on, false, off }
+            activate/spaces .choices:nn = { true, on, false, off }
               { \msg_warning:nnn {tag}{sys-no-interwordspace}{dvi}  },
-            interwordspace .default:n = true,
-            show-spaces .bool_set:N = \l_@@_showspaces_bool
+            activate/spaces .default:n = true,
           }
       }
   }
@@ -114,25 +123,23 @@
   {
     \keys_define:nn { @@ / setup }
       {
-        interwordspace .choices:nn =
+        activate/spaces .choices:nn =
                                  { true, on }
                                  {
                                    \bool_gset_true:N \g_@@_active_space_bool
                                    \lua_now:e{ltx.@@.func.markspaceon()}
                                  },
-        interwordspace .choices:nn =
+        activate/spaces .choices:nn =
                                  { false, off }
                                  {
                                   \bool_gset_false:N \g_@@_active_space_bool
                                   \lua_now:e{ltx.@@.func.markspaceoff()}
                                  },
-        interwordspace .default:n = true,
-        show-spaces      .choice:,
-        show-spaces  / true  .code:n =
+        activate/spaces .default:n = true,
+        debug/show/spaces    .code:n =
                                  {\lua_now:e{ltx.@@.trace.showspaces=true}},
-        show-spaces  / false .code:n =
+        debug/show/spacesOff .code:n =
                                  {\lua_now:e{ltx.@@.trace.showspaces=nil}},
-        show-spaces .default:n = true
       }
   }
 %    \end{macrocode}
diff --git a/tagpdf.dtx b/tagpdf.dtx
index ad8f195..b4ff701 100644
--- a/tagpdf.dtx
+++ b/tagpdf.dtx
@@ -561,7 +561,6 @@
 %<*package>
 \keys_define:nn { @@ / setup }
   {
-    activate-space  .bool_gset:N = \g_@@_active_space_bool,
     activate-mc     .bool_gset:N = \g_@@_active_mc_bool,
     activate-tree   .bool_gset:N = \g_@@_active_tree_bool,
     activate-struct .bool_gset:N = \g_@@_active_struct_bool,
@@ -571,20 +570,26 @@
     no-struct-dest .bool_gset_inverse:N = \g_@@_active_struct_dest_bool,
  %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{log (setup-key)}
+% \begin{macro}{debug/show (setup-key)}
+% Subkeys are defined in various other places.
+%    \begin{macrocode}
+    debug/show            .choice:,
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{debug/log (setup-key)}
 % The |log| takes currently the values |none|, |v|, |vv|, |vvv|, |all|.
 % The description of the log levels is in tagpdf-checks.
 %    \begin{macrocode}
-    log             .choice:,
-    log / none      .code:n = {\int_set:Nn \l_@@_loglevel_int { 0 }},
-    log / v         .code:n =
+    debug/log             .choice:,
+    debug/log / none      .code:n = {\int_set:Nn \l_@@_loglevel_int { 0 }},
+    debug/log / v         .code:n =
       {
         \int_set:Nn \l_@@_loglevel_int { 1 }
         \cs_set_protected:Nn \@@_check_typeout_v:n { \iow_term:e {##1} }
       },
-    log / vv        .code:n = {\int_set:Nn \l_@@_loglevel_int { 2 }},
-    log / vvv       .code:n = {\int_set:Nn \l_@@_loglevel_int { 3 }},
-    log / all       .code:n = {\int_set:Nn \l_@@_loglevel_int { 10 }},
+    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 }},
 %    \end{macrocode}
 % \end{macro}
 % \begin{macro}{tagunmarked (setup-key)}





More information about the latex3-commits mailing list.