texlive[41686] Master/texmf-dist: datetime2 (13jul16)

commits+karl at tug.org commits+karl at tug.org
Thu Jul 14 00:32:42 CEST 2016


Revision: 41686
          http://tug.org/svn/texlive?view=revision&revision=41686
Author:   karl
Date:     2016-07-14 00:32:41 +0200 (Thu, 14 Jul 2016)
Log Message:
-----------
datetime2 (13jul16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/datetime2/CHANGES
    trunk/Master/texmf-dist/doc/latex/datetime2/README
    trunk/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf
    trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-babel.pdf
    trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-calc.pdf
    trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-filedate.pdf
    trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-hyperref.pdf
    trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.pdf
    trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-styles.pdf
    trunk/Master/texmf-dist/source/latex/datetime2/datetime2.dtx
    trunk/Master/texmf-dist/source/latex/datetime2/datetime2.ins
    trunk/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty
    trunk/Master/texmf-dist/tex/latex/datetime2/datetime2.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf
    trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/CHANGES
===================================================================
--- trunk/Master/texmf-dist/doc/latex/datetime2/CHANGES	2016-07-13 22:32:19 UTC (rev 41685)
+++ trunk/Master/texmf-dist/doc/latex/datetime2/CHANGES	2016-07-13 22:32:41 UTC (rev 41686)
@@ -1,3 +1,12 @@
+1.5.2 (2016-07-12):
+
+  * Added \DTMifhasstyle, \DTMifhasdatestyle, \DTMifhastimestyle,
+    \DTMifhaszonestyle, \DTMsetregional, \DTMtryregional
+    and \DTMsavefrompdfdata
+
+  * Added check for texosquery (allows seconds and time zone
+    to be supported with xelatex but requires shell escape)
+
 1.5.1 (2016-06-05) :
 
   * Added check for \pdffeedback

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/datetime2/README	2016-07-13 22:32:19 UTC (rev 41685)
+++ trunk/Master/texmf-dist/doc/latex/datetime2/README	2016-07-13 22:32:41 UTC (rev 41686)
@@ -1,6 +1,6 @@
-LaTeX Package : datetime2 v1.5.1 
+LaTeX Package : datetime2 v1.5.2 
 
-Last Modified : 2016-06-05
+Last Modified : 2016-07-12
 
 Author        : Nicola Talbot
 

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-babel.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-calc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-filedate.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-hyperref.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-styles.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf	2016-07-13 22:32:19 UTC (rev 41685)
+++ trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf	2016-07-13 22:32:41 UTC (rev 41686)

Property changes on: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex	2016-07-13 22:32:41 UTC (rev 41686)
@@ -0,0 +1,20 @@
+% arara: xelatex: {shell: on}
+\documentclass{article}
+
+\usepackage{texosquery}
+% Disable texosquery:
+%\TeXOSQueryDryRuntrue 
+\usepackage{datetime2}
+
+% If you get an error that looks like:
+% ! I can't find file `"|texosquery -n"'.
+% Then the shell escape has been restricted and texosquery
+% wasn't allowed to run.
+
+\begin{document}
+\DTMnow.
+
+\DTMsavefilemoddate{moddate}{\jobname.tex}
+File \texttt{\jobname.tex} last modified: \DTMuse{moddate}.
+
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/source/latex/datetime2/datetime2.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/datetime2/datetime2.dtx	2016-07-13 22:32:19 UTC (rev 41685)
+++ trunk/Master/texmf-dist/source/latex/datetime2/datetime2.dtx	2016-07-13 22:32:41 UTC (rev 41686)
@@ -1,13 +1,13 @@
 %\iffalse
 % datetime2.dtx generated using makedtx version 1.1 (c) Nicola Talbot
 % Command line args:
-%   -doc "datetime2-manual.tex"
-%   -section "chapter"
 %   -author "Nicola Talbot"
 %   -src "datetime2.sty\Z=>datetime2.sty"
 %   -src "datetime2-calc.sty\Z=>datetime2-calc.sty"
+%   -section "chapter"
+%   -doc "datetime2-manual.tex"
 %   datetime2
-% Created on 2016/6/5 13:21
+% Created on 2016/7/12 13:25
 %\fi
 %\iffalse
 %<*package>
@@ -47,7 +47,7 @@
             pdfauthor={Nicola L.C. Talbot},
             pdftitle={datetime2: date and time formats}]{hyperref}
 
-\CheckSum{2374}
+\CheckSum{2558}
 \RecordChanges
 \DisableCrossrefs
 
@@ -91,11 +91,11 @@
 %
 %\MakeShortVerb{"}
 %
-%\title{datetime2 v1.5.1:
+%\title{datetime2 v1.5.2:
 %date and time formats}
 %\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}}
 %
-%\date{2016-06-05}
+%\date{2016-07-12}
 %\maketitle
 %
 %\begin{abstract}
@@ -183,7 +183,10 @@
 %\DTMsetstyle{default}\DTMuse{bst}
 %\end{display}
 %\emph{unless} you are using \XeLaTeX\ in which case the seconds and
-%time zone are omitted. (\XeLaTeX\ doesn't provide this information.)
+%time zone are omitted. (\XeLaTeX\ doesn't provide this information,
+%but as from v1.5.2, you can load \sty{texosquery} before
+%\sty{datetime2} and enable the shell escape to obtain this
+%information.)
 %Alternatively you can hide the seconds and zone
 %using the package options \pkgopt[false]{showseconds} and
 %\pkgopt[false]{showzone}. If you want UTC+0 to be displayed
@@ -353,8 +356,9 @@
 %
 %Remember that you need to switch on the regional style, if required:
 %\begin{verbatim}
-%\DTMsetup{useregional}
+%\DTMsetregional
 %\end{verbatim}
+%or through the \pkgopt{useregional} package option.
 %
 %\chapter{Displaying the Date and Time}
 %\label{sec:display}
@@ -634,7 +638,8 @@
 %\begin{important}
 %If the PDF\TeX\ primitive \ics{pdfcreationdate} is defined, the
 %current time information is obtained from that, which includes the
-%seconds and time zone. Lua\TeX\ also defines this command but
+%seconds and time zone. Lua\TeX\ also defines this command (now 
+%replaced with \cs{pdffeedback}\verb*| creationdate|) but
 %\XeTeX\ doesn't, and in that case the only way to determine the
 %current time is from \TeX's \ics{time} primitive which only contains
 %the number of minutes since midnight, which means that the seconds
@@ -641,6 +646,13 @@
 %and time zone are unavailable. Therefore if \XeTeX\ is used, the
 %\pkgopt{showseconds} and \pkgopt{showzone} options are automatically
 %switched off.
+%
+%New to v1.5.2: if \sty{texosquery} is loaded before
+%\styfmt{datetime2} and the shell escape is enabled, then
+%if \cs{pdfcreationdate} and \cs{pdffeedback} are undefined, 
+%the information will be obtained through \ics{TeXOSQueryNow}.
+%See the \sty{texosquery} documentation for further information
+%about this command.
 %\end{important}
 %
 %There is also a~non-expandable robust command to display the time:
@@ -771,6 +783,23 @@
 %or \texttt{-3:0}). This will override any date, time or zone data
 %previously saved with this \meta{name}.
 %
+%Alternatively, if the date and time is in PDF form, that is
+%\begin{display}
+%\texttt{D:}\meta{YYYY}\meta{MM}\meta{DD}\meta{hh}\meta{mm}\meta{ss}\meta{zone}
+%\end{display}
+%where \meta{zone} is either \texttt{Z} or
+%\meta{TZh}\texttt{'}\meta{TZm}\texttt{'} then you can use
+%\begin{definition}[\DescribeMacro\DTMsavefrompdfdata]
+%\cs{DTMsavefrompdfdata}\marg{name}\marg{PDF data}
+%\end{definition}
+%Note that the category code of the initial \texttt{D} is 
+%irrelevant (in fact, the initial \texttt{D} is actually
+%ignored) but the other characters should have their usual
+%category code (so take care if, say, \sty{babel} makes the colon
+%an active character). The \meta{PDF data} argument is automatically
+%expanded so may be a control sequence that contains the PDF data.
+%(Not the case with \cs{DTMsavetimestamp}.)
+%
 %The current date and time can be saved using:
 %\begin{definition}[\DescribeMacro\DTMsavenow]
 %\cs{DTMsavenow}\marg{name}
@@ -788,7 +817,11 @@
 %attempt to use \texttt{os.date} but it uses \texttt{\%z} for the
 %time zone, which may not work on some operating systems. If you use
 %\XeLaTeX\ this command will generate a warning and will assume a
-%date of 0000-00-00T00:00:00Z.
+%date of 0000-00-00T00:00:00Z unless (from v1.5.2) you have
+%loaded \sty{texosquery} before \styfmt{datetime2} and you have the
+%shell escape enabled, in which case \cs{DTMsavefilemoddate} will use
+%\cs{TeXOSQueryFileDate} to obtain the information. See the
+%\sty{texosquery} manual for further details about this command.
 %
 %The above commands are all localised to the current scope. If the
 %data is required after the end of the scope, you can make the
@@ -993,6 +1026,56 @@
 %The style changes are all local and so are affected by the current
 %scope.
 %
+%In addition to the predefined styles, there are also styles provided
+%by regional modules. These may or may not be set depending on
+%the setting of \pkgopt{useregional}. Those that are provided usually
+%follow the naming scheme \meta{lang-name} or \meta{lang
+%code}\texttt{-}\meta{county code}, where \meta{lang name} is the
+%root language name (for example, \texttt{english}), \meta{lang code}
+%is the ISO language code and \meta{country code} is the ISO country
+%code (for example, \texttt{en-GB}). If a numeric style is provided,
+%it's usually the name of the text style with \texttt{-numeric}
+%appended (for example, \texttt{en-GB-numeric}). If you're not sure
+%of the exact naming scheme you can use
+%\begin{definition}[\DescribeMacro\DTMtryregional]
+%\cs{DTMtryregional}\oarg{lang name}\marg{lang code}\marg{country
+%code}
+%\end{definition}
+%This takes into account the \pkgopt{useregional} option, so will do
+%nothing if \pkgopt[false]{useregional}. If the optional argument is
+%omitted, the root language name will be determined from the supplied ISO
+%language code if it's recognised.
+%
+%\begin{important}
+%If there's no match, no change will be made. There will be no
+%warnings or error messages.
+%\end{important}
+%
+%For example:
+%\begin{verbatim}
+%\DTMsetup{useregional=numeric}
+%\DTMtryregional{en}{GB}
+%\end{verbatim}
+%This will set the style \texttt{en-GB-numeric} (assuming the
+%\texttt{en-GB} module has been loaded).
+%
+%In this example:
+%\begin{verbatim}
+%\DTMsetup{useregional}
+%\DTMtryregional{nl}{BE}
+%\end{verbatim}
+%the style is set to \texttt{dutch} (assuming the \texttt{dutch}
+%module has been loaded), since there's no style called 
+%\texttt{nl-BE}.
+%
+%If the ISO codes are stored in control sequences which may or may
+%not be defined, you can use the starred version which expects
+%commands for the last two arguments:
+%\begin{definition}[\DescribeMacro\DTMtryregional*]
+%\cs{DTMtryregional*}\oarg{lang name}\marg{lang code cs}\marg{country
+%code cs}
+%\end{definition}
+%
 %\section{Predefined Styles}
 %\label{sec:predefinedstyles}
 %
@@ -1315,6 +1398,27 @@
 %three commands for the partial elements of the full style, so it a
 %partial style with this name already exists, it won't be changed.
 %
+%As from v1.5.2, you can determine if a style exists using:
+%
+%\begin{definition}[\DescribeMacro\DTMifhasstyle]
+%\cs{DTMifhasstyle}\marg{name}\marg{true}\marg{false}
+%\end{definition}
+%If the (full) style given by \meta{name} exists, this
+%does \meta{true} otherwise it does \meta{false}.
+%
+%Similarly for a partial date style
+%\begin{definition}[\DescribeMacro\DTMifhasdatestyle]
+%\cs{DTMifhasdatestyle}\marg{name}\marg{true}\marg{false}
+%\end{definition}
+%partial time style
+%\begin{definition}[\DescribeMacro\DTMifhastimestyle]
+%\cs{DTMifhastimestyle}\marg{name}\marg{true}\marg{false}
+%\end{definition}
+%and partial time zone style
+%\begin{definition}[\DescribeMacro\DTMifhaszonestyle]
+%\cs{DTMifhaszonestyle}\marg{name}\marg{true}\marg{false}
+%\end{definition}
+%
 %There are some helper commands provided that you might want to use
 %in the style definitions.
 %
@@ -1492,7 +1596,9 @@
 %\styfmt{datetime2} language modules. These modules are automatically
 %loaded, if required, by \styfmt{datetime2} but only if they are
 %already installed. Remember that if you use \XeLaTeX\ you won't have
-%the seconds or time zone available for the current date and time.
+%the seconds or time zone available for the current date and time
+%(unless you first load \sty{texosquery} and have the shell escape
+%enabled).
 %
 %\begin{important}
 %If the required language modules aren't installed or
@@ -1616,8 +1722,19 @@
 %\styfmt{datetime2}'s package options or using \ics{DTMsetup} however
 %it will only have an effect during the module loading (when the
 %value is changed via the package option) and when
-%\cs{date}\meta{language} is used.
+%\cs{date}\meta{language} is used. An alternative is to use
+%\cs{DTMsetregional} which will also do \cs{date}\meta{language} if
+%it is available
+%(where \meta{language} is the current value of \cs{languagename})
+%otherwise it will iterate through the list of known
+%dialects and try to set each one in turn.
 %
+%\begin{important}
+%This means that using \cs{DTMsetregional} may cause 
+%the style to change to a different region if you have multiple
+%regions defined.
+%\end{important}
+%
 %For example, in the document below, the date is displayed using the
 %\style{default} numeric format because \pkgopt{useregional} has been
 %changed \emph{after} \sty{babel} uses \cs{datebritish} to set the
@@ -2119,19 +2236,21 @@
 %\item[\pkgopt{showseconds}] Boolean key to determine whether or not
 %to show the seconds when the time is displayed. The \style{iso}
 %style honours this setting but the \style{pdf} style ignores it.
-%Default: \texttt{true} unless \XeTeX\ is used.
+%Default: \texttt{true} unless \XeTeX\ is used (and \sty{texosquery}
+%hasn't first been loaded with shell escape enabled).
 %
 %\item[\pkgopt{showdate}] Boolean key to determine whether or not to
 %show the date with commands that use \cs{DTMdisplay} or
 %\cs{DTMDisplay}. (Some styles may ignore this.) The \style{iso}
 %style honours this setting but the \style{pdf} style ignores it.
-%Default: \texttt{true} unless \XeTeX\ is used.
+%Default: \texttt{true}.
 %
 %\item[\pkgopt{showzone}] Boolean key to determine whether or not to
 %show the time zone with commands that use
 %\cs{DTMdisplay} or \cs{DTMDisplay}. (Some styles may ignore this.) The \style{iso} style honours this setting but the
 %\style{pdf} style ignores it.
-%Default: \texttt{true} unless \XeTeX\ is used.
+%Default: \texttt{true} unless \XeTeX\ is used (and \sty{texosquery}
+%hasn't first been loaded with shell escape enabled).
 %
 %\item[\pkgopt{showzoneminutes}] Boolean key to determine whether or
 %not to show the zone offset minutes. The \style{iso} style honours
@@ -2156,17 +2275,22 @@
 %an abbreviation for \texttt{numeric}. If no value is supplied
 %\texttt{text} is assumed.
 %
-%This key determines whether or not to \emph{use} the loaded regional 
+%\begin{important}
+%If you haven't loaded \sty{babel} or \sty{polyglossia}, this
+%key only has an effect when used as a package option. Consider
+%instead using \cs{DTMsetregional}.
+%\end{important}
+%
+%This key determines whether or not to \emph{use} the loaded regional
 %settings and, if the regional setting should be used, it determines
 %whether the text style (months as words) or numeric style should be
-%used. If you haven't loaded \sty{babel} or \sty{polyglossia}, this
-%key only has an effect when used as a package option. If you have
-%loaded one of those packages, the change comes into effect at module
-%load time and whenever \cs{date}\meta{language} is used (which
-%includes at the beginning of the \env{document} environment). If you want
-%to switch the style at any other time, you need to use
-%\cs{DTMsetstyle} but unless \pkgopt[false]{useregional} the next
-%instance of \cs{date}\meta{language} will change the style.
+%used.  If you have loaded one of those packages, the change comes
+%into effect at module load time and whenever
+%\cs{date}\meta{language} is used (which includes at the beginning of
+%the \env{document} environment). If you want to switch the style at
+%any other time, you need to use \cs{DTMsetstyle} but unless
+%\pkgopt[false]{useregional} the next instance of
+%\cs{date}\meta{language} will change the style.
 %
 %Note that setting this option to \texttt{false} doesn't prevent the modules 
 %from being loaded. It just prevents them from automatically setting the style
@@ -2177,6 +2301,20 @@
 %passed to the \styfmt{datetime2} package option list. However, using \pkgopt{style}
 %will set \pkgopt{useregional} to \texttt{false}.
 %
+%If you want to change this value after the language modules have
+%been loaded, instead of using \cs{DTMsetup}, you can use
+%\begin{definition}[\DescribeMacro\DTMsetregional]
+%\cs{DTMsetregional}\oarg{value}
+%\end{definition}
+%This will do \texttt{\cs{DTMsetup}\{userregional=\meta{value}\}}.
+%Then if \meta{value} is \texttt{false}, it will set the
+%\texttt{default} style otherwise it will use \cs{date}\meta{lang} if
+%it's defined (where \meta{lang} is given by \cs{languagename}). If
+%\cs{date}\meta{lang} isn't defined, it will iterate over the list of
+%dialects associated with the document and use \cs{DTMtryregional}
+%for each dialect. If \meta{value} is omitted, \texttt{text} is
+%assumed.
+%
 %Examples:
 %\begin{verbatim}
 %\documentclass[british]{article}
@@ -5548,7 +5686,7 @@
 %\changes{1.0}{2015-03-24}{Initial release}
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2}[2016/06/05 v1.5.1 (NLCT) date and time formats]
+\ProvidesPackage{datetime2}[2016/07/12 v1.5.2 (NLCT) date and time formats]
 %    \end{macrocode}
 % Use \sty{tracklang} to find out what languages have been loaded.
 %    \begin{macrocode}
@@ -5586,7 +5724,32 @@
   {%
      \edef\dtm at pdfcreationdate{\pdffeedback creationdate}%
   }%
-  {}%
+  {%
+%    \end{macrocode} 
+%Neither \cs{pdfcreationdate} nor \cs{pdffeedback} are defined.
+%(The \TeX\ format is most probably \XeLaTeX.) If \sty{texosquery}
+%has been loaded, then the current date and time can be fetched
+%using \ics{TeXOSQueryNow} provided the shell escape has been
+%enabled. (It might not be, so don't automatically load
+%\sty{texosquery}.) Since it might have been loaded using \cs{input}
+%rather than \cs{usepackage}, just test if \cs{TeXOSQueryNow} has
+%been defined.
+%\changes{1.5.2}{2016-07-12}{added check for \cs{TeXOSQueryNow}}
+%    \begin{macrocode}
+    \ifdef\TeXOSQueryNow
+    {%
+      \TeXOSQueryNow{\dtm at pdfcreationdate}%
+      \ifdefempty\dtm at pdfcreationdate
+      {%
+%   \end{macrocode}
+%Failed (maybe shell escape has been disabled).
+%   \begin{macrocode}
+        \undef\dtm at pdfcreationdate
+      }%
+      {}%
+    }%
+    {}%
+  }%
 }
 %    \end{macrocode} 
 %\end{macro}
@@ -6065,6 +6228,26 @@
 %    \end{macrocode}
 %\end{macro}
 %
+%\begin{macro}{\DTMsavefrompdfdata}
+%\changes{1.5.2}{2016-07-12}{new}
+%Save a date-time stamp that's specified in PDF format.
+%    \begin{macrocode}
+\newcommand*{\DTMsavefrompdfdata}[2]{%
+  \edef\@dtm at tmp{#2}%
+  \expandafter\@dtm at parsepdfdatetime\@dtm at tmp\@dtm at endparsepdfdatetime
+  \cslet{@dtm@#1 at year}{\@dtm at year}%
+  \cslet{@dtm@#1 at month}{\@dtm at month}%
+  \cslet{@dtm@#1 at day}{\@dtm at day}%
+  \cslet{@dtm@#1 at dow}{\@dtm at dow}%
+  \cslet{@dtm@#1 at hour}{\@dtm at hour}%
+  \cslet{@dtm@#1 at minute}{\@dtm at minute}%
+  \cslet{@dtm@#1 at second}{\@dtm at second}%
+  \cslet{@dtm@#1 at TZhour}{\@dtm at timezonehour}%
+  \cslet{@dtm@#1 at TZminute}{\@dtm at timezoneminute}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
 % Find out the current time. If \cs{dtm at pdfcreationdate} is defined,
 % it can be fetched from that.
 %    \begin{macrocode}
@@ -6131,12 +6314,12 @@
     }
   }%
   {%
+    \ifdef\directlua
+    {
 %    \end{macrocode}
 % Lua time zone information provided by \verb|%z| is OS dependent,
 % so this might not work.
 %    \begin{macrocode}
-    \ifdef\directlua
-    {
       \renewcommand*{\DTMsavefilemoddate}[2]{%
         \expandafter\@dtm at parseluadatetime
           \directlua{tex.print(os.date(
@@ -6217,7 +6400,50 @@
       \def\@@dtm at parseluatimezone#1\@dtm at endparseluatimezone{%
       }
     }
-    {}
+    {%
+%    \end{macrocode}
+%If \ics{directlua} isn't defined but \sty{texosquery} has been
+%loaded, we can use \cs{TeXOSQueryFileDate} if the shell escape is
+%enabled.
+%    \begin{macrocode}
+      \ifdef\TeXOSQueryFileDate
+      {
+        \renewcommand*{\DTMsavefilemoddate}[2]{%
+          \TeXOSQueryFileDate{\@dtm at tmp}{#2}%
+          \ifdefempty\@dtm at tmp
+          {%
+%    \end{macrocode}
+% OS query failed.
+%    \begin{macrocode}
+           \@dtm at warning{Your TeX engine doesn't support accessing
+           file modification dates and the attempt to use texosquery
+           failed}%
+           \cslet{@dtm@#1 at year}{0}%
+           \cslet{@dtm@#1 at month}{0}%
+           \cslet{@dtm@#1 at day}{0}%
+           \cslet{@dtm@#1 at dow}{-1}%
+           \cslet{@dtm@#1 at hour}{0}%
+           \cslet{@dtm@#1 at minute}{0}%
+           \cslet{@dtm@#1 at second}{0}%
+           \cslet{@dtm@#1 at TZhour}{0}%
+           \cslet{@dtm@#1 at TZminute}{0}%
+          }%
+          {%
+            \expandafter\@dtm at parsepdfdatetime\@dtm at tmp\@dtm at endparsepdfdatetime
+            \cslet{@dtm@#1 at year}{\@dtm at year}%
+            \cslet{@dtm@#1 at month}{\@dtm at month}%
+            \cslet{@dtm@#1 at day}{\@dtm at day}%
+            \cslet{@dtm@#1 at dow}{\@dtm at dow}%
+            \cslet{@dtm@#1 at hour}{\@dtm at hour}%
+            \cslet{@dtm@#1 at minute}{\@dtm at minute}%
+            \cslet{@dtm@#1 at second}{\@dtm at second}%
+            \cslet{@dtm@#1 at TZhour}{\@dtm at timezonehour}%
+            \cslet{@dtm@#1 at TZminute}{\@dtm at timezoneminute}%
+          }%
+        }%
+      }
+      {}
+    }
   }%
 }%
 {%
@@ -6862,6 +7088,58 @@
 %    \end{macrocode}
 %\end{macro}
 %
+%\begin{macro}{\DTMifhasstyle}
+%\begin{definition}
+%\cs{DTMifhasstyle}\marg{label}\marg{true}\marg{false}
+%\end{definition}
+%\changes{1.5.2}{2016-07-12}{new}
+%Test to determine if style exists.
+%    \begin{macrocode}
+\newcommand*{\DTMifhasstyle}[3]{%
+  \ifcsdef{@dtm at style@#1}{#2}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMifhasdatestyle}
+%\begin{definition}
+%\cs{DTMifhasdatestyle}\marg{label}\marg{true}\marg{false}
+%\end{definition}
+%\changes{1.5.2}{2016-07-12}{new}
+%Test to determine if partial date style exists.
+%    \begin{macrocode}
+\newcommand*{\DTMifhasdatestyle}[3]{%
+  \ifcsdef{@dtm at datestyle@#1}{#2}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMifhastimestyle}
+%\begin{definition}
+%\cs{DTMifhastimestyle}\marg{label}\marg{true}\marg{false}
+%\end{definition}
+%\changes{1.5.2}{2016-07-12}{new}
+%Test to determine if time style exists.
+%    \begin{macrocode}
+\newcommand*{\DTMifhastimestyle}[3]{%
+  \ifcsdef{@dtm at timestyle@#1}{#2}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMifhaszonestyle}
+%\begin{definition}
+%\cs{DTMifhaszonestyle}\marg{label}\marg{true}\marg{false}
+%\end{definition}
+%\changes{1.5.2}{2016-07-12}{new}
+%Test to determine if time zone style exists.
+%    \begin{macrocode}
+\newcommand*{\DTMifhaszonestyle}[3]{%
+  \ifcsdef{@dtm at zonestyle@#1}{#2}{#3}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
 %\begin{macro}{\DTMnewstyle}
 %\begin{definition}
 %\cs{DTMnewstyle}\marg{label}\marg{date style definition}\marg{time
@@ -6872,7 +7150,7 @@
 % and \cs{DTMDisplay}.
 %    \begin{macrocode}
 \newcommand*{\DTMnewstyle}[5]{%
-  \ifcsdef{@dtm at style@#1}%
+  \DTMifhasstyle{#1}%
   {%
     \PackageError{datetime2}{Style `#1' already exists}{}%
   }%
@@ -6902,11 +7180,8 @@
 %\changes{1.2}{2015-11-10}{new}
 %    \begin{macrocode}
 \newcommand*{\DTMrenewstyle}[5]{%
-  \ifcsundef{@dtm at style@#1}%
+  \DTMifhasstyle{#1}%
   {%
-    \PackageError{datetime2}{Style `#1' doesn't exist}{}%
-  }%
-  {%
     \DTMrenewdatestyle{#1}{#2}%
     \DTMrenewtimestyle{#1}{#3}%
     \DTMrenewzonestyle{#1}{#4}%
@@ -6917,6 +7192,9 @@
         #5%
      }%
   }%
+  {%
+    \PackageError{datetime2}{Style `#1' doesn't exist}{}%
+  }%
 }
 %    \end{macrocode}
 %\end{macro}
@@ -6931,7 +7209,7 @@
 %\changes{1.2}{2015-11-10}{new}
 %    \begin{macrocode}
 \newcommand*{\DTMprovidestyle}[5]{%
-  \ifcsdef{@dtm at style@#1}%
+  \DTMifhasstyle{#1}%
   {%
   }%
   {%
@@ -6985,10 +7263,146 @@
 %    \end{macrocode}
 %\end{macro}
 %
+%\begin{macro}{\DTMtryregional}
+%\begin{definition}
+%\cs{DTMtryregional}\oarg{lang}\marg{lang code cs}\marg{country code cs}
+%\end{definition}
+%Tries to see if the regional style can be set. Takes into account
+%the \pkgopt{useregional} setting. The starred version expects the arguments to be
+%control sequences. If both are blank or undefined nothing
+%happens. The optional argument may be the root language label,
+%which is used if no style exists for the ISO codes.
+%\changes{1.5.2}{2016-07-12}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMtryregional}{%
+  \@ifstar\s at dtm@tryregional\@dtm at tryregional
+}
+%    \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@dtm at tryregional}
+%    \begin{macrocode}
+\newcommand*{\@dtm at tryregional}[3][]{%
+  \edef\@dtm at langcode{#2}%
+  \edef\@dtm at countrycode{#3}%
+  \s at dtm@tryregional[#1]{\@dtm at langcode}{\@dtm at countrycode}%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\s at dtm@tryregional}
+%    \begin{macrocode}
+\newcommand*{\s at dtm@tryregional}[3][]{%
+ \def\@dtm at thisstyle{}%
+ \edef\@dtm at root{#1}%
+ \ifdefempty{#2}{}%
+ {%
+   \let\@dtm at thisstyle#2%
+%    \end{macrocode}
+% Determine the root language name if not already provided in the
+% optional argument.
+%    \begin{macrocode}
+   \ifdefempty\@dtm at root
+   {%
+     \edef\@dtm at root{\TrackedLanguageFromIsoCode{639-1}{#2}}%
+     \ifdefempty\@dtm at root
+     {%
+       \edef\@dtm at root{\TrackedLanguageFromIsoCode{639-2}{#2}}%
+     }%
+     {}%
+   }%
+   {}%
+ }%
+ \ifdefempty{#3}{}%
+ {%
+   \ifdefempty\@dtm at thisstyle
+   {\let\@dtm at thisstyle#3}%
+   {\eappto\@dtm at thisstyle{-#3}}%
+ }%
+ \ifdefempty\@dtm at thisstyle
+ {}%
+ {%
+   \DTMifcaseregional
+   {}%
+   {%
+     \DTMifhasstyle{\@dtm at thisstyle}%
+     {%
+       \csuse{@dtm at style@\@dtm at thisstyle}%
+     }%
+     {%
+       \ifdefempty\@dtm at root
+       {}%
+       {%
+         \DTMifhasstyle{\@dtm at root}%
+         {%
+           \csuse{@dtm at style@\@dtm at root}%
+         }%
+         {}%
+       }%
+     }%
+   }%
+   {%
+     \DTMifhasstyle{\@dtm at thisstyle-numeric}%
+     {%
+       \csuse{@dtm at style@\@dtm at thisstyle-numeric}%
+     }%
+     {%
+       \ifdefempty\@dtm at root
+       {}%
+       {%
+         \DTMifhasstyle{\@dtm at root-numeric}%
+         {%
+           \csuse{@dtm at style@\@dtm at root-numeric}%
+         }%
+         {}%
+       }%
+     }%
+   }%
+ }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMsetregional}
+%\changes{1.5.2}{2016-07-12}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMsetregional}[1][text]{%
+  \DTMsetup{useregional=#1}%
+  \ifstrequal{#1}{false}%
+  {%
+    \DTMsetstyle{default}%
+  }%
+  {%
+    \ifcsdef{date\languagename}
+    {%
+      \csuse{date\languagename}
+    }%
+    {%
+%    \end{macrocode}
+% Iterate through dialect list.
+%    \begin{macrocode}
+      \ForEachTrackedDialect{\@dtm at thisdialect}%
+      {%
+        \edef\@dtm at lang{\TrackedLanguageFromDialect\@dtm at thisdialect}%
+        \edef\@dtm at langcode{\TrackedIsoCodeFromLanguage{639-1}{\@dtm at lang}}%
+        \ifdefempty\@dtm at langcode
+        {%
+          \edef\@dtm at langcode{\TrackedIsoCodeFromLanguage{639-2}{\@dtm at lang}}%
+        }%
+        {}%
+        \edef\@dtm at countrycode{%
+          \TrackedIsoCodeFromLanguage{3166-1}{\@dtm at thisdialect}}%
+        \s at dtm@tryregional[\@dtm at lang]{\@dtm at langcode}{\@dtm at countrycode}%
+      }%
+    }%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
 %\begin{macro}{\DTMsetstyle}
 %    \begin{macrocode}
 \newrobustcmd*{\DTMsetstyle}[1]{%
-  \ifcsdef{@dtm at style@#1}%
+  \DTMifhasstyle{#1}%
   {\csuse{@dtm at style@#1}}%
   {%
      \let\dtm at unknownstyle\@dtm at unknownstyle
@@ -8332,7 +8746,7 @@
 %\section{datetime2-calc.sty code}
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2-calc}[2016/06/05 v1.5.1 (NLCT)]
+\ProvidesPackage{datetime2-calc}[2016/07/12 v1.5.2 (NLCT)]
 %    \end{macrocode}
 % Load other required packages
 %    \begin{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/datetime2/datetime2.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/datetime2/datetime2.ins	2016-07-13 22:32:19 UTC (rev 41685)
+++ trunk/Master/texmf-dist/source/latex/datetime2/datetime2.ins	2016-07-13 22:32:41 UTC (rev 41686)
@@ -1,4 +1,4 @@
-% datetime2.ins generated using makedtx version 1.1 2016/6/5 13:21
+% datetime2.ins generated using makedtx version 1.1 2016/7/12 13:25
 \input docstrip
 
 \preamble

Modified: trunk/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty	2016-07-13 22:32:19 UTC (rev 41685)
+++ trunk/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty	2016-07-13 22:32:41 UTC (rev 41686)
@@ -39,7 +39,7 @@
 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2-calc}[2016/06/05 v1.5.1 (NLCT)]
+\ProvidesPackage{datetime2-calc}[2016/07/12 v1.5.2 (NLCT)]
 \RequirePackage{pgfkeys}
 \RequirePackage{pgfcalendar}
 \newcount\@dtm at julianday

Modified: trunk/Master/texmf-dist/tex/latex/datetime2/datetime2.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/datetime2/datetime2.sty	2016-07-13 22:32:19 UTC (rev 41685)
+++ trunk/Master/texmf-dist/tex/latex/datetime2/datetime2.sty	2016-07-13 22:32:41 UTC (rev 41686)
@@ -39,7 +39,7 @@
 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2}[2016/06/05 v1.5.1 (NLCT) date and time formats]
+\ProvidesPackage{datetime2}[2016/07/12 v1.5.2 (NLCT) date and time formats]
 \RequirePackage{tracklang}
 \RequirePackage{etoolbox}
 \RequirePackage{xkeyval}[2006/11/18]
@@ -52,7 +52,18 @@
   {%
      \edef\dtm at pdfcreationdate{\pdffeedback creationdate}%
   }%
-  {}%
+  {%
+    \ifdef\TeXOSQueryNow
+    {%
+      \TeXOSQueryNow{\dtm at pdfcreationdate}%
+      \ifdefempty\dtm at pdfcreationdate
+      {%
+        \undef\dtm at pdfcreationdate
+      }%
+      {}%
+    }%
+    {}%
+  }%
 }
 \newcommand*{\dtm at yearmonthsep}{-}
 \newcommand*{\dtm at monthdaysep}{-}
@@ -232,6 +243,19 @@
   \cslet{@dtm@#1 at TZhour}{0}%
   \cslet{@dtm@#1 at TZminute}{0}%
 }
+\newcommand*{\DTMsavefrompdfdata}[2]{%
+  \edef\@dtm at tmp{#2}%
+  \expandafter\@dtm at parsepdfdatetime\@dtm at tmp\@dtm at endparsepdfdatetime
+  \cslet{@dtm@#1 at year}{\@dtm at year}%
+  \cslet{@dtm@#1 at month}{\@dtm at month}%
+  \cslet{@dtm@#1 at day}{\@dtm at day}%
+  \cslet{@dtm@#1 at dow}{\@dtm at dow}%
+  \cslet{@dtm@#1 at hour}{\@dtm at hour}%
+  \cslet{@dtm@#1 at minute}{\@dtm at minute}%
+  \cslet{@dtm@#1 at second}{\@dtm at second}%
+  \cslet{@dtm@#1 at TZhour}{\@dtm at timezonehour}%
+  \cslet{@dtm@#1 at TZminute}{\@dtm at timezoneminute}%
+}
 \ifdef\dtm at pdfcreationdate
 {%
   \def\@dtm at parsepdfdatetime#1:#2#3#4#5#6#7#8#9{%
@@ -364,7 +388,42 @@
       \def\@@dtm at parseluatimezone#1\@dtm at endparseluatimezone{%
       }
     }
-    {}
+    {%
+      \ifdef\TeXOSQueryFileDate
+      {
+        \renewcommand*{\DTMsavefilemoddate}[2]{%
+          \TeXOSQueryFileDate{\@dtm at tmp}{#2}%
+          \ifdefempty\@dtm at tmp
+          {%
+           \@dtm at warning{Your TeX engine doesn't support accessing
+           file modification dates and the attempt to use texosquery
+           failed}%
+           \cslet{@dtm@#1 at year}{0}%
+           \cslet{@dtm@#1 at month}{0}%
+           \cslet{@dtm@#1 at day}{0}%
+           \cslet{@dtm@#1 at dow}{-1}%
+           \cslet{@dtm@#1 at hour}{0}%
+           \cslet{@dtm@#1 at minute}{0}%
+           \cslet{@dtm@#1 at second}{0}%
+           \cslet{@dtm@#1 at TZhour}{0}%
+           \cslet{@dtm@#1 at TZminute}{0}%
+          }%
+          {%
+            \expandafter\@dtm at parsepdfdatetime\@dtm at tmp\@dtm at endparsepdfdatetime
+            \cslet{@dtm@#1 at year}{\@dtm at year}%
+            \cslet{@dtm@#1 at month}{\@dtm at month}%
+            \cslet{@dtm@#1 at day}{\@dtm at day}%
+            \cslet{@dtm@#1 at dow}{\@dtm at dow}%
+            \cslet{@dtm@#1 at hour}{\@dtm at hour}%
+            \cslet{@dtm@#1 at minute}{\@dtm at minute}%
+            \cslet{@dtm@#1 at second}{\@dtm at second}%
+            \cslet{@dtm@#1 at TZhour}{\@dtm at timezonehour}%
+            \cslet{@dtm@#1 at TZminute}{\@dtm at timezoneminute}%
+          }%
+        }%
+      }
+      {}
+    }
   }%
 }%
 {%
@@ -670,8 +729,20 @@
   \defzonemap{-12}{00}{Y}% Yankee time zone
   \defzonemap{00}{00}{Z}% Zulu time zone
 }
+\newcommand*{\DTMifhasstyle}[3]{%
+  \ifcsdef{@dtm at style@#1}{#2}{#3}%
+}
+\newcommand*{\DTMifhasdatestyle}[3]{%
+  \ifcsdef{@dtm at datestyle@#1}{#2}{#3}%
+}
+\newcommand*{\DTMifhastimestyle}[3]{%
+  \ifcsdef{@dtm at timestyle@#1}{#2}{#3}%
+}
+\newcommand*{\DTMifhaszonestyle}[3]{%
+  \ifcsdef{@dtm at zonestyle@#1}{#2}{#3}%
+}
 \newcommand*{\DTMnewstyle}[5]{%
-  \ifcsdef{@dtm at style@#1}%
+  \DTMifhasstyle{#1}%
   {%
     \PackageError{datetime2}{Style `#1' already exists}{}%
   }%
@@ -688,11 +759,8 @@
   }%
 }
 \newcommand*{\DTMrenewstyle}[5]{%
-  \ifcsundef{@dtm at style@#1}%
+  \DTMifhasstyle{#1}%
   {%
-    \PackageError{datetime2}{Style `#1' doesn't exist}{}%
-  }%
-  {%
     \DTMrenewdatestyle{#1}{#2}%
     \DTMrenewtimestyle{#1}{#3}%
     \DTMrenewzonestyle{#1}{#4}%
@@ -703,9 +771,12 @@
         #5%
      }%
   }%
+  {%
+    \PackageError{datetime2}{Style `#1' doesn't exist}{}%
+  }%
 }
 \newcommand*{\DTMprovidestyle}[5]{%
-  \ifcsdef{@dtm at style@#1}%
+  \DTMifhasstyle{#1}%
   {%
   }%
   {%
@@ -741,8 +812,108 @@
     \PackageError{datetime2}{Zone style `#1' not defined}{}%
   }%
 }
+\newcommand*{\DTMtryregional}{%
+  \@ifstar\s at dtm@tryregional\@dtm at tryregional
+}
+\newcommand*{\@dtm at tryregional}[3][]{%
+  \edef\@dtm at langcode{#2}%
+  \edef\@dtm at countrycode{#3}%
+  \s at dtm@tryregional[#1]{\@dtm at langcode}{\@dtm at countrycode}%
+}
+\newcommand*{\s at dtm@tryregional}[3][]{%
+ \def\@dtm at thisstyle{}%
+ \edef\@dtm at root{#1}%
+ \ifdefempty{#2}{}%
+ {%
+   \let\@dtm at thisstyle#2%
+   \ifdefempty\@dtm at root
+   {%
+     \edef\@dtm at root{\TrackedLanguageFromIsoCode{639-1}{#2}}%
+     \ifdefempty\@dtm at root
+     {%
+       \edef\@dtm at root{\TrackedLanguageFromIsoCode{639-2}{#2}}%
+     }%
+     {}%
+   }%
+   {}%
+ }%
+ \ifdefempty{#3}{}%
+ {%
+   \ifdefempty\@dtm at thisstyle
+   {\let\@dtm at thisstyle#3}%
+   {\eappto\@dtm at thisstyle{-#3}}%
+ }%
+ \ifdefempty\@dtm at thisstyle
+ {}%
+ {%
+   \DTMifcaseregional
+   {}%
+   {%
+     \DTMifhasstyle{\@dtm at thisstyle}%
+     {%
+       \csuse{@dtm at style@\@dtm at thisstyle}%
+     }%
+     {%
+       \ifdefempty\@dtm at root
+       {}%
+       {%
+         \DTMifhasstyle{\@dtm at root}%
+         {%
+           \csuse{@dtm at style@\@dtm at root}%
+         }%
+         {}%
+       }%
+     }%
+   }%
+   {%
+     \DTMifhasstyle{\@dtm at thisstyle-numeric}%
+     {%
+       \csuse{@dtm at style@\@dtm at thisstyle-numeric}%
+     }%
+     {%
+       \ifdefempty\@dtm at root
+       {}%
+       {%
+         \DTMifhasstyle{\@dtm at root-numeric}%
+         {%
+           \csuse{@dtm at style@\@dtm at root-numeric}%
+         }%
+         {}%
+       }%
+     }%
+   }%
+ }%
+}
+\newcommand*{\DTMsetregional}[1][text]{%
+  \DTMsetup{useregional=#1}%
+  \ifstrequal{#1}{false}%
+  {%
+    \DTMsetstyle{default}%
+  }%
+  {%
+    \ifcsdef{date\languagename}
+    {%
+      \csuse{date\languagename}
+    }%
+    {%
+      \ForEachTrackedDialect{\@dtm at thisdialect}%
+      {%
+        \edef\@dtm at lang{\TrackedLanguageFromDialect\@dtm at thisdialect}%
+        \edef\@dtm at langcode{\TrackedIsoCodeFromLanguage{639-1}{\@dtm at lang}}%
+        \ifdefempty\@dtm at langcode
+        {%
+          \edef\@dtm at langcode{\TrackedIsoCodeFromLanguage{639-2}{\@dtm at lang}}%
+        }%
+        {}%
+        \edef\@dtm at countrycode{%
+          \TrackedIsoCodeFromLanguage{3166-1}{\@dtm at thisdialect}}%
+        \s at dtm@tryregional[\@dtm at lang]{\@dtm at langcode}{\@dtm at countrycode}%
+      }%
+    }%
+  }%
+}
 \newrobustcmd*{\DTMsetstyle}[1]{%
-  \ifcsdef{@dtm at style@#1}%
+  \DTMifhasstyle{#1}%
   {\csuse{@dtm at style@#1}}%
   {%
      \let\dtm at unknownstyle\@dtm at unknownstyle



More information about the tex-live-commits mailing list