[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: pageattr (f680225)

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


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

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

commit f680225e7980fbddecbafc5aeb937ab632246b34
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Jun 11 21:25:16 2019 +0200

    pageattr


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

f680225e7980fbddecbafc5aeb937ab632246b34
 pdfresources.dtx |   49 +++++++++++++++++++++++++++++++------------------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/pdfresources.dtx b/pdfresources.dtx
index 551d4c2..ec08013 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -303,7 +303,7 @@
 % \section{Management code}
 % \subsection{Pathes}
 %  /Pages           %w,  \pagesattr
-%  /PageN           %w,  \pageattr
+%  /PageN           %w, N=1,..n or empty (=all pages) \pageattr
 %  /PageN/Resources %nw? \pageresources
 %  /PageN/Resources/ExtGState
 %  /PageN/Resources/ColorSpace
@@ -313,7 +313,12 @@
 %  /Info           %w, \pdfinfo
 %  /Catalog/OCProperties
 %  /Catalog/OutputIntents
-%
+% \subsection{helper commands}
+%    \begin{macrocode}
+%<*package>
+\prop_new:N\l_@@_tmpa_prop
+%</package>
+%    \end{macrocode}
 % \subsection{page wise managment in shipouthook}
 % For now until expl3/kernel interface exists code is added with atbegshi:
 %    \begin{macrocode}
@@ -337,7 +342,7 @@
  }
 \cs_new_protected:Npn \@@_everypage_shipout_code:n
  {
-
+  \@@_pageattr_gpush:n { #1 }
  }
 \cs_generate_variant:Nn \@@_everypage_shipout_code:n {V}
 \cs_new_protected:Npn \@@_lastpage_shipout_code:
@@ -393,7 +398,7 @@
 % \end{function}
 %    \begin{macrocode}
 %<*package>
-\prop_new:N \g_@@_pagesattr_prop
+\prop_new:c  { g_@@_/Pages_prop }
 % setter:
 %^^A documentated
 \cs_new_protected:Npn \pdf_pagesattr_gput:nn #1 #2
@@ -403,7 +408,7 @@
     \msg_none:nnn { pdf }{ empty-value }{ #1 }
    }
    {
-    \prop_gput:Nnn \g_@@_pagesattr_prop { #1 }{ #2}
+    \prop_gput:cnn { g_@@_/Pages_prop } { #1 }{ #2}
    }
   }
 
@@ -411,14 +416,14 @@
 %^^A documentated
 \cs_new_protected:Npn \pdf_pagesattr_get:nN #1 #2
   {
-   \prop_get:NnN \g_@@_pagesattr_prop { #1 } #2
+   \prop_get:cnN { g_@@_/Pages_prop } { #1 } #2
   }
 
 % remove:
 %^^A documentated
 \cs_new_protected:Npn \pdf_pagesattr_gremove:n #1
   {
-   \prop_gremove:Nn \g_@@_pagesattr_prop { #1 }
+   \prop_gremove:cn { g_@@_/Pages_prop } { #1 }
   }
 
 % push to the register command / issue the special
@@ -426,7 +431,7 @@
   {
     \exp_args:Nx \@@_backend_pagesattr:n
     {
-     \prop_map_function:NN \g_@@_pagesattr_prop \@@_dict_item:nn
+     \prop_map_function:cN { g_@@_/Pages_prop } \@@_dict_item:nn
     }
   }
 
@@ -503,7 +508,7 @@
 % \end{function}
 %    \begin{macrocode}
 %<*package>
-\prop_new:N \g_@@_pageattr_prop
+\prop_new:c { g_@@_/Page_prop }
 % setter.
 % The register is normally used only a few times in a document, but to get similar
 % behaviour between dvips/dvipdfmx and pdfmode it should be better be updated
@@ -516,7 +521,7 @@
     \msg_none:nnn { pdf }{ empty-value }{ pageattr/#1 }
    }
    {
-    \prop_gput:Nnn \g_@@_pageattr_prop { #1 }{ #2}
+    \prop_gput:cnn { g_@@_/Page_prop } { #1 }{ #2}
    }
   }
 
@@ -528,11 +533,11 @@
     \msg_none:nnn { pdf }{ empty-value }{ pageattr/#2 }
    }
    {
-    \prop_if_exist:cF{ g_@@_pageattr_#1_prop }
+    \prop_if_exist:cF{ g_@@_/Page#1_prop }
      {
-      \prop_new:c { g_@@_pageattr_#1_prop }
+      \prop_new:c { g_@@_/Page#1_prop }
      }
-    \prop_gput:cnn { g_@@_pageattr_#1_prop } { #2 }{ #3}
+    \prop_gput:cnn { g_@@_/Page#1_prop }{ #2 }{ #3}
    }
   }
 
@@ -540,26 +545,34 @@
 %^^A documentated
 \cs_new_protected:Npn \pdf_pageattr_get:nN #1 #2
   {
-   \prop_get:NnN \g_@@_pageattr_prop { #1 } #2
+   \prop_get:cnN { g_@@_/Page_prop } { #1 } #2
   }
 
 % remove:
 %^^A documentated
 \cs_new_protected:Npn \pdf_pageattr_gremove:n #1
   {
-   \prop_gremove:Nn \g_@@_pageattr_prop { #1 }
+   \prop_gremove:cn { g_@@_/Page_prop } { #1 }
   }
 
 % push to the register
-\cs_new_protected:Npn \@@_pageattr_gpush:
+\cs_new_protected:Npn \@@_pageattr_gpush:n #1 %#1 = page number
  {
+   \prop_set_eq:Nc\l_@@_tmpa_prop { g_@@_/Page_prop }
+   \prop_if_exist:cT { g_@@_/Page#1_prop }
+   {
+    \prop_map_inline:cn { g_@@_/Page#1_prop }
+    {
+      \prop_put:Nnn \l_@@_tmpa_prop { ##1 }{ ##2 }
+    }
+   }
    \exp_args:Nx \@@_backend_pageattr:n
    {
-    \prop_map_function:NN \g_@@_pageattr_prop \@@_dict_item:nn
+    \prop_map_function:NN \l_@@_tmpa_prop \@@_dict_item:nn
    }
  }
 %must this be in a box??
-\AtBeginShipout{\@@_pageattr_gpush:}
+
 %</package>
 %    \end{macrocode}
 %





More information about the latex3-commits mailing list