diff options
author | Karl Berry <karl@freefriends.org> | 2018-05-13 21:53:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-05-13 21:53:50 +0000 |
commit | 55be422dc01e60cfae781a9a4a310a96c9e99256 (patch) | |
tree | b14b9bb277ef27dd73b7c28fa74939f6f0eb72d7 | |
parent | 0596b70ef858295d6f164ff4603a889c42876365 (diff) |
tracklang (13may18)
git-svn-id: svn://tug.org/texlive/trunk@47704 c570f23f-e606-0410-a88d-b1316a301751
34 files changed, 209 insertions, 79 deletions
diff --git a/Master/texmf-dist/doc/generic/tracklang/CHANGES b/Master/texmf-dist/doc/generic/tracklang/CHANGES index 67123736ed8..6c250aea4f9 100644 --- a/Master/texmf-dist/doc/generic/tracklang/CHANGES +++ b/Master/texmf-dist/doc/generic/tracklang/CHANGES @@ -1,3 +1,8 @@ +v1.3.6 (2018-05-13): + + * \GetTrackedDialectFromLanguageTag now sets + \TrackedDialectClosestSubMatch. + v1.3.5 (2018-02-21): * Added check for polyglossia's \xpg@loaded diff --git a/Master/texmf-dist/doc/generic/tracklang/README b/Master/texmf-dist/doc/generic/tracklang/README index 2709ffa4bc0..c8de49a420c 100644 --- a/Master/texmf-dist/doc/generic/tracklang/README +++ b/Master/texmf-dist/doc/generic/tracklang/README @@ -1,6 +1,6 @@ -Generic TeX Bundle : tracklang v1.3.5 +Generic TeX Bundle : tracklang v1.3.6 -Last Modified : 2018-02-21 +Last Modified : 2018-05-13 Author : Nicola Talbot diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-babel.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-babel.pdf Binary files differindex 3d743e1f859..c5e22f26b35 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-babel.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-babel.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-de-poly.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-de-poly.pdf Binary files differindex f2c3eb75310..5e76e69975c 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-de-poly.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-de-poly.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-de.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-de.pdf Binary files differindex 4f60a84c8e5..67f6c9e63a3 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-de.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-de.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-poly.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-poly.pdf Binary files differindex ae6d2fa7526..c6e1183214d 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-poly.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals-poly.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals.pdf Binary files differindex 7e54312b70f..a5215d497f4 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de.pdf Binary files differindex 8859c70dd10..f1f9bc0c318 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de2.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de2.pdf Binary files differindex 4655f0e5f13..a3d8b4df693 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de2.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de2.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de3.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de3.pdf Binary files differindex 8da274edd22..9598d58ac98 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de3.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de3.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de4.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de4.pdf Binary files differindex 40c1b7776a9..e77dcfab4af 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de4.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-de4.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-poly.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-poly.pdf Binary files differindex 0416248fff3..972d9c65db9 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-poly.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2-poly.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2.pdf Binary files differindex 4e74e62930d..e8e3e439d6b 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/animals/sample-animals2.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions.pdf Binary files differindex 9393614303b..8957031d3ba 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-manx.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-manx.pdf Binary files differindex b064ee06189..4cb15c07279 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-manx.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-manx.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map.pdf Binary files differindex f68d18921fb..7c6117dbe80 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map2.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map2.pdf Binary files differindex 79a9a2b5cff..caf2f8b95ef 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map2.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map2.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map3.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map3.pdf Binary files differindex 171a7e9666e..9fa9721cb14 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map3.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-map3.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-nomap.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-nomap.pdf Binary files differindex 95ab94539ae..8171ed05b99 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-nomap.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2-nomap.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2.pdf Binary files differindex fd8fc01c204..4fe830b4598 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/regions/sample-regions2.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang.pdf Binary files differindex 1983addbb99..733a31d92f5 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang2.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang2.pdf Binary files differindex 777b4dc2ba8..170f7a2aca2 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang2.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang2.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang3.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang3.pdf Binary files differindex adfc055014c..146ed3be351 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang3.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang3.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang4.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang4.pdf Binary files differindex 38b07403eac..04443dfecdf 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang4.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang4.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang5.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang5.pdf Binary files differindex 4af233b0e3f..1ba266336d4 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang5.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang5.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang6.pdf b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang6.pdf Binary files differindex f888f37a11b..5a7be50be19 100644 --- a/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang6.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/samples/sample-tracklang6.pdf diff --git a/Master/texmf-dist/doc/generic/tracklang/tracklang.pdf b/Master/texmf-dist/doc/generic/tracklang/tracklang.pdf Binary files differindex f8385688504..37e41c9f2d9 100644 --- a/Master/texmf-dist/doc/generic/tracklang/tracklang.pdf +++ b/Master/texmf-dist/doc/generic/tracklang/tracklang.pdf diff --git a/Master/texmf-dist/source/latex/tracklang/tracklang.dtx b/Master/texmf-dist/source/latex/tracklang/tracklang.dtx index b63bb9e3dec..3c809a3d6db 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" % -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" +% -doc "tracklang-manual.tex" % tracklang -% Created on 2018/2/21 13:08 +% Created on 2018/5/13 13:19 %\fi %\iffalse %<*package> @@ -59,7 +59,7 @@ pdfauthor={Nicola L.C. Talbot}, pdftitle={tracklang: tracking language options}]{hyperref} -\CheckSum{3914} +\CheckSum{3961} \appto\MacroFont{\scriptsize} \renewcommand*{\usage}[1]{\textit{\hyperpage{#1}}} @@ -278,11 +278,11 @@ and~\ref{tab:nonisoopts}} % %\MakeShortVerb{"} % -%\title{tracklang v1.3.5: +%\title{tracklang v1.3.6: %tracking language options} %\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}} % -%\date{2018-02-21} +%\date{2018-05-13} %\maketitle % %\begin{abstract} @@ -1351,14 +1351,26 @@ and~\ref{tab:nonisoopts}} %to the tracked language list, if it's not already present.) % %If you want to find out if any of the tracked dialects -%match a particular language tag, you can use: +%matches a particular language tag, you can use: %\begin{definition}[\DescribeMacro\GetTrackedDialectFromLanguageTag] -%\cs{GetTrackedDialectFromLanguageTag}\marg{tag}\marg{cs} +%\ics{GetTrackedDialectFromLanguageTag}\marg{tag}\marg{cs} %\end{definition} %If successful, the supplied control sequence \meta{cs} is set to the -%dialect label, otherwise \meta{cs} is set to empty. Note that the -%extension (that is, the option part that may occur at the end of -%the tag) isn't used in the comparison. +%dialect label, otherwise \meta{cs} is set to empty. The test is for an exact +%match on the root language, script, sub-language, variant and +%region. The control sequence \meta{cs} will be empty if none of the +%tracked dialects matches all five of those elements. (If the script +%isn't given explicitly, the default for that language is assumed.) +%In the event that \meta{cs} is empty, you can now (as from v1.3.6) +%get the closest match with +%\begin{definition}[\DescribeMacro\TrackedDialectClosestSubMatch] +%\ics{TrackedDialectClosestSubMatch} +%\end{definition} +%(which is set by \cs{GetTrackedDialectFromLanguageTag}). +%This will be empty if no tracked dialects match on the root +%language or if there's a tracked dialect label that exactly matches +%the label formed by concatenating the language code, sub-language, +%script, region, modifier and variant. % %For example (Plain \TeX): %\begin{verbatim} @@ -1381,6 +1393,30 @@ and~\ref{tab:nonisoopts}} %It also works if the dialect has been tracked using other commands, %such as \cs{TrackLocale}. % +%Here's an example that doesn't have an exact match, but does have a +%partial match: +%\begin{verbatim} +%\input tracklang +%\TrackLanguageTag{de-CH-1996} +%Has de-DE-1996 been tracked? +%\GetTrackedDialectFromLanguageTag{de-DE-1996}{\thisdialect}% +%\ifx\thisdialect\empty +% No! +% \ifx\TrackedDialectClosestSubMatch\empty +% No match on root language. +% \else +% Closest match: \TrackedDialectClosestSubMatch. +% \fi +%\else +% Yes! Dialect label: \thisdialect. +%\fi +%\bye +%\end{verbatim} +%In this case the result is: +%\begin{quote} +%Has de-DE-1996 been tracked? No! Closest match: nswissgerman. +%\end{quote} +% %You can iterate through each tracked dialect using: %\begin{definition}[\DescribeMacro\ForEachTrackedDialect] %\cs{ForEachTrackedDialect}\marg{cs}\marg{code} @@ -3214,7 +3250,7 @@ and~\ref{tab:nonisoopts}} % packages such as \styfmt{etoolbox}. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang}[2018/02/21 v1.3.5 (NLCT) Track Languages] +\ProvidesPackage{tracklang}[2018/05/13 v1.3.6 (NLCT) Track Languages] % \end{macrocode} %\begin{macro}{\@tracklang@declareoption} % Set up package options. @@ -3492,7 +3528,7 @@ and~\ref{tab:nonisoopts}} % Version info. % \begin{macrocode} \expandafter\def\csname ver@tracklang.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Generic Code} + 2018/05/13 v1.3.6 (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.) @@ -6012,10 +6048,18 @@ and~\ref{tab:nonisoopts}} %\end{definition} %Find the tracked dialect that matches the given language tag and %stores the dialect label in \meta{cs}. If no match found, \meta{cs} -%will be empty. Doesn't check the additional information +%will be empty. Just tests the root language, script, variant, +%sub-language and region. Doesn't check the additional information. +%As from v1.3.6, this sets \cs{TrackedDialectClosestSubMatch} to the +%closest sub-match. % \begin{macrocode} \def\GetTrackedDialectFromLanguageTag#1#2{% +% \end{macrocode} +%Initialise default values (in case of no match). +%\changes{1.3.6}{2018-05-13}{added \cs{TrackedDialectClosestSubMatch}} +% \begin{macrocode} \def#2{}% + \def\TrackedDialectClosestSubMatch{}% \@tracklang@parselangtag{#1}% \edef\@tracklang@dialect{% \@TrackLangEnvLang @@ -6027,14 +6071,14 @@ and~\ref{tab:nonisoopts}} % \end{macrocode} % Has this dialect label been tracked? % \begin{macrocode} - \IfTrackedDialect{\@tracklang@dialect}% - {% + \IfTrackedDialect{\@tracklang@dialect}% + {% % \end{macrocode} % Found it. All done. % \begin{macrocode} \let#2\@tracklang@dialect - }% - {% + }% + {% % \end{macrocode} % Get the root language label. % \begin{macrocode} @@ -6044,6 +6088,10 @@ and~\ref{tab:nonisoopts}} % \begin{macrocode} \edef\@tracklang@defscript{\TrackLangGetDefaultScript\@tracklang@lang}% % \end{macrocode} +% Keep track of best match. +% \begin{macrocode} + \def\@tracklang@bestmatch{0}% +% \end{macrocode} % Get the list of tracked dialects for this language. % \begin{macrocode} \edef\@tracklang@dialects{\TrackedDialectsFromLanguage\@tracklang@lang}% @@ -6051,54 +6099,110 @@ and~\ref{tab:nonisoopts}} % For each dialect in this list, check if it matches. % \begin{macrocode} \@tracklang@for\@tracklang@dialect:=\@tracklang@dialects\do{% +% \end{macrocode} +% Does the script match? (Initialise to no.) +% \begin{macrocode} + \def\@tracklang@currentmatch{0}% \edef\@tracklang@tmp{% - \TrackedIsoCodeFromLanguage{3166-1}{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvTerritory + \GetTrackedDialectScript{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvScript % \end{macrocode} -% Region matches. +% Script matches. +% \begin{macrocode} + \def\@tracklang@currentmatch{1}% + \else +% \end{macrocode} +% Script doesn't match. If no script has been provided, does this +% dialect's script match the default for this language? % \begin{macrocode} - \edef\@tracklang@tmp{% - \GetTrackedDialectSubLang{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvSubLang + \ifx\@TrackLangEnvScript\empty + \ifx\@tracklang@tmp\@tracklang@defscript +% \end{macrocode} +% Default script matches. +% \begin{macrocode} + \def\@tracklang@currentmatch{1}% + \fi + \fi + \fi +% \end{macrocode} +% Does the sub-language match? +% \begin{macrocode} + \edef\@tracklang@tmp{% + \GetTrackedDialectSubLang{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvSubLang % \end{macrocode} % Sub-language matches. % \begin{macrocode} - \edef\@tracklang@tmp{% - \GetTrackedDialectVariant{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvVariant + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else +% \end{macrocode} +% Sub-language doesn't match. +% \begin{macrocode} + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi +% \end{macrocode} +% Does the variant match? +% \begin{macrocode} + \edef\@tracklang@tmp{% + \GetTrackedDialectVariant{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvVariant % \end{macrocode} % Variant matches. % \begin{macrocode} - \edef\@tracklang@tmp{% - \GetTrackedDialectScript{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvScript + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else % \end{macrocode} -% Script matches. Found it. +% Variant doesn't match. % \begin{macrocode} - \let#2\@tracklang@dialect - \else + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi % \end{macrocode} -% Script doesn't match. If no script has been provided, does this -% dialect's script match the default for this language? +% Does the region match? % \begin{macrocode} - \ifx\@TrackLangEnvScript\empty - \ifx\@tracklang@tmp\@tracklang@defscript + \edef\@tracklang@tmp{% + \TrackedIsoCodeFromLanguage{3166-1}{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvTerritory % \end{macrocode} -% Default script matches. Found it. +% Region matches. % \begin{macrocode} - \let#2\@tracklang@dialect - \fi - \fi - \fi - \fi + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else +% \end{macrocode} +% Region doesn't match. +% \begin{macrocode} + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi +% \end{macrocode} +% Do all four match? +% \begin{macrocode} + \ifx\@tracklang@currentmatch\@tracklang@fullmatch +% \end{macrocode} +% Found it. +% \begin{macrocode} + \let#2\@tracklang@dialect + \else +% \end{macrocode} +% Not a complete match. Is this the best match so far? +% \begin{macrocode} + \ifnum\@tracklang@currentmatch>\@tracklang@bestmatch\relax + \let\TrackedDialectClosestSubMatch\@tracklang@dialect + \let\@tracklang@bestmatch\@tracklang@currentmatch \fi \fi - }% - }% + }% + }% } % \end{macrocode} %\end{macro} % +%\begin{macro}{\@tracklang@fullmatch} +%\changes{1.3.6}{2018-05-13}{new} +%(Used to identify a full match for script, sub-language, variant +%and region.) +% \begin{macrocode} +\def\@tracklang@fullmatch{1111} +% \end{macrocode} +%\end{macro} % %\begin{macro}{\TrackLangFromEnv} %\changes{1.3}{2016-10-07}{new} @@ -9956,7 +10060,7 @@ and~\ref{tab:nonisoopts}} % Version info. % \begin{macrocode} \expandafter\def\csname ver@tracklang-region-codes.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Regions}% + 2018/05/13 v1.3.6 (NLCT) Track Languages Regions}% % \end{macrocode} % %\begin{macro}{\TrackLangRegionMap} @@ -10345,7 +10449,7 @@ and~\ref{tab:nonisoopts}} %\changes{1.3}{2016-10-07}{added tracklang-scripts.sty} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang-scripts}[2018/02/21 v1.3.5 (NLCT) Track +\ProvidesPackage{tracklang-scripts}[2018/05/13 v1.3.6 (NLCT) Track Language Scripts (LaTeX)] \RequirePackage{tracklang} \input{tracklang-scripts} @@ -10387,7 +10491,7 @@ Language Scripts (LaTeX)] % Version info. % \begin{macrocode} \expandafter\def\csname ver@tracklang-scripts.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Scripts (Generic)}% + 2018/05/13 v1.3.6 (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 e2937f28d02..f5a8158e68b 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 2018/2/21 13:08 +% tracklang.ins generated using makedtx version 1.2 2018/5/13 13:19 \input docstrip \preamble diff --git a/Master/texmf-dist/tex/generic/tracklang/tracklang-region-codes.tex b/Master/texmf-dist/tex/generic/tracklang/tracklang-region-codes.tex index e48f468e588..135b3a00f10 100644 --- a/Master/texmf-dist/tex/generic/tracklang/tracklang-region-codes.tex +++ b/Master/texmf-dist/tex/generic/tracklang/tracklang-region-codes.tex @@ -64,7 +64,7 @@ \expandafter\endinput \fi \expandafter\def\csname ver@tracklang-region-codes.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Regions}% + 2018/05/13 v1.3.6 (NLCT) Track Languages Regions}% \def\TrackLangRegionMap#1#2#3{% \@tracklang@enamedef{@tracklang@region@numtoalphaii@#1}{#2}% \@tracklang@enamedef{@tracklang@region@numtoalphaiii@#1}{#3}% diff --git a/Master/texmf-dist/tex/generic/tracklang/tracklang-scripts.tex b/Master/texmf-dist/tex/generic/tracklang/tracklang-scripts.tex index 47e4aa43caa..fcb8bcaba32 100644 --- a/Master/texmf-dist/tex/generic/tracklang/tracklang-scripts.tex +++ b/Master/texmf-dist/tex/generic/tracklang/tracklang-scripts.tex @@ -64,7 +64,7 @@ \expandafter\endinput \fi \expandafter\def\csname ver@tracklang-scripts.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Scripts (Generic)}% + 2018/05/13 v1.3.6 (NLCT) Track Languages Scripts (Generic)}% \def\TrackLangScriptMap#1#2#3#4#5{% \@tracklang@enamedef{TrackLangScript#1}{#1}% \@tracklang@enamedef{@tracklang@script@numtoalpha@#2}{#1}% diff --git a/Master/texmf-dist/tex/generic/tracklang/tracklang.tex b/Master/texmf-dist/tex/generic/tracklang/tracklang.tex index 58ec8f19946..9abdf6aec50 100644 --- a/Master/texmf-dist/tex/generic/tracklang/tracklang.tex +++ b/Master/texmf-dist/tex/generic/tracklang/tracklang.tex @@ -64,7 +64,7 @@ \expandafter\endinput \fi \expandafter\def\csname ver@tracklang.tex\endcsname{% - 2018/02/21 v1.3.5 (NLCT) Track Languages Generic Code} + 2018/05/13 v1.3.6 (NLCT) Track Languages Generic Code} \long\def\@tracklang@ifundef#1#2#3{% \ifcsname#1\endcsname \expandafter\ifx\csname #1\endcsname\relax @@ -1334,6 +1334,7 @@ }% \def\GetTrackedDialectFromLanguageTag#1#2{% \def#2{}% + \def\TrackedDialectClosestSubMatch{}% \@tracklang@parselangtag{#1}% \edef\@tracklang@dialect{% \@TrackLangEnvLang @@ -1342,41 +1343,61 @@ \@TrackLangEnvTerritory \@TrackLangEnvModifier \@TrackLangEnvVariant}% - \IfTrackedDialect{\@tracklang@dialect}% - {% + \IfTrackedDialect{\@tracklang@dialect}% + {% \let#2\@tracklang@dialect - }% - {% + }% + {% \edef\@tracklang@lang{\TrackLangGetKnownLangFromIso\@TrackLangEnvLang}% \edef\@tracklang@defscript{\TrackLangGetDefaultScript\@tracklang@lang}% + \def\@tracklang@bestmatch{0}% \edef\@tracklang@dialects{\TrackedDialectsFromLanguage\@tracklang@lang}% \@tracklang@for\@tracklang@dialect:=\@tracklang@dialects\do{% + \def\@tracklang@currentmatch{0}% + \edef\@tracklang@tmp{% + \GetTrackedDialectScript{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvScript + \def\@tracklang@currentmatch{1}% + \else + \ifx\@TrackLangEnvScript\empty + \ifx\@tracklang@tmp\@tracklang@defscript + \def\@tracklang@currentmatch{1}% + \fi + \fi + \fi + \edef\@tracklang@tmp{% + \GetTrackedDialectSubLang{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvSubLang + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi + \edef\@tracklang@tmp{% + \GetTrackedDialectVariant{\@tracklang@dialect}}% + \ifx\@tracklang@tmp\@TrackLangEnvVariant + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi \edef\@tracklang@tmp{% \TrackedIsoCodeFromLanguage{3166-1}{\@tracklang@dialect}}% \ifx\@tracklang@tmp\@TrackLangEnvTerritory - \edef\@tracklang@tmp{% - \GetTrackedDialectSubLang{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvSubLang - \edef\@tracklang@tmp{% - \GetTrackedDialectVariant{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvVariant - \edef\@tracklang@tmp{% - \GetTrackedDialectScript{\@tracklang@dialect}}% - \ifx\@tracklang@tmp\@TrackLangEnvScript - \let#2\@tracklang@dialect - \else - \ifx\@TrackLangEnvScript\empty - \ifx\@tracklang@tmp\@tracklang@defscript - \let#2\@tracklang@dialect - \fi - \fi - \fi - \fi + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 1}% + \else + \edef\@tracklang@currentmatch{\@tracklang@currentmatch 0}% + \fi + \ifx\@tracklang@currentmatch\@tracklang@fullmatch + \let#2\@tracklang@dialect + \else + \ifnum\@tracklang@currentmatch>\@tracklang@bestmatch\relax + \let\TrackedDialectClosestSubMatch\@tracklang@dialect + \let\@tracklang@bestmatch\@tracklang@currentmatch \fi \fi - }% - }% + }% + }% } +\def\@tracklang@fullmatch{1111} \def\TrackLangFromEnv{% \def\TrackLangEnvLang{}% \def\TrackLangEnvTerritory{}% diff --git a/Master/texmf-dist/tex/latex/tracklang/tracklang-scripts.sty b/Master/texmf-dist/tex/latex/tracklang/tracklang-scripts.sty index 7d192dddddb..1ac6bf54f7f 100644 --- a/Master/texmf-dist/tex/latex/tracklang/tracklang-scripts.sty +++ b/Master/texmf-dist/tex/latex/tracklang/tracklang-scripts.sty @@ -51,7 +51,7 @@ %% do code now to initialise %% Pass all options to tracklang: \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang-scripts}[2018/02/21 v1.3.5 (NLCT) Track +\ProvidesPackage{tracklang-scripts}[2018/05/13 v1.3.6 (NLCT) Track Language Scripts (LaTeX)] \RequirePackage{tracklang} \input{tracklang-scripts} diff --git a/Master/texmf-dist/tex/latex/tracklang/tracklang.sty b/Master/texmf-dist/tex/latex/tracklang/tracklang.sty index 24949e85efd..a1ff8be7336 100644 --- a/Master/texmf-dist/tex/latex/tracklang/tracklang.sty +++ b/Master/texmf-dist/tex/latex/tracklang/tracklang.sty @@ -51,7 +51,7 @@ %% do code now to initialise %% Pass all options to tracklang: \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tracklang}[2018/02/21 v1.3.5 (NLCT) Track Languages] +\ProvidesPackage{tracklang}[2018/05/13 v1.3.6 (NLCT) Track Languages] \providecommand*{\@tracklang@declareoption}[1]{% \DeclareOption{#1}{\TrackPredefinedDialect{#1}}% } |