diff options
author | Karl Berry <karl@freefriends.org> | 2016-07-13 22:32:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-07-13 22:32:41 +0000 |
commit | 9ba411b76cebc96643f89f5f0e6d6298c0b4fda8 (patch) | |
tree | a49301f7afb45480525cc6e048c53908f3ccb4c4 /Master/texmf-dist/tex/latex/datetime2 | |
parent | 181a4a5a58861a070a09b75a414d129a9a005f5f (diff) |
datetime2 (13jul16)
git-svn-id: svn://tug.org/texlive/trunk@41686 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/datetime2')
-rw-r--r-- | Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datetime2/datetime2.sty | 191 |
2 files changed, 182 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty index 2973c635a22..a3cc47301d5 100644 --- a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty @@ -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@julianday diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty index dc0356f7fb5..8e0881bcda4 100644 --- a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty @@ -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@pdfcreationdate{\pdffeedback creationdate}% }% - {}% + {% + \ifdef\TeXOSQueryNow + {% + \TeXOSQueryNow{\dtm@pdfcreationdate}% + \ifdefempty\dtm@pdfcreationdate + {% + \undef\dtm@pdfcreationdate + }% + {}% + }% + {}% + }% } \newcommand*{\dtm@yearmonthsep}{-} \newcommand*{\dtm@monthdaysep}{-} @@ -232,6 +243,19 @@ \cslet{@dtm@#1@TZhour}{0}% \cslet{@dtm@#1@TZminute}{0}% } +\newcommand*{\DTMsavefrompdfdata}[2]{% + \edef\@dtm@tmp{#2}% + \expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% +} \ifdef\dtm@pdfcreationdate {% \def\@dtm@parsepdfdatetime#1:#2#3#4#5#6#7#8#9{% @@ -364,7 +388,42 @@ \def\@@dtm@parseluatimezone#1\@dtm@endparseluatimezone{% } } - {} + {% + \ifdef\TeXOSQueryFileDate + { + \renewcommand*{\DTMsavefilemoddate}[2]{% + \TeXOSQueryFileDate{\@dtm@tmp}{#2}% + \ifdefempty\@dtm@tmp + {% + \@dtm@warning{Your TeX engine doesn't support accessing + file modification dates and the attempt to use texosquery + failed}% + \cslet{@dtm@#1@year}{0}% + \cslet{@dtm@#1@month}{0}% + \cslet{@dtm@#1@day}{0}% + \cslet{@dtm@#1@dow}{-1}% + \cslet{@dtm@#1@hour}{0}% + \cslet{@dtm@#1@minute}{0}% + \cslet{@dtm@#1@second}{0}% + \cslet{@dtm@#1@TZhour}{0}% + \cslet{@dtm@#1@TZminute}{0}% + }% + {% + \expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% + }% + }% + } + {} + } }% }% {% @@ -670,8 +729,20 @@ \defzonemap{-12}{00}{Y}% Yankee time zone \defzonemap{00}{00}{Z}% Zulu time zone } +\newcommand*{\DTMifhasstyle}[3]{% + \ifcsdef{@dtm@style@#1}{#2}{#3}% +} +\newcommand*{\DTMifhasdatestyle}[3]{% + \ifcsdef{@dtm@datestyle@#1}{#2}{#3}% +} +\newcommand*{\DTMifhastimestyle}[3]{% + \ifcsdef{@dtm@timestyle@#1}{#2}{#3}% +} +\newcommand*{\DTMifhaszonestyle}[3]{% + \ifcsdef{@dtm@zonestyle@#1}{#2}{#3}% +} \newcommand*{\DTMnewstyle}[5]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {% \PackageError{datetime2}{Style `#1' already exists}{}% }% @@ -688,10 +759,7 @@ }% } \newcommand*{\DTMrenewstyle}[5]{% - \ifcsundef{@dtm@style@#1}% - {% - \PackageError{datetime2}{Style `#1' doesn't exist}{}% - }% + \DTMifhasstyle{#1}% {% \DTMrenewdatestyle{#1}{#2}% \DTMrenewtimestyle{#1}{#3}% @@ -703,9 +771,12 @@ #5% }% }% + {% + \PackageError{datetime2}{Style `#1' doesn't exist}{}% + }% } \newcommand*{\DTMprovidestyle}[5]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {% }% {% @@ -741,8 +812,108 @@ \PackageError{datetime2}{Zone style `#1' not defined}{}% }% } +\newcommand*{\DTMtryregional}{% + \@ifstar\s@dtm@tryregional\@dtm@tryregional +} +\newcommand*{\@dtm@tryregional}[3][]{% + \edef\@dtm@langcode{#2}% + \edef\@dtm@countrycode{#3}% + \s@dtm@tryregional[#1]{\@dtm@langcode}{\@dtm@countrycode}% +} +\newcommand*{\s@dtm@tryregional}[3][]{% + \def\@dtm@thisstyle{}% + \edef\@dtm@root{#1}% + \ifdefempty{#2}{}% + {% + \let\@dtm@thisstyle#2% + \ifdefempty\@dtm@root + {% + \edef\@dtm@root{\TrackedLanguageFromIsoCode{639-1}{#2}}% + \ifdefempty\@dtm@root + {% + \edef\@dtm@root{\TrackedLanguageFromIsoCode{639-2}{#2}}% + }% + {}% + }% + {}% + }% + \ifdefempty{#3}{}% + {% + \ifdefempty\@dtm@thisstyle + {\let\@dtm@thisstyle#3}% + {\eappto\@dtm@thisstyle{-#3}}% + }% + \ifdefempty\@dtm@thisstyle + {}% + {% + \DTMifcaseregional + {}% + {% + \DTMifhasstyle{\@dtm@thisstyle}% + {% + \csuse{@dtm@style@\@dtm@thisstyle}% + }% + {% + \ifdefempty\@dtm@root + {}% + {% + \DTMifhasstyle{\@dtm@root}% + {% + \csuse{@dtm@style@\@dtm@root}% + }% + {}% + }% + }% + }% + {% + \DTMifhasstyle{\@dtm@thisstyle-numeric}% + {% + \csuse{@dtm@style@\@dtm@thisstyle-numeric}% + }% + {% + \ifdefempty\@dtm@root + {}% + {% + \DTMifhasstyle{\@dtm@root-numeric}% + {% + \csuse{@dtm@style@\@dtm@root-numeric}% + }% + {}% + }% + }% + }% + }% +} +\newcommand*{\DTMsetregional}[1][text]{% + \DTMsetup{useregional=#1}% + \ifstrequal{#1}{false}% + {% + \DTMsetstyle{default}% + }% + {% + \ifcsdef{date\languagename} + {% + \csuse{date\languagename} + }% + {% + \ForEachTrackedDialect{\@dtm@thisdialect}% + {% + \edef\@dtm@lang{\TrackedLanguageFromDialect\@dtm@thisdialect}% + \edef\@dtm@langcode{\TrackedIsoCodeFromLanguage{639-1}{\@dtm@lang}}% + \ifdefempty\@dtm@langcode + {% + \edef\@dtm@langcode{\TrackedIsoCodeFromLanguage{639-2}{\@dtm@lang}}% + }% + {}% + \edef\@dtm@countrycode{% + \TrackedIsoCodeFromLanguage{3166-1}{\@dtm@thisdialect}}% + \s@dtm@tryregional[\@dtm@lang]{\@dtm@langcode}{\@dtm@countrycode}% + }% + }% + }% +} \newrobustcmd*{\DTMsetstyle}[1]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {\csuse{@dtm@style@#1}}% {% \let\dtm@unknownstyle\@dtm@unknownstyle |