diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/tracklang/tracklang.dtx | 108 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/tracklang/tracklang.ins | 2 |
2 files changed, 97 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex/tracklang/tracklang.dtx b/Master/texmf-dist/source/latex/tracklang/tracklang.dtx index b3415f2e22d..e7e28decc4b 100644 --- a/Master/texmf-dist/source/latex/tracklang/tracklang.dtx +++ b/Master/texmf-dist/source/latex/tracklang/tracklang.dtx @@ -2,15 +2,15 @@ % tracklang.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: % -section "chapter" -% -doc "tracklang-manual.tex" % -author "Nicola Talbot" +% -doc "tracklang-manual.tex" % -src "tracklang.sty\Z=>tracklang.sty" % -src "tracklang.tex\Z=>tracklang.tex" % -src "tracklang-region-codes.tex\Z=>tracklang-region-codes.tex" % -src "tracklang-scripts.sty\Z=>tracklang-scripts.sty" % -src "tracklang-scripts.tex\Z=>tracklang-scripts.tex" % tracklang -% Created on 2019/10/6 15:08 +% Created on 2019/11/11 16:00 %\fi %\iffalse %<*package> @@ -59,7 +59,7 @@ pdfauthor={Nicola L.C. Talbot}, pdftitle={tracklang: tracking language options}]{hyperref} -\CheckSum{3965} +\CheckSum{3986} \appto\MacroFont{\scriptsize} \renewcommand*{\usage}[1]{\textit{\hyperpage{#1}}} @@ -278,11 +278,11 @@ and~\ref{tab:nonisoopts}} % %\MakeShortVerb{"} % -%\title{tracklang v1.3.8: +%\title{tracklang v1.3.9: %tracking language options} %\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}} % -%\date{2019-10-06} +%\date{2019-11-11} %\maketitle % %\begin{abstract} @@ -936,10 +936,44 @@ and~\ref{tab:nonisoopts}} %label. (Irregular grandfather tags aren't recognised.) %This command will fully expand \meta{tag}. %A warning is issued if the tag is empty. +% +%If you want to first check that \meta{tag} includes a valid language +%code, then you can instead use: +%\begin{definition}[\DescribeMacro\TrackIfKnownLanguage] +%\cs{TrackIfKnownLanguage}\marg{tag}\marg{success code}\marg{fail code} +%\end{definition} +%This will only track \meta{tag} (and then do \meta{success code}) if +%\meta{tag} starts with a valid language code (or is a predefined +%dialect) otherwise it will do \meta{fail code}. Both +%\cs{TrackLanguageTag} and \cs{TrackIfKnownLanguage} will check if +%\meta{tag} is a predefined option. (This saves parsing the tag if +%it's recognised.) +% %For example: %\begin{verbatim} %\TrackLanguageTag{hy-Latn-IT-arevela} +%Latn-ME: \TrackIfKnownLanguage{Latn-ME}{success}{fail}. +%brazilian: \TrackIfKnownLanguage{brazilian}{success}{fail}. +%\end{verbatim} +%This will track hy-Latn-IT-arevela and brazilian (pt-BR) but not +%Latn-ME (because it doesn't contain a valid language code) even +%though it's a valid script and country code. The above is just for +%illustrative purposes. Typically the language tracking isn't +%performed within the document text. +% +%The \sty{datetime2} package assumes that any unknown package option is a +%language identifier. It could simply do: +%\begin{verbatim} +%\TrackLanguageTag{\CurrentOption} +%\end{verbatim} +%but users can make mistakes sometimes and this won't provide any +%helpful information if they, for example, misspelt a package option +%or forgot the ``\meta{key}='' part of a \meta{key}=\meta{value} +%setting. Instead (as from v1.5.5) it does: +%\begin{verbatim} +%\TrackIfKnownLanguage{\CurrentOption}{...}{\PackageError{...}{...}{...}} %\end{verbatim} +%This will now give the user some guidance. % %If \meta{tag} contains a sub-language tag, this will be set %as the 639-3 code for the \emph{dialect} label. Note that this is @@ -957,8 +991,7 @@ and~\ref{tab:nonisoopts}} %ISO 639-3: \TrackedIsoCodeFromLanguage{639-3}{zhcmnHansCN}. %\end{verbatim} % -%Version 1.2 (currently pending) of -%\sty{texosquery} will have a new command \ics{TeXOSQueryLangTag}, +%Version 1.2 of \sty{texosquery} provides the command \ics{TeXOSQueryLangTag}, %which may be used to fetch the operating system's regional %information as a language tag. These commands can be used as %follows: @@ -3264,7 +3297,7 @@ and~\ref{tab:nonisoopts}} % packages such as \styfmt{etoolbox}. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang}[2019/10/06 v1.3.8 (NLCT) Track Languages] +\ProvidesPackage{tracklang}[2019/11/11 v1.3.9 (NLCT) Track Languages] % \end{macrocode} %\begin{macro}{\@tracklang@declareoption} % Set up package options. @@ -3560,7 +3593,7 @@ and~\ref{tab:nonisoopts}} % Version info. % \begin{macrocode} \expandafter\def\csname ver@tracklang.tex\endcsname{% - 2019/10/06 v1.3.8 (NLCT) Track Languages Generic Code} + 2019/11/11 v1.3.9 (NLCT) Track Languages Generic Code} % \end{macrocode} % Define a long command for determining the existence of a control % sequence by its name. (\cs{relax} is considered undefined.) @@ -5959,6 +5992,57 @@ and~\ref{tab:nonisoopts}} % \end{macrocode} %\end{macro} % +%\begin{macro}{\TrackIfKnownLanguage} +%\begin{definition} +%\cs{TrackIfKnownLanguage}\marg{tag}\meta{success code}\marg{fail code} +%\end{definition} +%Like \cs{TrackLanguageTag} but does \meta{fail code} if the tag +%doesn't contain a valid language code. If successful, does +%\meta{success code} after tracking the language. +%\changes{1.3.9}{2019-11-11}{new} +% \begin{macrocode} +\def\TrackIfKnownLanguage#1#2#3{% + \edef\@tracklang@tag{#1}% + \ifx\@tracklang@tag\empty + #3% + \else + \expandafter\@TrackIfKnownLanguage\expandafter{\@tracklang@tag}{#2}{#3}% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@TrackIfKnownLanguage} +%Argument must be expanded. +%\changes{1.3.9}{2019-11-11}{new} +% \begin{macrocode} +\def\@TrackIfKnownLanguage#1#2#3{% +% \end{macrocode} +%First check if it's predefined. +% \begin{macrocode} + \@tracklang@ifundef{@tracklang@add@#1}% + {% +% \end{macrocode} +%Parse language tag. +% \begin{macrocode} + \@tracklang@parselangtag{#1}% +% \end{macrocode} +%Track this information if \cs{@TrackLangEnvLang} is a known ISO +%language code. +% \begin{macrocode} + \TrackLangIfKnownLangFromIso{\@TrackLangEnvLang}% + {\@tracklang@track@locale#2}{#3}% + }% + {% +% \end{macrocode} +%Predefined tag. +% \begin{macrocode} + \@tracklang@nameuse{@tracklang@add@#1}% + #2% + }% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@tracklang@parse@langtag} %\changes{1.3}{2016-10-07}{new} % \begin{macrocode} @@ -10109,7 +10193,7 @@ and~\ref{tab:nonisoopts}} % Version info. % \begin{macrocode} \expandafter\def\csname ver@tracklang-region-codes.tex\endcsname{% - 2019/10/06 v1.3.8 (NLCT) Track Languages Regions}% + 2019/11/11 v1.3.9 (NLCT) Track Languages Regions}% % \end{macrocode} % %\begin{macro}{\TrackLangRegionMap} @@ -10498,7 +10582,7 @@ and~\ref{tab:nonisoopts}} %\changes{1.3}{2016-10-07}{added tracklang-scripts.sty} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang-scripts}[2019/10/06 v1.3.8 (NLCT) Track +\ProvidesPackage{tracklang-scripts}[2019/11/11 v1.3.9 (NLCT) Track Language Scripts (LaTeX)] \RequirePackage{tracklang} \input{tracklang-scripts} @@ -10540,7 +10624,7 @@ Language Scripts (LaTeX)] % Version info. % \begin{macrocode} \expandafter\def\csname ver@tracklang-scripts.tex\endcsname{% - 2019/10/06 v1.3.8 (NLCT) Track Languages Scripts (Generic)}% + 2019/11/11 v1.3.9 (NLCT) Track Languages Scripts (Generic)}% % \end{macrocode} % %\begin{macro}{\TrackLangScriptsMap} diff --git a/Master/texmf-dist/source/latex/tracklang/tracklang.ins b/Master/texmf-dist/source/latex/tracklang/tracklang.ins index ae7dc0eb5ae..19adb1e4f4a 100644 --- a/Master/texmf-dist/source/latex/tracklang/tracklang.ins +++ b/Master/texmf-dist/source/latex/tracklang/tracklang.ins @@ -1,4 +1,4 @@ -% tracklang.ins generated using makedtx version 1.2 2019/10/6 15:08 +% tracklang.ins generated using makedtx version 1.2 2019/11/11 16:00 \input docstrip \preamble |