[latex3-commits] [git/LaTeX3-latex3-pdfresources] splitting: split l3pdfme (16785df)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Jul 15 18:43:16 CEST 2020


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

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

commit 16785dff57a7be38716e71c0c80a7ce7fcfd6e5b
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Jul 15 18:43:16 2020 +0200

    split l3pdfme


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

16785dff57a7be38716e71c0c80a7ce7fcfd6e5b
 l3pdfinit.dtx | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 l3pdfmeta.dtx | 150 +++++++++++++++------------------------------------
 2 files changed, 212 insertions(+), 106 deletions(-)

diff --git a/l3pdfinit.dtx b/l3pdfinit.dtx
new file mode 100644
index 0000000..0895997
--- /dev/null
+++ b/l3pdfinit.dtx
@@ -0,0 +1,168 @@
+% \iffalse meta-comment
+%
+%% File: l3pdfinit.dtx
+%
+% Copyright (C) 2018-2020 The LaTeX3 Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version.  The latest version
+% of this license is in the file
+%
+%    http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "(experimental) pdfresources bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+%    https://github.com/latex3/pdfresources
+%
+% for those people who are interested.
+%
+%<*driver>
+\documentclass[full]{l3doc}
+\begin{document}
+  \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \title{^^A
+%   The \pkg{l3pdfinit} package
+% }
+%
+% \author{^^A
+%  The \LaTeX3 Project\thanks
+%    {^^A
+%      E-mail:
+%        \href{mailto:latex-team at latex-project.org}
+%          {latex-team at latex-project.org}^^A
+%    }^^A
+% }
+%
+% \date{Released XXXX-XX-XX}
+%
+% \maketitle
+% \begin{documentation}
+%
+% \section{\pkg{l3pdfinit} documentation}
+% This small package defines \cs{DeclareDocumentMetaData} and the related keys.
+% \cs{DeclareDocumentMetaData} loads the core code and the backend. So it need
+% at least a key to set the backend.
+%
+% Currently the following keys are implemented
+%
+% \begin{description}
+%    \item[\texttt{expl3}] passes the value to expl3.
+%                This be used for example to setup the driver. The name and
+%                implementation will probably change.
+%    \item[\texttt{pdfversion}] e.g. \texttt{pdfversion=1.7}
+%    \item[\texttt{uncompress}] no value. Force an uncompressed pdf.
+%    \item[\texttt{lang}] to set the Lang entry in the Catalog. E.g. \texttt{lang=de-DE}.
+%    \item[\texttt{standard}] Choice key to set the pdf standard. Currently A-1b, A-2b and A-3b are accepted as
+%              values, but the underlying code to ensure the requirements (as far as it
+%              can be ensured) is incomplete.
+%    \item[\texttt{xmpmeta}] Boolean. This includes a skeleton XMP-metadata in the pdf. This clashes
+%     with e.g. hyperxmp, and the code to extend the metadata isn't finished yet.
+%    \item[\texttt{core}] Boolean. This activates/deactivates the core management code.
+%         By default the value is true.
+% \end{description}
+% \end{documentation}
+%
+% \begin{implementation}
+%
+% \section{\pkg{l3pdfinit} implementation}
+%
+%    \begin{macrocode}
+%<*package>
+\ProvidesExplPackage {l3pdfinit} {2020-07-15} {0.1}
+  {pdfresources initialisation command}
+%    \end{macrocode}
+% \section{Document metadata}
+% We plan a \cs{DeclareDocumentMetaData} so let's start with it.
+% It should for the begin allow to set the version, to uncompress a pdf,
+% and set the language. We also add a key to activate the metadata stream and
+% to set a standard. The command triggers the use of the core resource management.
+% \begin{NOTE}{UF}
+% how to setup a backend/driver key? Can it be copied from expl3?
+% \end{NOTE}
+%%
+% \begin{variable}{\g_@@_Core_active_bool}
+% This boolean will control the activation of the management code.
+% It is used in the hooks, and in some backend files.
+% \cs{DeclareDocumentMetadata} should set it to true
+%    \begin{macrocode}
+%<@@=pdf>
+%<*package>
+\bool_new:N \g_@@_Core_active_bool
+%    \end{macrocode}
+% \end{variable}
+% \begin{function}[updated=2020-07-05]{\DeclareDocumentMetaData}
+%    \begin{macrocode}
+\msg_new:nnn  { pdf } { setup-after-documentclass }
+              {
+                \token_to_str:N \DeclareDocumentMetaData \c_space_tl
+                should~be~used~only~before~\token_to_str:N\documentclass
+              }
+
+\NewDocumentCommand\DeclareDocumentMetaData { m }
+  {
+    \cs_if_eq:NNTF \documentclass \@twoclasseserror
+      { \msg_error:nn { pdf }{ setup-after-documentclass } }
+      {
+        \keys_set_groups:nnn { pdf / setup} {init}{ #1 }
+        \RequirePackage{l3pdf}
+        \RequirePackage{lthooks} %
+        % %load backend driver
+        \ExplSyntaxOn\makeatletter
+        \file_input:n {l3\g__sys_backend_tl-pdf.def}
+        \ExplSyntaxOff\makeatother
+        \bool_gset_true:N \g_@@_Core_active_bool
+        \keys_set_filter:nnn  { pdf / setup } { init } { #1 }
+      }
+  }
+
+\keys_define:nn { pdf / setup }
+  {
+    expl3 .code:n = { \PassOptionsToPackage { #1 } {expl3} },
+    expl3 .groups:n = { init } ,
+  }
+
+\keys_define:nn { pdf / setup }
+  {
+    ,pdfversion .code:n =
+      {
+        \pdf_version_gset:n { #1 }
+      }
+    ,uncompress .code:n =
+      {
+        \pdf_uncompress:
+      }
+    ,lang .code:n =
+      {
+        \pdfcoredict_gput:nnn {Catalog} {Lang}{(#1)}
+      }
+    ,xmpmeta .bool_gset:N = \g_pdfmeta_xmp_bool %see pdfmeta
+    ,standard .choices:nn =
+      {A-1b,A-2b,A-3b}
+      {
+        \prop_gset_eq:Nc \g_pdfmeta_standard_prop { g_@@_meta_standard_pdf/#1_prop }
+      }
+    ,standard / unknown .code:n =
+      {
+        \msg_warning:nnn{pdf}{unknown-standard}{#1}
+      }
+    ,core .bool_gset:N = \g__pdf_Core_active_bool  
+  }
+%    \end{macrocode}
+% \end{function}
+%    \begin{macrocode}
+%</package>
+%    \end{macrocode}
+%
+% \end{implementation}
+%
+% \PrintIndex
diff --git a/l3pdfmeta.dtx b/l3pdfmeta.dtx
index f9b9d51..8bb87d3 100644
--- a/l3pdfmeta.dtx
+++ b/l3pdfmeta.dtx
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-%% File: l3pdffile.dtx
+%% File: l3pdfmeta.dtx
 %
 % Copyright (C) 2018-2020 The LaTeX3 Project
 %
@@ -79,92 +79,22 @@
 %
 %    \begin{macrocode}
 %<*package>
+%<@@=pdfmeta>
 \ProvidesExplPackage {l3pdfmeta} {2020-05-17} {0.2}
   {XMP-Metadata}
 %    \end{macrocode}
-% \section{Document metadata}
-% We plan a \cs{DeclareDocumentMetaData} so let's start with it.
-% It should for the begin allow to set the version, to uncompress a pdf,
-% and set the language. We also add a key to activate the metadata stream and
-% to set a standard. The command triggers the use of the core resource management.
-% \begin{NOTE}{UF}
-% how to setup a backend/driver key? Can it be copied from expl3?
-% \end{NOTE}
-%%
-% \begin{variable}{\g_@@_Core_active_bool}
-% This boolean will control the activation of the management code.
-% It is used in the hooks, and in some backend files.
-% \cs{DeclareDocumentMetadata} should set it to true
 %    \begin{macrocode}
-%<@@=pdf>
-%<*package>
-\bool_new:N \g_@@_Core_active_bool
+\msg_new:nnn  {pdf }{unknown-standard}{The~standard~'#1'~is~unknown~and~has~been~ignored}
 %    \end{macrocode}
-% \end{variable}
-% \begin{function}[updated=2020-07-05]{\DeclareDocumentMetaData}
+% \begin{variable}{\l_@@_tmpa_tl}
 %    \begin{macrocode}
-\NewDocumentCommand\DeclareDocumentMetaData { m }
-  {
-    \cs_if_eq:NNTF \documentclass \@twoclasseserror
-      { \msg_error:nn { pdf }{ setup-after-documentclass } }
-      {
-        \keys_set_groups:nnn { pdf / setup} {init}{ #1 }
-        \RequirePackage{l3pdf}
-        \RequirePackage{lthooks} %
-        % %load backend driver
-        \ExplSyntaxOn\makeatletter
-        \file_input:n {l3\g__sys_backend_tl-pdf.def}
-        \ExplSyntaxOff\makeatother
-        \bool_gset_true:N \g_@@_Core_active_bool
-        \keys_set_filter:nnn  { pdf / setup } { init } { #1 }
-      }
-  }
-
-\msg_new:nnn  {pdf }{unknown-standard}{The~standard~'#1'~is~unknown~and~has~been~ignored}
-
-\msg_new:nnn  { pdf } { setup-after-documentclass }
-              { \token_to_str:N \DeclareDocumentMetaData \c_space_tl
-                should~be~used~only~before~\token_to_str:N\documentclass
-              }
-
-\bool_new:N \g_@@_meta_bool
-\keys_define:nn { pdf / setup }
-  {
-    expl3 .code:n = { \PassOptionsToPackage { #1 } {expl3} },
-    expl3 .groups:n = { init } ,
-  }
-
-\keys_define:nn { pdf / setup }
-  {
-    ,pdfversion .code:n =
-      {
-        \pdf_version_gset:n { #1 }
-      }
-    ,uncompress .code:n =
-      {
-        \pdf_uncompress:
-      }
-    ,lang .code:n =
-      {
-        \pdfcoredict_gput:nnn {Catalog} {Lang}{(#1)}
-      }
-    ,meta .bool_gset:N = \g_@@_meta_bool
-    ,standard .choices:nn =
-      {A-1b,A-2b,A-3b}
-      {
-        \prop_gset_eq:Nc \g_pdfmeta_standard_prop { g_@@_meta_standard_pdf/#1_prop }
-      }
-    ,standard / unknown .code:n =
-      {
-        \msg_warning:nnn{pdf}{unknown-standard}{#1}
-      }
-  }
+\tl_new:N\l_@@_tmpa_tl
 %    \end{macrocode}
-% \end{function}
+% \end{variable}
 % \section{XMP-metadata}
 %    \begin{macrocode}
 % we need a command to write a BOM to the pdf:
-\str_const:Nx\c_@@_meta_bom_str
+\str_const:Nx\c_@@_bom_str
  {
   \bool_if:nTF
     {
@@ -180,15 +110,15 @@
     }
  }
 % writing the stream:
-\str_new:N \g_@@_xmpmeta_str
+\str_new:N \g_@@_xmppacket_str
 
-\str_gset:Nx      \g_@@_xmpmeta_str {<?xpacket~begin="\c_@@_meta_bom_str"~id="W5M0MpCehiHzreSzNTczkc9d"?>\iow_newline:}
-\str_gput_right:Nx \g_@@_xmpmeta_str {<x:xmpmeta~xmlns:x="adobe:ns:meta/">\iow_newline:}
+\str_gset:Nx      \g_@@_xmppacket_str {<?xpacket~begin="\c_@@_bom_str"~id="W5M0MpCehiHzreSzNTczkc9d"?>\iow_newline:}
+\str_gput_right:Nx \g_@@_xmppacket_str {<x:xmpmeta~xmlns:x="adobe:ns:meta/">\iow_newline:}
 
 %here more contents ...
-\str_gput_right:Nx \g_@@_xmpmeta_str { </x:xmpmeta> \iow_newline: }
+\str_gput_right:Nx \g_@@_xmppacket_str { </x:xmpmeta> \iow_newline: }
 %here padding??
-\str_gput_right:Nn \g_@@_xmpmeta_str { <?xpacket~end="w"?> }
+\str_gput_right:Nn \g_@@_xmppacket_str { <?xpacket~end="w"?> }
 %
 %    \end{macrocode}
 % \subsection{The stream object}
@@ -197,13 +127,13 @@
 
 \hook_gput_code:nnn {shipout/lastpage}{pdf}
   {
-    \bool_if:NT \g_@@_meta_bool
+    \bool_if:NT \g_pdfmeta_xmp_bool
       {
         \pdf_object_new:nn {__pdf_Metadata} {stream}
         \pdf_object_write:nx {__pdf_Metadata}
          {
            { /Type /Metadata /Subtype /XML }
-           {\g_@@_xmpmeta_str}
+           {\g_@@_xmppacket_str}
          }
       }
   }
@@ -212,9 +142,11 @@
 % \section{standards (work in progress)}
 % \subsection{Tools and tests}
 % This public property will contain the settings for the document.
+% \begin{variable}{\g_pdfmeta_standard_prop}
 %    \begin{macrocode}
 \prop_new:N \g_pdfmeta_standard_prop
 %    \end{macrocode}
+% \end{variable}
 % This conditional tests if the value for /N in a named action is allowed
 % (pdf/A restrict the names).
 %    \begin{macrocode}
@@ -242,41 +174,46 @@
   }
 %    \end{macrocode}
 %  \subsection{pdf/A}
+%  \begin{variable}{
+%   \g_pdfmeta_standard_pdf/A-1b_prop ,
+%   \g_pdfmeta_standard_pdf/A-2b_prop,
+%   \g_pdfmeta_standard_pdf/A-3b_prop
+%   }
 %     \begin{macrocode}
-\prop_new:c { g_@@_meta_standard_pdf/A-1b_prop }
-\prop_set_from_keyval:cn { g_@@_meta_standard_pdf/A-1b_prop }
+\prop_new:c { g_pdfmeta_standard_pdf/A-1b_prop }
+\prop_set_from_keyval:cn { g_pdfmeta_standard_pdf/A-1b_prop }
   {
-    ,name         = pdf/A-1b
-    ,year         = 2005
-    ,pdf_version  = 1.4        %minimum
-    ,encryption   = false
+    ,name             = pdf/A-1b
+    ,year             = 2005
+    ,pdf_version      = 1.4        %minimum
+    ,encryption       = false
     ,external_content = false  % no F, FFilter, or FDecodeParms in stream dicts
-    ,embed_content = false,    %no EF key in filespec, no /Type/EmbeddedFiles
+    ,embed_content    = false, % no EF key in filespec, no /Type/EmbeddedFiles
     ,max_string_size  = 65535
     ,max_array_size   = 8191
     ,max_dict_size    = 4095
-    ,max_obj_num     =  8388607
-    ,max_nest_qQ     = 28
+    ,max_obj_num      =  8388607
+    ,max_nest_qQ      = 28
     ,Catalog/OCProperties    = false
-    ,named_actions   = {NextPage, PrevPage, FirstPage, LastPage}
-    ,annot_flags     = {
-                         \pdf_flag_set:nn   {annot/Link}{Print}
-                         \pdf_flag_clear:nn {annot/Link}{Hidden}
-                         \pdf_flag_clear:nn {annot/Link}{Invisible}
-                         \pdf_flag_clear:nn {annot/Link}{NoView}
-                       }
+    ,named_actions    = {NextPage, PrevPage, FirstPage, LastPage}
+    ,annot_flags      = {
+                          \pdf_flag_set:nn   {annot/Link}{Print}
+                          \pdf_flag_clear:nn {annot/Link}{Hidden}
+                          \pdf_flag_clear:nn {annot/Link}{Invisible}
+                          \pdf_flag_clear:nn {annot/Link}{NoView}
+                        }
     % to be continued https://docs.verapdf.org/validation/pdfa-part1/
   }
 
-\prop_new:c { g_@@_meta_standard_pdf/A-2b_prop }
+\prop_new:c { g_pdfmeta_standard_pdf/A-2b_prop }
 \prop_gset_eq:cc
-  { g_@@_meta_standard_pdf/A-2b_prop }
-  { g_@@_meta_standard_pdf/A-1b_prop }
+  { g_pdfmeta_standard_pdf/A-2b_prop }
+  { g_pdfmeta_standard_pdf/A-1b_prop }
 
-\prop_new:c { g_@@_meta_standard_pdf/A-3b_prop }
+\prop_new:c { g_pdfmeta_standard_pdf/A-3b_prop }
 \prop_gset_eq:cc
-  { g_@@_meta_standard_pdf/A-3b_prop }
-  { g_@@_meta_standard_pdf/A-2b_prop }
+  { g_pdfmeta_meta_standard_pdf/A-3b_prop }
+  { g_pdfmeta_meta_standard_pdf/A-2b_prop }
 
 
 %   ["pdf/a-1b:2005"] = {
@@ -300,6 +237,7 @@
 %            end
 %        },
 %    \end{macrocode}
+% \end{variable}
 %    \begin{macrocode}
 %</package>
 %    \end{macrocode}





More information about the latex3-commits mailing list.