[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: pagesattr, pageattr (7de3822)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Jun 11 00:16:20 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : backendtest
Link       : https://github.com/latex3/pdfresources/commit/7de382256c09b842f7e88e07106f16dc5f9cfca8

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

commit 7de382256c09b842f7e88e07106f16dc5f9cfca8
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Jun 11 00:16:20 2019 +0200

    pagesattr, pageattr


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

7de382256c09b842f7e88e07106f16dc5f9cfca8
 pdfresources.dtx        |   81 ++++++++++++++++++++++++++++++++++++-----------
 testfiles/pagesattr.pvt |    2 +-
 2 files changed, 63 insertions(+), 20 deletions(-)

diff --git a/pdfresources.dtx b/pdfresources.dtx
index c69565c..6996b7c 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -99,22 +99,23 @@
 % \end{NOTE}
 %    \begin{macrocode}
 %<*package>
-\bool_if:nT {(\sys_if_engine_pdftex_p: && \sys_if_output_pdf_p:) || \sys_if_engine_luatex_p: }
-{
- \cs_new_protected:Npn \@@_backend_end_run:n #1
-  {
-   \AtEndDocument{\clearpage #1}
-  }
-}
-
-\sys_if_engine_xetex:T
-{
- \RequirePackage{atenddvi}
- \cs_new_protected:Npn \@@_backend_end_run:n #1
-  {
-   \AtEndDvi{#1}
-  }
-}
+%\bool_if:nT {(\sys_if_engine_pdftex_p: && \sys_if_output_pdf_p:) || \sys_if_engine_luatex_p: }
+%{
+% \cs_new_protected:Npn \@@_backend_end_run:n #1
+%  {
+%   \AtEndDocument{\clearpage #1}
+%  }
+%}
+%
+%\bool_if:nT{ \sys_if_engine_xetex:T ||
+%{%need to be checked ...
+% \RequirePackage{atenddvi}
+% \cs_new_protected:Npn \@@_backend_end_run:n #1
+%  {
+%   %\AtEndDvi{#1}
+%  }
+%}
+\cs_new_protected:Npn \@@_backend_end_run:n #1 {} %check ...
 %</package>
 %    \end{macrocode}
 %\subsubsection{pdfxform}
@@ -248,7 +249,21 @@
   }
  }
 
+\sys_if_engine_xetex:T
+ {
+   \cs_new_protected:Npx \@@_backend_pageattr:n #1
+   {
+    \tex_special:D{pdf:~put~@thispage~<<#1>>}
+   }
+ }
 
+\bool_if:nT {\sys_if_engine_pdftex_p: && !\sys_if_output_pdf_p: }
+{
+  \cs_new_protected:Npx \@@_backend_pageattr:n #1
+  {
+   \tex_special:D{ps:~[{ThisPage}<<#1>>~/PUT~pdfmark}
+  }
+}
 %</package>
 %    \end{macrocode}
 % \subsection{backend / pageresources}
@@ -308,7 +323,7 @@
  }
 \cs_new_protected:Npn \@@_lastpage_hook_code:
  {
-
+   \@@_pagesattr_gpush:
  }
 %</package>
 %    \end{macrocode}
@@ -396,8 +411,6 @@
     }
   }
 
-%^^A: !!!!!!MOVE to general "push place"
-\@@_backend_end_run:n { \@@_pagesattr_gpush: }
 %</package>
 %    \end{macrocode}
 %
@@ -430,6 +443,20 @@
 %   done explictly. If a \meta{name} is used twice, only the last \meta{value}
 %   set will be used.
 % \end{function}
+% \begin{function}[added = 2019-06-11]
+%   {\pdf_pageattr_gput:nnn}
+%   \begin{syntax}
+%     \cs{pdf_pageattr_gput:nnn} \Arg{num} \Arg{name} \Arg{value}
+%   \end{syntax}
+%   Adds |/|\meta{name} \meta{value} at shipout to the page dictionaries of the
+%   page with the absolute page number \meta{num}.
+%   It is always stored globally. If \Arg{name} has already a value set with
+%   \cs{pdf_pageattr_gput:nn} it will overwrite it for this page.
+%   \meta{name} should be a valid pdf name without the leading slash,
+%   \meta{value} should be a valid pdf value. Any escaping or (re)encoding must be
+%   done explictly. If a \meta{name} is used twice, only the last \meta{value}
+%   set will be used.
+% \end{function}
 % \begin{function}[added = 2019-06-04]
 %   {\pdf_pageattr_get:nN}
 %   \begin{syntax}
@@ -474,6 +501,22 @@
    }
   }
 
+% setter by page:
+\cs_new_protected:Npn \pdf_pageattr_gput:nnn #1 #2 #3
+  {
+   \tl_if_empty:nTF { #3 }
+   {
+    \msg_none:nnn { pdf }{ empty-value }{ pageattr/#2 }
+   }
+   {
+    \prop_if_exist:cF{ g_@@_pageattr_#1_prop }
+     {
+      \prop_new:c { g_@@_pageattr_#1_prop }
+     }
+    \prop_gput:cnn { g_@@_pageattr_#1_prop } { #2 }{ #3}
+   }
+  }
+
 % getter from the prop:
 %^^A documentated
 \cs_new_protected:Npn \pdf_pageattr_get:nN #1 #2
diff --git a/testfiles/pagesattr.pvt b/testfiles/pagesattr.pvt
index 84bce56..934dc11 100644
--- a/testfiles/pagesattr.pvt
+++ b/testfiles/pagesattr.pvt
@@ -19,6 +19,6 @@ some text
 %test command:
 \newcommand\attributecontent{(somesetting)}
 \pdf_pagesattr_gput:nn {SSS}{\attributecontent}
-\tl_show:N\g__pdf_pagesattr_tl
+%\tl_show:N\g__pdf_pagesattr_tl
 \ExplSyntaxOff
 \end{document} 
\ No newline at end of file





More information about the latex3-commits mailing list