[latex3-commits] [git/LaTeX3-latex3-pdfresources] splitting: convert to new pdf_text_convert commands (d38a062)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Jul 5 17:03:42 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : splitting
Link       : https://github.com/latex3/pdfresources/commit/d38a0622d6f05d7bd3798e77d825d5dbd49051f3

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

commit d38a0622d6f05d7bd3798e77d825d5dbd49051f3
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Jul 5 17:03:42 2020 +0200

    convert to new pdf_text_convert commands


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

d38a0622d6f05d7bd3798e77d825d5dbd49051f3
 experiments/embedfiles.tex     | 10 +++++-----
 hgeneric-experimental.def      | 18 +++++++++---------
 l3pdffile.dtx                  | 10 +++++-----
 l3pdfmeta.dtx                  |  2 +-
 l3pdftools.dtx                 |  4 +++-
 newpackages/new-attachfile.sty | 10 +++++-----
 testfiles-dvips/embedfile.pvt  |  6 ++----
 testfiles/embedfile.pvt        |  6 ++----
 testfiles/infodict-new.pvt     |  2 +-
 testfiles/transition.pvt       |  2 +-
 10 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/experiments/embedfiles.tex b/experiments/embedfiles.tex
index 7adb664..01a683c 100644
--- a/experiments/embedfiles.tex
+++ b/experiments/embedfiles.tex
@@ -15,13 +15,13 @@
 \begin{document}
 \section{Testing embedding and attaching files}
 \ExplSyntaxOn
-%\pdftool_textstringlit_print:nN {xxxgrüße}\l_tmpa_str
+%\pdf_text_convert:nnN {string-lit-print} {xxxgrüße}\l_tmpa_str
 %\pdfextension outline goto name {Doc-Start}{\l_tmpa_str}
 %\group_begin:
 %%set the relationship:
 %\pdfdict_put:nnn  {file/FileSpec} {AFRelationship}{/Source}
 %%set the description key. The text must be made safe first:
-%\pdftool_textstringlit_print:nN {this~is~an~odd~description~with~öäü}\l_tmpa_str
+%\pdf_text_convert:nnN {string-lit-print} {this~is~an~odd~description~with~öäü}\l_tmpa_str
 %\pdfdict_put:nnx  {file/FileSpec} {Desc}{\l_tmpa_str}
 %%embeds testinput.txt and calls it grüße.txt
 \pdffile_embed_file:nnn {testinput.txt}{blub.txt}{file:example1}
@@ -35,7 +35,7 @@
 
 %\group_begin:
 %\pdfdict_put:nnn  {file/FileSpec} {AFRelationship}{/Source}
-%\pdftool_textstringlit_print:nN {this~is~something~odd~with~öäü}\l_tmpa_str
+%\pdf_text_convert:nnN {string-lit-print} {this~is~something~odd~with~öäü}\l_tmpa_str
 %\pdfdict_put:nnx  {file/FileSpec} {Desc}{\l_tmpa_str}
 %\pdffile_embed_file:nnn {grüße.txt}{echtegrüße.txt}{example2}
 %\group_end:
@@ -76,11 +76,11 @@
 \begin{document}
 \section{Testing embedding and attaching files}
 \ExplSyntaxOn
-%\pdftool_textstringlit_print:nN {xxxgrüße}\l_tmpa_str
+%\pdf_text_convert:nnN {string-lit-print} {xxxgrüße}\l_tmpa_str
 %\pdfextension outline goto name {Doc-Start}{\l_tmpa_str}
 \group_begin:
 \pdfdict_put:nnn  {file/FileSpec} {AFRelationship}{/Source}
-\pdftool_textstringlit_print:nN {this~is~something~odd~with~öäü}\l_tmpa_str
+\pdf_text_convert:nnN {string-lit-print} {this~is~something~odd~with~öäü}\l_tmpa_str
 \pdfdict_put:nnx  {file/FileSpec} {Desc}{\l_tmpa_str}
 \pdffile_embed_file:nnn {testinput.txt}{grüße.txt}{example0}
 \group_end:
diff --git a/hgeneric-experimental.def b/hgeneric-experimental.def
index fa202f0..15dd450 100644
--- a/hgeneric-experimental.def
+++ b/hgeneric-experimental.def
@@ -42,7 +42,7 @@
   Hyperref driver for luaTeX]
 \RequirePackage{pdfresources}
 \RequirePackage{xparse,etoolbox}
-\RequirePackage{new-pdfescape} %temporarly!
+\RequirePackage{l3pdftools} %temporarly!
 \chardef\Hy at VersionChecked=1 %don't check the version!
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \ExplSyntaxOn
@@ -262,13 +262,13 @@
 
 % this takes the output of \__hyp_text_purify and applies a converter
 % #1 = text, #2 = converter #3 output
-% #2 should be hex_print for \pdftool_textstringhex_print:nN
-%              hex for \pdftool_textstringhex:nN
-%           or lit_print for \pdftool_textstringlit_print:nN
-%           or lit for \pdftool_textstringlit:nN
+% #2 should be string-hex-print for \pdf_text_convert:nnN {string-hex-print}
+%              string-hex for \pdf_text_convert:nnN {string-hex}
+%           or string-lit_print for \pdf_text_convert:nnN {string-lit-print}
+%           or lit for \pdf_text_convert:nnN {string-lit}
 \cs_new_protected:Npn \__hyp_text_to_string:NnN #1 #2 #3
   {
-     \use:c { pdftool_textstring#2:VN } #1 #3
+     \pdf_text_convert:nVN {#2 } #1 #3
   }
 
 %% combining both:
@@ -283,7 +283,7 @@
 %info keys use hex_print for now:
 \cs_new_protected:Npn \__hyp_text_convert_info:nN #1 #2
  {
-   \__hyp_text_purify_to_string:nnN { #1 }{ hex_print } #2
+   \__hyp_text_purify_to_string:nnN { #1 }{ string-hex-print } #2
  }
 
 
@@ -1437,7 +1437,7 @@
          {
             \__hyp_text_convert_info:nN {##1}\l__hyp_tmpa_tl
             \exp_args:Nnx
-              \pdfcoredict_gput:nnx {Info}{\exp_args:No\pdftool_name:n{\l_keys_key_str}}{\l__hyp_tmpa_tl}
+              \pdfcoredict_gput:nnx {Info}{\pdf_text_convert:nV {name }\l_keys_key_str}{\l__hyp_tmpa_tl}
          }
       }
   }
@@ -1672,7 +1672,7 @@
            /A
              <<
                /S/Named
-               /N\pdftool_name_print:n{#1}
+               /N\pdf_text_convert:nn{name-print}{#1}
                \Hy at href@nextactionraw
              >>
          }
diff --git a/l3pdffile.dtx b/l3pdffile.dtx
index 6d6096b..07b6acc 100644
--- a/l3pdffile.dtx
+++ b/l3pdffile.dtx
@@ -348,7 +348,7 @@
 % %set the relationship:
 % \pdfdict_put:nnn  {file/FileSpec} {AFRelationship}{/Source}
 % %set the description key. The text must first be converted:
-% \pdftool_textstringlit_print:nN
+% \pdf_text_convert:nnN {string-lit-print}
 %    {this~is~an~odd~description~with~öäü}
 %    \l_tmpa_str
 % \pdfdict_put:nnx  {file/FileSpec} {Desc}{\l_tmpa_str}
@@ -371,13 +371,13 @@
 %<*package>
 \ProvidesExplPackage {l3pdffile} {2020-07-02} {0.2}
   {embedding and referencing files in PDF}
-\RequirePackage{new-pdfescape}  %temporarly!!
+\RequirePackage{l3pdftools}  %temporarly!!
 %    \end{macrocode}
 %
 %    \begin{macrocode}
 %<@@=pdffile>
-\cs_set_eq:NN \@@_filename_convert_to_print:nN
-              \pdftool_textstringhex_print:nN
+\cs_new_protected:Npn \@@_filename_convert_to_print:nN #1 #2
+  {\pdf_text_convert:nnN {string-hex-print}{#1}{#2}}
 %    \end{macrocode}
 % \subsection{Messages}
 %    \begin{macrocode}
@@ -526,7 +526,7 @@
               \l_@@_ext_str
               \l_@@_tmpb_tl
               {
-                \tl_set:Nx #2 {/Subtype~\pdftool_name_print:V \l_@@_tmpb_tl}
+                \tl_set:Nx #2 {/Subtype~\pdf_text_convert:nV {name-print} \l_@@_tmpb_tl}
               }
               {
                 \msg_warning:nnx { pdffile }{ mimetype-missing} {#1}
diff --git a/l3pdfmeta.dtx b/l3pdfmeta.dtx
index 0eab65c..2d944b5 100644
--- a/l3pdfmeta.dtx
+++ b/l3pdfmeta.dtx
@@ -83,7 +83,7 @@
 \ProvidesExplPackage {l3pdfmeta} {2020-05-17} {0.2}
   {XMP-Metadata}
 \RequirePackage{pdfresources}
-\RequirePackage{new-pdfescape}  %temporarly!!
+\RequirePackage{l3pdftools}  %temporarly!!
 %    \end{macrocode}
 % \section{Document metadata}
 % We plan a \cs{DeclareDocumentMetaData} so let's start with it.
diff --git a/l3pdftools.dtx b/l3pdftools.dtx
index ee81132..093396c 100644
--- a/l3pdftools.dtx
+++ b/l3pdftools.dtx
@@ -110,7 +110,7 @@
 %<@@=pdf>
 %    \end{macrocode}
 % \subsection{Conversions}
-% \begin{macro}{\pdf_text_convert:nn}
+% \begin{macro}{\pdf_text_convert:nn,\pdf_text_convert:nV}
 % \begin{macro}{\pdf_text_convert:nnN}
 % \begin{macro}{\@@_text_convert_name:n}
 % \begin{macro}{\@@_text_convert_name:nN}
@@ -138,6 +138,8 @@
       }
     { #2 } #3
   }
+
+\cs_generate_variant:Nn \pdf_text_convert:nnN {nVN}
 %% tool command escape name
 %% commands in the argument are expanded if possible
 %% with \text_expand:n
diff --git a/newpackages/new-attachfile.sty b/newpackages/new-attachfile.sty
index 66d9b8b..0abfd4b 100644
--- a/newpackages/new-attachfile.sty
+++ b/newpackages/new-attachfile.sty
@@ -151,7 +151,7 @@
             \pdfdict_remove:nn {file}{Subtype}
           }
           {
-            \pdfdict_put:nnx   {file}{Subtype}{\pdftool_name_print:n{#1} }
+            \pdfdict_put:nnx   {file}{Subtype}{\pdf_text_convert:nn {name}{#1} }
           }
       }
     ,mimetype  .groups:n = { embed }
@@ -159,7 +159,7 @@
       {
         \tl_if_empty:nF { #1 }
           {
-           \pdftool_textstringhex_print:nN  { #1 } \l__atfi_filename_tl %variable
+           \pdf_text_convert:nnN {string-hex-print}  { #1 } \l__atfi_filename_tl %variable
            \pdfdict_put:nnx { file/FileSpec } {F}  { \l__atfi_filename_tl }
            \pdfdict_put:nnx { file/FileSpec } {UF} { \l__atfi_filename_tl }
           }
@@ -168,7 +168,7 @@
     ,afrelationship .choices:nn =
       {Source, Data, Alternative, Supplement, EncryptedPayload, FormData, Schema, Unspecified }
       {
-        \pdfdict_put:nnx { file/FileSpec } {AFRelationship }  { \pdftool_name_print:n {#1} }
+        \pdfdict_put:nnx { file/FileSpec } {AFRelationship }  { \pdf_text_convert:nn {name} {#1} }
       }
     ,afrelationship .default:n = { Unspecified }
     ,afrelationship / .code:n =
@@ -192,7 +192,7 @@
                 \pdfdict_put:nnx
                   { file/FileSpec }
                   {AFRelationship }
-                  { \pdftool_name_print:n {#1} }
+                  { \pdf_text_convert:nn {name} {#1} }
               }
           }
       }
@@ -207,7 +207,7 @@
             \pdfdict_remove:nn {file/FileSpec}{ModDate}
           }
           {
-            \pdfdict_put:nnx   {file}{ModDate}{\pdftool_litstring:n{#1} }
+            \pdfdict_put:nnx   {file}{ModDate}{\pdf_text_convert:nnN {string-lit}{#1} } %or print??
           }
       }
     ,moddate  .groups:n  = { embed }
diff --git a/testfiles-dvips/embedfile.pvt b/testfiles-dvips/embedfile.pvt
index 89bd31b..c949ff5 100644
--- a/testfiles-dvips/embedfile.pvt
+++ b/testfiles-dvips/embedfile.pvt
@@ -20,11 +20,9 @@ grüße
 \begin{document}
 \section{Testing embedding and attaching files}
 \ExplSyntaxOn
-%\pdftool_textstringlit_print:nN {xxxgrüße}\l_tmpa_str
-%\pdfextension outline goto name {Doc-Start}{\l_tmpa_str}
 \group_begin:
 \pdfdict_put:nnn  {file/FileSpec} {AFRelationship}{/Source}
-\pdftool_textstringlit_print:nN {this~is~something~odd~with~öäü}\l_tmpa_str
+\pdf_text_convert:nnN {string-lit-print} {this~is~something~odd~with~öäü}\l_tmpa_str
 \pdfdict_put:nnx  {file/FileSpec} {Desc}{\l_tmpa_str}
 \pdfdict_put:nnx  {file/Params} {ModDate}{(D:20200422135851Z)}
 \pdffile_embed_file:nnn {testinput.txt}{grüße.txt}{example1}
@@ -33,7 +31,7 @@ grüße
 
 \group_begin:
 \pdfdict_put:nnn  {file/FileSpec} {AFRelationship}{/Source}
-\pdftool_textstringlit_print:nN {this~is~something~odd~with~öäü}\l_tmpa_str
+\pdf_text_convert:nnN {string-lit-print} {this~is~something~odd~with~öäü}\l_tmpa_str
 \pdfdict_put:nnx  {file/FileSpec} {Desc}{\l_tmpa_str}
 \pdfdict_put:nnx  {file/Params} {ModDate}{(D:20200422155851+02'00')}
 \pdffile_embed_file:nnn {grüße.txt}{echtegrüße.txt}{example2}
diff --git a/testfiles/embedfile.pvt b/testfiles/embedfile.pvt
index f80b3d4..b9a1146 100644
--- a/testfiles/embedfile.pvt
+++ b/testfiles/embedfile.pvt
@@ -12,11 +12,9 @@ grüße
 \begin{document}
 \section{Testing embedding and attaching files}
 \ExplSyntaxOn
-%\pdftool_textstringlit_print:nN {xxxgrüße}\l_tmpa_str
-%\pdfextension outline goto name {Doc-Start}{\l_tmpa_str}
 \group_begin:
 \pdfdict_put:nnn  {file/FileSpec} {AFRelationship}{/Source}
-\pdftool_textstringlit_print:nN {this~is~something~odd~with~öäü}\l_tmpa_str
+\pdf_text_convert:nnN {string-lit-print} {this~is~something~odd~with~öäü}\l_tmpa_str
 \pdfdict_put:nnx  {file/FileSpec} {Desc}{\l_tmpa_str}
 \pdfdict_put:nnx  {file/Params} {ModDate}{(D:20200422135851Z)}
 \pdffile_embed_file:nnn {testinput.txt}{grüße.txt}{example1}
@@ -25,7 +23,7 @@ grüße
 
 \group_begin:
 \pdfdict_put:nnn  {file/FileSpec} {AFRelationship}{/Source}
-\pdftool_textstringlit_print:nN {this~is~something~odd~with~öäü}\l_tmpa_str
+\pdf_text_convert:nnN {string-lit-print} {this~is~something~odd~with~öäü}\l_tmpa_str
 \pdfdict_put:nnx  {file/FileSpec} {Desc}{\l_tmpa_str}
 \pdfdict_put:nnx  {file/Params} {ModDate}{(D:20200422155851+02'00')}
 \pdffile_embed_file:nnn {grüße.txt}{echtegrüße.txt}{example2}
diff --git a/testfiles/infodict-new.pvt b/testfiles/infodict-new.pvt
index 177219d..d83ecec 100644
--- a/testfiles/infodict-new.pvt
+++ b/testfiles/infodict-new.pvt
@@ -1,5 +1,5 @@
 \input{regression-test}
-\RequirePackage{l3pdf,lthooks,new-pdfescape}
+\RequirePackage{l3pdf,lthooks}
 \ExplSyntaxOn
 \pdf_version_gset:n{1.7}
 \ExplSyntaxOff
diff --git a/testfiles/transition.pvt b/testfiles/transition.pvt
index b13433f..2593d1d 100644
--- a/testfiles/transition.pvt
+++ b/testfiles/transition.pvt
@@ -6,7 +6,7 @@
 \ExplSyntaxOff
 
 \documentclass{article}
-\usepackage{new-pdfescape,lipsum}
+\usepackage{lipsum}
 \usepackage[customdriver=hgeneric-experimental]{hyperref}
 
 \begin{document}





More information about the latex3-commits mailing list.