summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/datetime2/datetime2.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-01-22 23:15:21 +0000
committerKarl Berry <karl@freefriends.org>2016-01-22 23:15:21 +0000
commitd69f376bd51012df2b1c2a4fbc1d4bc56edc1afd (patch)
tree0cb2663fb3026bc185edd79c2f448d0f9722ac09 /Master/texmf-dist/tex/latex/datetime2/datetime2.sty
parent2e0e8ce795be4ae9f01df5fc0d5242f14c1a4969 (diff)
datetime2 (22jan16)
git-svn-id: svn://tug.org/texlive/trunk@39458 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/datetime2/datetime2.sty')
-rw-r--r--Master/texmf-dist/tex/latex/datetime2/datetime2.sty166
1 files changed, 160 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty
index 8f99dc1e594..4f11b935716 100644
--- a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty
+++ b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty
@@ -7,7 +7,7 @@
%% datetime2.dtx (with options: `datetime2.sty,package')
%%
%% datetime2.dtx
-%% Copyright 2015 Nicola Talbot
+%% Copyright 2016 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2}[2015/11/10 v1.2 (NLCT) date and time formats]
+\ProvidesPackage{datetime2}[2016/01/22 v1.3 (NLCT) date and time formats]
\RequirePackage{tracklang}
\RequirePackage{etoolbox}
\RequirePackage{xkeyval}[2006/11/18]
@@ -152,8 +152,19 @@
}%
}
\DeclareOptionX*{%
- \TrackPredefinedDialect{\CurrentOption}%
- \renewcommand*{\DTMifcaseregional}[3]{#2}%
+ \ifcsundef{@tracklang@add@\CurrentOption}%
+ {%
+ \PackageError{datetime2}{`\CurrentOption' is not a recognised dialect.
+ \MessageBreak Perhaps you have misspelt it or the
+ \MessageBreak named dialect may be unsupported or
+ \MessageBreak perhaps you forgot to use the `style' key}%
+ {Any options that aren't described in the manual are assumed
+ \MessageBreak to be language or dialect names.}%
+ }%
+ {%
+ \TrackPredefinedDialect{\CurrentOption}%
+ \renewcommand*{\DTMifcaseregional}[3]{#2}%
+ }%
}
\ProcessOptionsX
\disable@keys{datetime2.sty}{calc}
@@ -1085,6 +1096,57 @@
\renewcommand*{\DTMDisplay}{\DTMdisplay}%
}
\DTMnewstyle
+ {ddmmyy}%label
+ {% date style
+ \renewcommand*\DTMdisplaydate[4]{%
+ \DTMtwodigits{##3}\DTMsep{monthday}%
+ \DTMtwodigits{##2}\DTMsep{yearmonth}%
+ \DTMtwodigits{##1}%
+ }%
+ \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
+ }%
+ {% time style
+ \renewcommand*\DTMdisplaytime[3]{%
+ \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}%
+ \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi
+ }%
+ }%
+ {% zone style
+ \renewcommand*{\DTMdisplayzone}[2]{%
+ \ifboolexpe
+ { bool{DTMshowisoZ}
+ and test{\ifnumequal{##1}{0}}
+ and test{\ifnumequal{##2}{0}}
+ }%
+ {%
+ Z%
+ }%
+ {%
+ \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
+ \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi
+ }%
+ }%
+ }%
+ {% full style
+ \renewcommand*{\DTMdisplay}[9]{%
+ \ifDTMshowdate
+ \DTMdisplaydate{##1}{##2}{##3}{##4}%
+ \DTMsep{datetime}%
+ \fi
+ \DTMdisplaytime
+ {##5}%
+ {##6}%
+ {##7}%
+ \ifDTMshowzone
+ \DTMsep{timezone}%
+ \DTMdisplayzone
+ {##8}%
+ {##9}%
+ \fi
+ }%
+ \renewcommand*{\DTMDisplay}{\DTMdisplay}%
+ }
+\DTMnewstyle
{mmddyyyy}%label
{% date style
\renewcommand*\DTMdisplaydate[4]{%
@@ -1241,6 +1303,57 @@
}%
\renewcommand*{\DTMDisplay}{\DTMdisplay}%
}
+\DTMnewstyle
+ {mmddyy}%label
+ {% date style
+ \renewcommand*\DTMdisplaydate[4]{%
+ \DTMtwodigits{##2}\DTMsep{monthday}%
+ \DTMtwodigits{##3}\DTMsep{dayyear}%
+ \DTMtwodigits{##1}%
+ }%
+ \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
+ }%
+ {% time style
+ \renewcommand*\DTMdisplaytime[3]{%
+ \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}%
+ \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi
+ }%
+ }%
+ {% zone style
+ \renewcommand*{\DTMdisplayzone}[2]{%
+ \ifboolexpe
+ { bool{DTMshowisoZ}
+ and test{\ifnumequal{##1}{0}}
+ and test{\ifnumequal{##2}{0}}
+ }%
+ {%
+ Z%
+ }%
+ {%
+ \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
+ \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi
+ }%
+ }%
+ }%
+ {% full style
+ \renewcommand*{\DTMdisplay}[9]{%
+ \ifDTMshowdate
+ \DTMdisplaydate{##1}{##2}{##3}{##4}%
+ \DTMsep{datetime}%
+ \fi
+ \DTMdisplaytime
+ {##5}%
+ {##6}%
+ {##7}%
+ \ifDTMshowzone
+ \DTMsep{timezone}%
+ \DTMdisplayzone
+ {##8}%
+ {##9}%
+ \fi
+ }%
+ \renewcommand*{\DTMDisplay}{\DTMdisplay}%
+ }
\DTMnewtimestyle
{hmmss}% label
{%
@@ -1474,19 +1587,55 @@
{%
\edef\@dtm@loadedregions{\@dtm@loadedregions,#1}%
}%
+ \csedef{@dtm@moddialectmap@#1}{\CurrentTrackedDialect}%
}%
- {}%
+ {%
+ \ifcsdef{date\CurrentTrackedDialect}
+ {%
+ \letcs{\@dtm@otherdialect}{@dtm@moddialectmap@#1}%
+ \edef\@dtm@thisdialect{\CurrentTrackedDialect}%
+ \ifdefequal\@dtm@thisdialect\@dtm@otherdialect
+ {}%
+ {%
+ \ifcsdef{date\@dtm@otherdialect}%
+ {%
+ \csletcs{date\@dtm@thisdialect}{date\@dtm@otherdialect}%
+ }%
+ {}%
+ }%
+ }%
+ {}%
+ }%
+ \csedef{@dtm@dialectmodmap@\CurrentTrackedDialect}{#1}%
}%
}
+\newcommand*{\DTMdialecttomodulemap}[1]{%
+ \ifcsdef{ver@datetime2-#1.ldf}%
+ {#1}%
+ {\csname @dtm@dialectmodmap@#1\endcsname}%
+}
\newcommand*{\ProvidesDateTimeModule}[1]{%
\ProvidesFile{datetime2-#1.ldf}%
}
+\newcommand*{\DTMusemodule}[2]{%
+ \ifcsdef{@tracklang@add@#1}%
+ {%
+ \TrackPredefinedDialect{#1}%
+ }%
+ {}%
+ \let\@dtm@org@dialect\CurrentTrackedDialect
+ \def\CurrentTrackedDialect{#1}%
+ \RequireDateTimeModule{#2}%
+ \let\CurrentTrackedDialect\@dtm@org@dialect
+}
\newcommand*{\DTMdefkey}[1]{\define@key[dtm]{#1}}
\newcommand*{\DTMdefchoicekey}[1]{\define@choicekey[dtm]{#1}}
\newcommand*{\DTMdefboolkey}[1]{\define@boolkey[dtm]{#1}}
\newcommand*{\DTMifbool}[4]{\ifbool{dtm@#1@#2}{#3}{#4}}
\newcommand*{\DTMsetbool}[3]{\setbool{dtm@#1@#2}{#3}}
-\newcommand*{\DTMlangsetup}[2][\@dtm@loadedregions]{%
+\newcommand*{\DTMlangsetup}{%
+ \@ifstar\s@DTMlangsetup\@DTMlangsetup}
+\newcommand*{\@DTMlangsetup}[2][\@dtm@loadedregions]{%
\@for\@dtm@region:=#1\do{%
\setkeys*+[dtm]{\@dtm@region}{#2}%
\ifdefempty\XKV@rm{}%
@@ -1498,6 +1647,11 @@
}%
}%
}
+\newcommand*{\s@DTMlangsetup}[2][\@dtm@loadedregions]{%
+ \@for\@dtm@region:=#1\do{%
+ \setkeys*+[dtm]{\@dtm@region}{#2}%
+ }%
+}
\AnyTrackedLanguages
{%
\ForEachTrackedDialect{\this@dialect}%