diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-11 22:01:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-11 22:01:01 +0000 |
commit | fa4d2a5e2aa4aef4c17f825a54127ab10979e27c (patch) | |
tree | 950f60c4d5dda23e9195af93d49623c0d27b6dc3 | |
parent | 94a61ef951904c933eda185e73e73a42ce34725f (diff) |
zref-clever (11jan22)
git-svn-id: svn://tug.org/texlive/trunk@61572 c570f23f-e606-0410-a88d-b1316a301751
15 files changed, 2076 insertions, 887 deletions
diff --git a/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md b/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md index e190d38d68c..5a5addd47ee 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md @@ -1,15 +1,39 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.1.1-alpha...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.1.2-alpha...HEAD) + +## [v0.1.2-alpha](https://github.com/gusbrs/zref-clever/compare/v0.1.1-alpha...v0.1.2-alpha) (2022-01-10) + +### Added +- Provided Dutch language file (see PR + [#5](https://github.com/gusbrs/zref-clever/pull/5)). + +### Changed +- The `gender` key in `\zcLanguageSetup` and in the built-in language files + can receive a comma separated list as value to support types with multiple + valid genders. +- The `cap` and `abbrev` options can now be set also in `\zcRefTypeSetup` and + `\zcLanguageSetup`, so that fine grained control per-type and per-language + is now possible for these options. +- Abandoned the "dictionary/translation" metaphor to refer to language + specific options. Mostly housekeeping, affecting the name-scheme of + functions and variables, but aiming at a clearer documentation in this area, + specially in the longer term. + +### Deprecated +- The reference format options `refpre` and `refpos` have been deprecated in + favor or the more aptly named `preref` and `postref`, respectively. ## [v0.1.1-alpha](https://github.com/gusbrs/zref-clever/compare/v0.1.0-alpha...v0.1.1-alpha) (2021-12-07) ### Changed - Improvements to the French dictionary (see issue [#1](https://github.com/gusbrs/zref-clever/issues/1)). -- Dropped the `subappendix` reference type. - Improvements to documentation. +### Removed +- Dropped the `subappendix` reference type. + ## [v0.1.0-alpha](https://github.com/gusbrs/zref-clever/releases/tag/v0.1.0-alpha) (2021-00-24) ### Added diff --git a/Master/texmf-dist/doc/latex/zref-clever/MANIFEST.md b/Master/texmf-dist/doc/latex/zref-clever/MANIFEST.md index e40fb05bf09..a52c56a9ee0 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/MANIFEST.md +++ b/Master/texmf-dist/doc/latex/zref-clever/MANIFEST.md @@ -42,11 +42,12 @@ The files created by ‘unpacking’ the package sources. This typically include `.sty` and `.cls` files created from DocStrip `.dtx` files. * zref-clever.sty † -* zref-clever-english.dict † -* zref-clever-french.dict † -* zref-clever-german.dict † -* zref-clever-portuguese.dict † -* zref-clever-spanish.dict † +* zref-clever-dutch.lang † +* zref-clever-english.lang † +* zref-clever-french.lang † +* zref-clever-german.lang † +* zref-clever-portuguese.lang † +* zref-clever-spanish.lang † ### Typeset documents @@ -82,8 +83,6 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-compat-memoir01.lvt * zc-compat-subcaption01.lvt * zc-compat-subfig01.lvt -* zc-dictionaries01.lvt -* zc-dictionaries02.lvt * zc-howto-amsmath01.lvt * zc-howto-enumitem01.lvt * zc-howto-listings01.lvt @@ -98,6 +97,8 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-howto-newtheorem04.lvt * zc-howto-zref-xr01.lvt * zc-label-options01.lvt +* zc-langfiles01.lvt +* zc-langfiles02.lvt * zc-languages01.lvt * zc-opt-check01.lvt * zc-opt-d01.lvt @@ -219,12 +220,6 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-compat-subfig01.tlg * zc-compat-subfig01.xetex.tlg * zc-compat-subfig01.xetexdev.tlg -* zc-dictionaries01.tlg -* zc-dictionaries02.luatex.tlg -* zc-dictionaries02.luatexdev.tlg -* zc-dictionaries02.tlg -* zc-dictionaries02.xetex.tlg -* zc-dictionaries02.xetexdev.tlg * zc-howto-amsmath01.luatex.tlg * zc-howto-amsmath01.luatexdev.tlg * zc-howto-amsmath01.tlg @@ -293,6 +288,12 @@ different engines (pdfTeX, XeTeX, LuaTeX, etc.). * zc-label-options01.luatex.tlg * zc-label-options01.luatexdev.tlg * zc-label-options01.tlg +* zc-langfiles01.tlg +* zc-langfiles02.luatex.tlg +* zc-langfiles02.luatexdev.tlg +* zc-langfiles02.tlg +* zc-langfiles02.xetex.tlg +* zc-langfiles02.xetexdev.tlg * zc-languages01.tlg * zc-opt-check01.luatex.tlg * zc-opt-check01.luatexdev.tlg @@ -419,11 +420,12 @@ All files included in the `zref-clever/source` directory. All files included in the `zref-clever/tex` directory. -* zref-clever-english.dict -* zref-clever-french.dict -* zref-clever-german.dict -* zref-clever-portuguese.dict -* zref-clever-spanish.dict +* zref-clever-dutch.lang +* zref-clever-english.lang +* zref-clever-french.lang +* zref-clever-german.lang +* zref-clever-portuguese.lang +* zref-clever-spanish.lang * zref-clever.sty ### Doc files (TDS) diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf Binary files differindex f8d0003a960..b955c4c59f6 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.tex b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.tex index a4ebabd625e..edc439e5c31 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.tex +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.tex @@ -4,7 +4,7 @@ % % This file is part of the LaTeX package "zref-clever". % -% Copyright (C) 2021 Gustavo Barros +% Copyright (C) 2021-2022 Gustavo Barros % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf Binary files differindex 84f9a28b55e..1c64f52147e 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex index 4da3b2453d1..a4e3ab8638f 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex @@ -4,7 +4,7 @@ % % This file is part of the LaTeX package "zref-clever". % -% Copyright (C) 2021 Gustavo Barros +% Copyright (C) 2021-2022 Gustavo Barros % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -56,8 +56,6 @@ \usepackage{listings} \usepackage{microtype} -% TEMP work-around for https://github.com/schlcht/microtype/issues/4 -\microtypesetup{nopatch=item} \hypersetup{hidelinks} @@ -523,9 +521,10 @@ The option given without a value is equivalent to \texttt{range=true} (in the \DescribeOption{nocap} % \DescribeOption{capfirst} % The \opt{cap} option controls whether the reference type names should be -capitalized or not. It is a boolean option, and the package's default is -\texttt{cap=false}. The option given without a value is equivalent to -\texttt{cap=true}. The \opt{nocap} option is a convenience alias for +capitalized or not. It can receive values \texttt{true} or \texttt{false}, +and it can also be set for specific reference types or languages (see +\zcref{sec:reference-format}). The option given without a value is equivalent +to \texttt{cap=true}. The \opt{nocap} option is a convenience alias for \texttt{cap=false}. The \opt{capfirst} option ensures that the reference type name of the \emph{first} type block is capitalized, even when \opt{cap} is set to \texttt{false}. @@ -534,9 +533,10 @@ to \texttt{false}. \DescribeOption{noabbrev} % \DescribeOption{noabbrevfirst} % The \opt{abbrev} option controls whether to use abbreviated reference type -names when they are available. It is a boolean option, and the package's -default is \texttt{abbrev=false}. The option given without a value is -equivalent to \texttt{abbrev=true}. The \opt{noabbrev} option is a +names when they are available. It can receive values \texttt{true} or +\texttt{false}, and it can also be set for specific reference types or +languages (see \zcref{sec:reference-format}). The option given without a +value is equivalent to \texttt{abbrev=true}. The \opt{noabbrev} option is a convenience alias for \texttt{abbrev=false}. The \opt{noabbrevfirst} ensures that the reference type name of the \emph{first} type block is never abbreviated, even when \opt{abbrev} is set to \texttt{true}. @@ -592,8 +592,8 @@ the second reference none of them will. The package's default is equivalent to \texttt{nameinlink=true}. \DescribeOption{preposinlink} % -The \opt{preposinlink} option controls whether the \opt{refpre} and -\opt{refpos} reference format options (see \zcref{sec:reference-format}) are +The \opt{preposinlink} option controls whether the \opt{preref} and +\opt{postref} reference format options (see \zcref{sec:reference-format}) are included in the reference hyperlink or not. It is a boolean option. The package's default is \texttt{preposinlink=false}, and the option given without a value is equivalent to \texttt{preposinlink=true}. @@ -650,15 +650,15 @@ is the way to tell \cs{zcref} you know it's a singular and so not to nudge if a compression to singular occurs, but to nudge if the contrary occurs, that is, when a plural type name form is employed. The \texttt{gender} nudge must be combined with option \opt{g}, and depends on the language having support -for it. In essence language dictionaries can store the gender of each type -name (this is done for built-in dictionaries, but can also be done with +for it. In essence language files can store the gender(s) of each type name +(this is done for built-in language files, but can also be done with \cs{zcLanguageSetup} for languages declared to support it). The \opt{g} option let's you specify the gender you expect for that particular reference and the nudge is triggered if there is a mismatch between \opt{g} and the -gender for the type name in the dictionary. Both the \texttt{comptosing} and -the \texttt{gender} nudges have a type block as its scope. See -\zcref{sec:internationalization} for more details and intended use cases of -the ``nudging'' feature. +gender(s) for the type name in the language file. Both the +\texttt{comptosing} and the \texttt{gender} nudges have a type block as its +scope. See \zcref{sec:internationalization} for more details and intended use +cases of the ``nudging'' feature. \DescribeOption{font} % The \opt{font} option can receive font styling commands to change the @@ -822,7 +822,7 @@ contrary may also happen, a \emph{counter} may be defined but we have no these reference types are available for use out of the box.\footnote{There may be slight availability differences depending on the language, but \pkg{zref-clever} strives to keep this complete list available for the - languages it has built-in dictionaries.} And, in any case, it is always + languages it has built-in language files.} And, in any case, it is always easy to setup custom reference types with \cs{zcRefTypeSetup} or \cs{zcLanguageSetup} (see \zcref{sec:user-interface, sec:reference-format, sec:internationalization}). @@ -883,71 +883,75 @@ less overarching effects, and some precedence rules to regulate the relation of settings given in each of these scopes. There are four scopes in which reference formatting can be specified by the user, in the following precedence order: i) as \emph{general options}; ii) as \emph{type-specific options}; iii) -as \emph{language-specific and type-specific translations}; and iv) as -\emph{default translations} (that is, language-specific but not -type-specific). Besides those, there's a fifth \emph{internal} scope, with -the least priority of all, a ``fallback'', for the cases where it is -meaningful to provide some value, even for an unknown language. The package -itself places the default setup for reference formatting at low precedence -levels, and the users can easily and conveniently override them as desired. - -``General options'' (i) can be given by the user in the optional argument of +as \emph{language- and type-specific options}; and iv) as +\emph{language-specific default options}. Besides those, there's a fifth +\emph{internal} scope, with the least priority of all, a ``fallback'', for the +cases where it is meaningful to provide some value, even for an unknown +language. The package itself places the default setup for reference +formatting at low precedence levels, and the users can easily and conveniently +override them as desired. + +``General'' options (i) can be given by the user in the optional argument of \cs{zcref}, but also set through \cs{zcsetup} or even, depending on the case, as package options at load-time (see \zcref{sec:options}).\footnote{The use of \cs{zcsetup} for global reference format settings is recommended though. Whether you can use load-time options or not depends on the values of the options: due to how \LaTeX{} handles package options, if the values of the options you are setting include \emph{commands} you can't set them at - load-time, and rather \emph{must} use \cs{zcsetup}.} ``Type-specific -options'' (ii) are handled by \cs{zcRefTypeSetup} (see -\zcref{sec:user-interface}). ``Language-specific translations'', be they -``type-specific'' (iii) or ``default'' (iv) have their user interface in -\cs{zcLanguageSetup}, and have their values populated by the package's -built-in dictionaries (see \zcref{sec:internationalization}). Not all -reference format specifications can be given in all of these scopes, though. -Some of them can't be type-specific, others must be type-specific, so the set -available in each scope depends on the pertinence of the case. -\zcref{tab:reference-format} introduces the available reference format -options, which will be discussed in more detail soon, and lists the scopes in -which each is available. + load-time, and rather \emph{must} use \cs{zcsetup}.} ``Type'' specific +options (ii) are handled by \cs{zcRefTypeSetup} (see +\zcref{sec:user-interface}). ``Language'' options, whether ``type'' specific +(iii) or ``default'' (iv) have their user interface in \cs{zcLanguageSetup}, +and have their values populated by the package's built-in language files (see +\zcref{sec:internationalization}). Not all reference format specifications +can be given in all of these scopes, though. Some of them can't be +type-specific, others must be type-specific, so the set available in each +scope depends on the pertinence of the case. \zcref{tab:reference-format} +introduces the available reference format options, which will be discussed in +more detail soon, and lists the scopes in which each is available. \begin{table}[htb] \centering \begin{tabular}{l>{\ttfamily}lcccc} \toprule - & & General & Type & Type-specific & Default \\ - & & options & options & translations & translations \\ - & & (i) & (ii) & (iii) & (iv) \\ + & & General & Type & \multicolumn{2}{c}{Language} \\ + \cmidrule(lr){5-6} + & & & & Type & Default \\ + & & (i) & (ii) & (iii) & (iv) \\ \midrule - Necessarily not & tpairsep & $\bullet$ & & & $\bullet$ \\ - type-specific & tlistsep & $\bullet$ & & & $\bullet$ \\ - & tlastsep & $\bullet$ & & & $\bullet$ \\ - & notesep & $\bullet$ & & & $\bullet$ \\ + Typesetting & tpairsep & $\bullet$ & & & $\bullet$ \\ + (necessarily not & tlistsep & $\bullet$ & & & $\bullet$ \\ + type-specific) & tlastsep & $\bullet$ & & & $\bullet$ \\ + & notesep & $\bullet$ & & & $\bullet$ \\ \addlinespace - Possibly & namesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - type-specific & pairsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & listsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & lastsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & rangesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & refpre & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ - & refpos & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + Typesetting & namesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + (possibly & pairsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + type-specific) & listsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & lastsep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & rangesep & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & preref & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & postref & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ \addlinespace - Necessarily & Name-sg & & $\bullet$ & $\bullet$ & \\ - type-specific & name-sg & & $\bullet$ & $\bullet$ & \\ - & Name-pl & & $\bullet$ & $\bullet$ & \\ - & name-pl & & $\bullet$ & $\bullet$ & \\ - & Name-sg-ab & & $\bullet$ & $\bullet$ & \\ - & name-sg-ab & & $\bullet$ & $\bullet$ & \\ - & Name-pl-ab & & $\bullet$ & $\bullet$ & \\ - & name-pl-ab & & $\bullet$ & $\bullet$ & \\ + Typesetting & Name-sg & & $\bullet$ & $\bullet$ & \\ + (necessarily & name-sg & & $\bullet$ & $\bullet$ & \\ + type-specific) & Name-pl & & $\bullet$ & $\bullet$ & \\ + & name-pl & & $\bullet$ & $\bullet$ & \\ + & Name-sg-ab & & $\bullet$ & $\bullet$ & \\ + & name-sg-ab & & $\bullet$ & $\bullet$ & \\ + & Name-pl-ab & & $\bullet$ & $\bullet$ & \\ + & name-pl-ab & & $\bullet$ & $\bullet$ & \\ \addlinespace - Font & namefont & $\bullet$ & $\bullet$ & & \\ - options & reffont & $\bullet$ & $\bullet$ & & \\ + Font & namefont & $\bullet$ & $\bullet$ & & \\ + & reffont & $\bullet$ & $\bullet$ & & \\ + + \addlinespace + Other & cap & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ + & abbrev & $\bullet$ & $\bullet$ & $\bullet$ & $\bullet$ \\ \bottomrule \end{tabular} \caption{Reference format options and their scopes} @@ -963,7 +967,7 @@ that which a standard \LaTeX{} \cs{ref} would typeset. A \pkg{zref-clever} \begin{refformat} \item \reffmt{ref-block} \(\equiv\) -\item \reffmt{refpre} \reffmt{ref} \reffmt{refpos} +\item \reffmt{preref} \reffmt{ref} \reffmt{postref} \end{refformat} A \texttt{ref-block} is built for \emph{each} label given as argument to @@ -1037,48 +1041,48 @@ typeset output is built as: \item \reffmt{type-block-group} \reffmt{notesep} \reffmt{note} \end{refformat} -Reference format options can yet be divided in two general categories: i) -``string'' options, the ones which we have seen thus far, as ``building -blocks'' of the reference; and ii) ``font'' options, which control font -attributes of parts of the reference, namely \opt{namefont} and \opt{reffont}. -These options set the font, respectively, for the \texttt{type-name} and for -\texttt{ref} (to set the font for the whole reference, see the \opt{font} -option in \zcref{sec:options}). ``String'' options is not really a strict -denomination for the first category, but this set of options is intended -exclusively for typesetting material: things you expect to see in the output -of your references. The ``font'' options, on the other hand, are intended -exclusively for commands that only change font attributes: style, family, -shape, weight, size, color, etc. In either case, anything other than their -intended uses is not supported. +Reference format options can yet be divided in three general categories: i) +``typesetting'' options, the ones which we have seen thus far, as ``building +blocks'' of the reference; ii) ``font'' options, which control font attributes +of parts of the reference, namely \opt{namefont} and \opt{reffont}; and iii) +``other'' options. ``Typesetting'' options are intended exclusively for +typesetting material: things you expect to see in the output of your +references. ``Font'' options set the font, respectively, for the +\texttt{type-name} and for \texttt{ref} (to set the font for the whole +reference, see the \opt{font} option in \zcref{sec:options}). These options +are intended exclusively for commands that only change font attributes: style, +family, shape, weight, size, color, etc. In either case, anything other than +their intended uses is not supported. Finally, a comment about the internal ``fallback'' reference format values mentioned above. These ``last resort'' option values are required by \pkg{zref-clever} for a clear particular case: if the user loads either \pkg{babel} or \pkg{polyglossia}, or explicitly sets a language, with a -language that \pkg{zref-clever} does not know and has no dictionary for, it +language that \pkg{zref-clever} does not know and has no language file for, it cannot guess what language that is, and thus has to provide some reasonable ``language agnostic'' default, at least for the options for which this makes -sense (all the ``string'' options, except for the \texttt{[Nn]ame-} ones). -Users do not need to have access to this scope, since they know the language -of their document, or know the values they want for those options, and can set -them as general options, type-specific options, or language options through -the user interface provided for the purpose. But the ``fallback'' options are -documented here so that you can recognize when you are getting these values -and change them appropriately as desired. Though hopefully reasonable, they -may not be what you want. The ``fallback'' option values are the following: +sense (all the ``typesetting'' options, except for the \texttt{[Nn]ame-} +ones). Users do not need to have access to this scope, since they know the +language of their document, or know the values they want for those options, +and can set them as general options, type-specific options, or language +options through the user interface provided for the purpose. But the +``fallback'' options are documented here so that you can recognize when you +are getting these values and change them appropriately as desired. Though +hopefully reasonable, they may not be what you want. The ``fallback'' option +values are the following: \begin{zcexample}[escapeinside=`'] -tpairsep = {,`\textvisiblespace{}'} , -tlistsep = {,`\textvisiblespace{}'} , -tlastsep = {,`\textvisiblespace{}'} , -notesep = {`\textvisiblespace{}'} , -namesep = {\nobreakspace} , -pairsep = {,`\textvisiblespace{}'} , -listsep = {,`\textvisiblespace{}'} , -lastsep = {,`\textvisiblespace{}'} , -rangesep = {\textendash} , -refpre = {} , -refpos = {} , +tpairsep = {,`\textvisiblespace{}'} , +tlistsep = {,`\textvisiblespace{}'} , +tlastsep = {,`\textvisiblespace{}'} , +notesep = {`\textvisiblespace{}'} , +namesep = {\nobreakspace} , +pairsep = {,`\textvisiblespace{}'} , +listsep = {,`\textvisiblespace{}'} , +lastsep = {,`\textvisiblespace{}'} , +rangesep = {\textendash} , +preref = {} , +postref = {} , \end{zcexample} @@ -1090,12 +1094,11 @@ refpos = {} , of these language packages, or to a language specified directly by the user. This is primarily relevant for reference format options, particularly reference type \emph{names} (though not only, since most reference format -options can have language-specific values, or ``translations'', see -\zcref{sec:reference-format}). But other features of the package also cater -for language specific needs. +options can have language-specific values see \zcref{sec:reference-format}). +But other features of the package also cater for language specific needs. As far as language selection is concerned, if the language is declared and -\pkg{zref-clever} has a built-in ``dictionary'' for it, most use cases will +\pkg{zref-clever} has a built-in ``language file'' for it, most use cases will likely be covered by the \opt{lang} option (see \zcref{sec:options}), and its values \texttt{current} and \texttt{main}. When the \opt{lang} option is set to \texttt{current} or \texttt{main}, \pkg{zref-check} will use, respectively, @@ -1108,17 +1111,17 @@ the \emph{current} or \emph{main} language of the document, as defined by will note that \zcref{tab:languages-and-aliases} contains only \pkg{babel} language names.} Users can also set \opt{lang} to a specific language directly, in which case \pkg{babel} and \pkg{polyglossia} are disregarded. -\pkg{zref-clever} provides a number of built-in ``dictionaries'', for the +\pkg{zref-clever} provides a number of built-in ``language file'', for the languages listed in \zcref{tab:languages-and-aliases}, which also includes the declared aliases to those languages. -\pkg{zref-clever}'s ``dictionaries'' are loaded sparingly and lazily. A -dictionary for a single language -- that specified by user options in the +\pkg{zref-clever}'s ``language files'' are loaded sparingly and lazily. A +language file for a single language -- that specified by user options in the preamble, which by default is the current document language -- is loaded at -\texttt{begindocument}. If any other dictionary is needed, it is loaded on +\texttt{begindocument}. If any other language file is needed, it is loaded on the fly, if and when required. Of course, in either case, conditioned on availability. In sum, \pkg{zref-clever} loads as little as possible, but -allows for convenient on the fly loading of dictionaries if the values are +allows for convenient on the fly loading of language files if the values are indeed required, without users having to worry about it at all. \begin{table} @@ -1155,7 +1158,7 @@ indeed required, without users having to worry about it at all. & brazil \\ & portuges \\ spanish & \\ - & \\ + dutch & \\ \bottomrule \end{tabular} \caption{Declared languages and aliases} @@ -1163,11 +1166,11 @@ indeed required, without users having to worry about it at all. \end{table} -But if the built-in dictionaries do not cover your language, or if you'd like -to adjust some of the default language-specific options, this can be done with -\cs{zcDeclareLanguage}, \cs{zcDeclareLanguageAlias}, and +But if the built-in language files do not cover your language, or if you'd +like to adjust some of the default language-specific options, this can be done +with \cs{zcDeclareLanguage}, \cs{zcDeclareLanguageAlias}, and \cs{zcLanguageSetup}.\footnote{Needless to say, if you'd like to contribute a - dictionary or improve an existing one, that is much welcome at + language file or improve an existing one, that is much welcome at \url{https://github.com/gusbrs/zref-clever/issues}.} \begin{function}{\zcDeclareLanguage} @@ -1190,13 +1193,13 @@ in \cs{zcLanguageSetup}. There is no default presumed in this case. Finally, capitalized for grammatical reasons. For a language declared with the \opt{allcaps} option, the \opt{cap} reference option (see \zcref{sec:options}) is disregarded, and \cs{zcref} always uses the capitalized type name forms. -This means that dictionaries for languages with such a trait can be halved in -size, and that user customization for them is simplified, only requiring the -capitalized name forms. On the other hand, the non-capitalized \texttt{name-} -reference format options are rendered no-op for the language in question. -\zcref[S]{tab:language-options} presents an overview of the options in effect -for the languages declared by \pkg{zref-clever}. \cs{zcDeclareLanguage} is -preamble only. +This means that language files for languages with such a trait can be halved +in size, and that user customization for them is simplified, only requiring +the capitalized name forms. On the other hand, the non-capitalized +\texttt{name-} reference format options are rendered no-op for the language in +question. \zcref[S]{tab:language-options} presents an overview of the options +in effect for the languages declared by \pkg{zref-clever}. +\cs{zcDeclareLanguage} is preamble only. \begin{table} \centering @@ -1209,6 +1212,7 @@ preamble only. german & N,A,D,G & f,m,n & yes \\ portuguese & -- & f,m & -- \\ spanish & -- & f,m & -- \\ + dutch & -- & f,m,n & -- \\ \bottomrule \end{tabular} \caption{Options for declared languages} @@ -1245,12 +1249,13 @@ for reference type \texttt{foo}. Similarly, after \texttt{case=X} (provided first occurrence of either \opt{type} or \opt{case} default values are set. For \opt{case} this means the default declension case, which is the first element of the list provided to the \opt{declension} option in -\cs{zcDeclareLanguage}. For \opt{type} this means ``default translations'', -which are language-specific but not type-specific option values (see -\zcref{sec:reference-format}). An empty valued \texttt{type=} key can also -``unset'' the type. The \opt{gender} key sets the gender of the current -\texttt{type} (provided the value it receives is one of the declared genders -for \meta{language}). \cs{zcLanguageSetup} is preamble only. +\cs{zcDeclareLanguage}. For \opt{type} this means language-specific but not +type-specific option values (see \zcref{sec:reference-format}). An empty +valued \texttt{type=} key can also ``unset'' the type. The \opt{gender} key +sets the gender of the current \texttt{type} (provided the value it receives +is one of the declared genders for \meta{language}). For \texttt{type}s which +have multiple valid genders for a given language, the option can also receive +a comma separated list. \cs{zcLanguageSetup} is preamble only. A couple of examples to illustrate the syntax of \cs{zcLanguageSetup}: @@ -1292,7 +1297,7 @@ their typeset output automated. For reference type names, the declension cases for each language must be declared with \cs{zcDeclareLanguage}, and the name reference format options -must be provided for each case, which is done for built-in dictionaries of +must be provided for each case, which is done for built-in language files of languages which have noun declension, and can be done by the user with \cs{zcLanguageSetup}, as we've seen. \pkg{zref-clever} does not try to guess or infer the case though, you must tell it to \cs{zcref}. And this is done by @@ -1328,11 +1333,11 @@ is comprised of multiple type blocks. \opt{comptosing} when multiple labels of the same type block have been compressed into a single one and, hence, the type name used is singular. Finally, \opt{gender} nudges when there is a mismatch between the gender specified in \cs{zcref} with the \opt{g} option -and the gender of the type name, as stored in the dictionary or language -settings, for each type block. Which nudges to use is configurable with the -option \opt{nudgeif}. And, if you're sure of the results for a particular -\cs{zcref} call, you can always silence the nudges locally with the -\opt{nonudge} option. +and the gender of the type name, as set in the language file or with +\cs{zcLanguageSetup}, for each type block. Which nudges to use is +configurable with the option \opt{nudgeif}. And, if you're sure of the +results for a particular \cs{zcref} call, you can always silence the nudges +locally with the \opt{nonudge} option. The main reason to watch for multiple type references with the \opt{multitype} nudge is that bundling together automatically a list of type blocks is less @@ -1384,14 +1389,14 @@ example, that implies that the reference to it changes gender and the likely preceding article will no longer pass to the reference. The \opt{gender} nudge requires that the gender of each type name and of each reference be explicitly specified. For the type names, this is done for the built-in -dictionaries of languages were this matters, and can be done with +language files of languages were this matters, and can be done with \cs{zcLanguageSetup} as well. For the references, that is the purpose of the \opt{g} option. When there is a mismatch between the two for any type block, the nudge is triggered. Of couse, this means that the gender markup has to be -supplied in the document at each reference. And considering such type changes -may not be frequent for you, or considered not particularly problematic, -you'll have to balance if doing so is worth it. Still, the feature is -available, and it's up to you. +supplied in the document at each reference. And given such type changes may +not be frequent for you, or considered not particularly problematic, you'll +have to balance if doing so is worth it. Still, the feature is available, and +it's up to you. \section{How-tos} @@ -1402,10 +1407,10 @@ set around a cross-reference ``task'' we'd like to perform with \pkg{zref-clever}. -\subsection{Context sensitive references} +\subsection{Context sensitive page references} -\zctask{Make cross-references which are sensitive to the relative position - between the reference and the label being referred to.} +\zctask{Make cross-references to pages which are sensitive to the relative + position between the reference and the label being referred to.} It is frequently useful to make a reference to both a document element and its page. For example: @@ -1436,12 +1441,12 @@ corrected. Evidently, this does not fully automate the typeset results, but it does automate the checking that the reference context is the intended one. And to make use of this feature, one does not need to rely on compiling the -document, make one such reference according to the current state of things, -and then adjusting them over and over, as the document gets edited. This -feature is best used within a certain workflow, which starts by making a -standard reference, but adding the \texttt{pagegap} check to it: +document, make the reference according to the current state of things, and +then adjusting it over and over, as the document gets edited. This feature is +best used within a certain workflow, which starts by making a standard +reference with a page reference, but adding the \texttt{pagegap} check to it: \begin{zcexample} -\zcref[check=pagegap]{fig:1} on \zcpageref{fig:1} +\zcref{fig:1} on \zcpageref[check=pagegap]{fig:1} \end{zcexample} During the initial editing of the document, this reference will be formally @@ -1586,8 +1591,8 @@ cross-references in multiple languages, in which case you'd require \cs{zcLanguageSetup}, the most convenient way to setup a reference type is \cs{zcRefTypeSetup}. In most cases, what we really need to provide for a custom type are the ``type names'' and other reference format options can rely -on default translations already provided by the package (assuming the language -is supported). +on default language options already provided by the package (assuming the +language is supported). \begin{zchowto}[caption={\cs{newtheorem}, custom type}] \documentclass{article} @@ -2202,7 +2207,7 @@ were generously provided by (in chronological order): % 2021-10-10: https://tex.stackexchange.com/questions/618434/#comment1544401_618439 Frank Mittelbach, % 2021-10-14: https://github.com/latex3/latex2e/issues/687 - \texttt{@samcarter}, + `\texttt{samcarter}', % 2021-10-14: https://chat.stackexchange.com/transcript/message/59361777#59361777 % 2021-10-21: https://chat.stackexchange.com/transcript/message/59418309#59418309 Alan Munn, @@ -2215,12 +2220,19 @@ were generously provided by (in chronological order): % 2021-11-25: https://github.com/gusbrs/zref-clever/issues/1 Marcel Krüger, % 2021-11-26: https://github.com/latex3/l3build/issues/215 - and Jürgen Spitzmüller. + Jürgen Spitzmüller, % 2021-11-28: https://github.com/gusbrs/zref-clever/issues/2 + and `\texttt{niluxv}'. + % 2022-01-05: https://github.com/gusbrs/zref-clever/issues/4 + % 2022-01-05: https://github.com/gusbrs/zref-clever/pull/5 -The package's dictionaries have been provided or improved thanks to: - Denis Bitouzé (French). +The package's language files have been provided or improved thanks to: + Denis Bitouzé (French), % 2021-11-25: https://github.com/gusbrs/zref-clever/issues/1 + François Lagarde (French), % 'flagarde' + % 2021-12-09: discussion at https://github.com/gusbrs/zref-clever/issues/1 + and `\texttt{niluxv}' (Dutch). + % 2022-01-09: https://github.com/gusbrs/zref-clever/pull/5 If I have inadvertently left anyone off the list I apologize, and please let me know, so that I can correct the oversight. diff --git a/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx b/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx index ac9d81f44e6..3027bcab15e 100644 --- a/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx +++ b/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx @@ -4,7 +4,7 @@ % % This file is part of the LaTeX package "zref-clever". % -% Copyright (C) 2021 Gustavo Barros +% Copyright (C) 2021-2022 Gustavo Barros % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -63,6 +63,9 @@ % \NewDocumentCommand\githubissue{m}{^^A % issue~\href{https://github.com/gusbrs/zref-clever/issues/#1}{\##1}} % +% \NewDocumentCommand\githubPR{m}{^^A +% PR~\href{https://github.com/gusbrs/zref-clever/pull/#1}{\##1}} +% % ^^A Currently just for keeping semantic markup on this. % \NewDocumentCommand\contributor{m}{#1} % @@ -129,7 +132,7 @@ % \cs{bool_case_true:}\dots{}). We presume \pkg{xparse} (which made to the % kernel in the 2020-10-01 release), and \pkg{expl3} as well (which made to % the kernel in the 2020-02-02 release). We also just use UTF-8 for the -% dictionaries (which became the default input encoding in the 2018-04-01 +% language files (which became the default input encoding in the 2018-04-01 % release). Finally, a couple of changes came with the 2021-11-15 kernel % release, which are important here. First, a fix was made to the new hook % management system (\pkg{ltcmdhooks}), with implications to the hook we add @@ -159,7 +162,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-clever} {2021-12-07} {0.1.1-alpha} +\ProvidesExplPackage {zref-clever} {2022-01-10} {0.1.2-alpha} {Clever LaTeX cross-references based on zref} % \end{macrocode} % @@ -520,6 +523,11 @@ } \msg_new:nnn { zref-clever } { key-requires-value } { The~'#1'~key~'#2'~requires~a~value~\msg_line_context:. } +\msg_new:nnn { zref-clever } { key-boolean-or-empty } + { + The~key~'#1'~only~accepts~the~values~'true',~'false'~ + or~an~empty~value~\msg_line_context:. + } \msg_new:nnn { zref-clever } { language-declared } { Language~'#1'~is~already~declared~\msg_line_context:.~Nothing~to~do. } \msg_new:nnn { zref-clever } { unknown-language-alias } @@ -597,14 +605,15 @@ { Unknown~value~'#1'~for~'nudgeif'~option~\msg_line_context:. } \msg_new:nnn { zref-clever } { option-document-only } { Option~'#1'~is~only~available~after~\iow_char:N\\begin\{document\}. } -\msg_new:nnn { zref-clever } { dict-loaded } - { Loaded~'#1'~dictionary. } -\msg_new:nnn { zref-clever } { dict-not-available } - { Dictionary~for~'#1'~not~available~\msg_line_context:. } +\msg_new:nnn { zref-clever } { langfile-loaded } + { Loaded~'#1'~language~file. } +\msg_new:nnn { zref-clever } { langfile-not-available } + { Language~file~for~'#1'~not~available~\msg_line_context:. } \msg_new:nnn { zref-clever } { unknown-language-load } { - Language~'#1'~is~unknown~\msg_line_context:.~Unable~to~load~dictionary.~ - See~documentation~for~'\iow_char:N\\zcDeclareLanguage'~and~ + Language~'#1'~is~unknown~\msg_line_context:.~ + Unable~to~load~language~file.~See~documentation~for~ + '\iow_char:N\\zcDeclareLanguage'~and~ '\iow_char:N\\zcDeclareLanguageAlias'. } \msg_new:nnn { zref-clever } { zref-property-undefined } @@ -654,28 +663,33 @@ { Loaded~support~for~'#1'~package. } \msg_new:nnn { zref-clever } { compat-class } { Loaded~support~for~'#1'~documentclass. } +\msg_new:nnn { zref-clever } { option-deprecated } + { + Option~'#1'~has~been~deprecated~\msg_line_context:.\iow_newline: + Use~'#2'~instead. + } % \end{macrocode} % % % \subsection{Data extraction} % % -% \begin{macro}{\@@_def_extract:Nnnn} +% \begin{macro}{\@@_extract_default:Nnnn} % Extract property \meta{prop} from \meta{label} and sets variable \meta{tl % var} with extracted value. Ensure \cs{zref@extractdefault} is expanded % exactly twice, but no further to retrieve the proper value. In case the % property is not found, set \meta{tl var} with \meta{default}. % \begin{syntax} -% \cs{@@_def_extract:Nnnn} \Arg{tl val} +% \cs{@@_extract_default:Nnnn} \Arg{tl val} % ~~\Arg{label} \Arg{prop} \Arg{default} % \end{syntax} % \begin{macrocode} -\cs_new_protected:Npn \@@_def_extract:Nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_extract_default:Nnnn #1#2#3#4 { \exp_args:NNNo \exp_args:NNo \tl_set:Nn #1 { \zref@extractdefault {#2} {#3} {#4} } } -\cs_generate_variant:Nn \@@_def_extract:Nnnn { NVnn } +\cs_generate_variant:Nn \@@_extract_default:Nnnn { NVnn } % \end{macrocode} % \end{macro} % @@ -714,31 +728,32 @@ % % For a general discussion on the precedence rules for reference format % options, see Section ``Reference format'' in the User manual. Internally, -% these precedence rules are handled / enforced in \cs{@@_get_ref_string:nN}, -% \cs{@@_get_ref_font:nN}, and \cs{@@_type_name_setup:} which are the basic -% functions to retrieve proper values for reference format settings. The -% ``fallback'' settings are stored in \cs{g_@@_fallback_dict_prop}. +% these precedence rules are handled / enforced in +% \cs{@@_get_ref_opt_typeset:nN}, \cs{@@_get_ref_opt_font:nN}, and +% \cs{@@_type_name_setup:} which are the basic functions to retrieve proper +% values for reference format settings. The ``fallback'' settings are stored +% in \cs{g_@@_fallback_unknown_lang_prop}. % % % \begin{macro} % { % \l_@@_setup_type_tl , -% \l_@@_dict_language_tl , -% \l_@@_dict_decl_case_tl , -% \l_@@_dict_declension_seq , -% \l_@@_dict_gender_seq , +% \l_@@_base_language_tl , +% \l_@@_lang_decl_case_tl , +% \l_@@_lang_declension_seq , +% \l_@@_lang_gender_seq , % } % Store ``current'' type, language, and declension cases in different places -% for option and translation handling, notably in -% \cs{@@_provide_dictionary:n}, \cs{zcRefTypeSetup}, and -% \cs{zcLanguageSetup}. But also for translations retrieval, in -% \cs{@@_get_type_transl:nnnN} and \cs{@@_get_default_transl:nnN}. +% for type-specific and language-specific options handling, notably in +% \cs{@@_provide_langfile:n}, \cs{zcRefTypeSetup}, and +% \cs{zcLanguageSetup}. But also for language options retrieval, in +% \cs{@@_get_lang_opt_type:nnnN} and \cs{@@_get_lang_opt_default:nnN}. % \begin{macrocode} \tl_new:N \l_@@_setup_type_tl -\tl_new:N \l_@@_dict_language_tl -\tl_new:N \l_@@_dict_decl_case_tl -\seq_new:N \l_@@_dict_declension_seq -\seq_new:N \l_@@_dict_gender_seq +\tl_new:N \l_@@_base_language_tl +\tl_new:N \l_@@_lang_decl_case_tl +\seq_new:N \l_@@_lang_declension_seq +\seq_new:N \l_@@_lang_gender_seq % \end{macrocode} % \end{macro} % @@ -773,13 +788,13 @@ listsep , lastsep , rangesep , - refpre , - refpos , + preref , + postref , } % \end{macrocode} % Only ``type names'' are ``necessarily type-specific'', which makes them % somewhat special on the retrieval side of things. In short, they don't have -% their values queried by \cs{@@_get_ref_string:nN}, but by +% their values queried by \cs{@@_get_ref_opt_typeset:nN}, but by % \cs{@@_type_name_setup:}. % \begin{macrocode} \seq_const_from_clist:Nn @@ -830,12 +845,13 @@ % % \begin{macro}{\g_@@_languages_prop} % Stores the names of known languages and the mapping from ``language name'' -% to ``dictionary name''. Whether or not a language or alias is known to +% to ``base language name''. Whether or not a language or alias is known to % \pkg{zref-clever} is decided by its presence in this property list. A % ``base language'' (loose concept here, meaning just ``the name we gave for -% the dictionary in that particular language'') is just like any other one, -% the only difference is that the ``language name'' happens to be the same -% as the ``dictionary name'', in other words, it is an ``alias to itself''. +% the language file in that particular language'') is just like any other +% one, the only difference is that the ``language name'' happens to be the +% same as the ``base language name'', in other words, it is an ``alias to +% itself''. % \begin{macrocode} \prop_new:N \g_@@_languages_prop % \end{macrocode} @@ -844,7 +860,7 @@ % % \begin{macro}[int]{\zcDeclareLanguage} % Declare a new language for use with \pkg{zref-clever}. \meta{language} is -% taken to be both the ``language name'' and the ``dictionary name''. +% taken to be both the ``language name'' and the ``base language name''. % \oarg{options} receive a \texttt{k=v} set of options, with three valid % options. The first, \opt{declension}, takes the noun declension cases % prefixes for \meta{language} as a comma separated list, whose first @@ -856,7 +872,7 @@ % \meta{language} is already known, just warn. This implies a particular % restriction regarding \oarg{options}, namely that these options, when % defined by the package, cannot be redefined by the user. This is -% deliberate, otherwise the built-in dictionaries would become much too +% deliberate, otherwise the built-in language files would become much too % sensitive to this particular user input, and unnecessarily so. % \cs{zcDeclareLanguage} is preamble only. % \begin{syntax} @@ -872,8 +888,8 @@ { \msg_warning:nnn { zref-clever } { language-declared } {#2} } { \prop_gput:Nnn \g_@@_languages_prop {#2} {#2} - \prop_new:c { g_@@_dict_ #2 _prop } - \tl_set:Nn \l_@@_dict_language_tl {#2} + \prop_new:c { g_@@_lang_ #2 _prop } + \tl_set:Nn \l_@@_base_language_tl {#2} \keys_set:nn { zref-clever / declarelang } {#1} } } @@ -885,10 +901,10 @@ % % % \begin{macro}[int]{\zcDeclareLanguageAlias} -% Declare \meta{language alias} to be an alias of \meta{aliased language}. -% \meta{aliased language} must be already known to \pkg{zref-clever}, as -% stored in \cs{g_@@_languages_prop}. \cs{zcDeclareLanguageAlias} is -% preamble only. +% Declare \meta{language alias} to be an alias of \meta{aliased language} +% (or ``base language''). \meta{aliased language} must be already known to +% \pkg{zref-clever}, as stored in \cs{g_@@_languages_prop}. +% \cs{zcDeclareLanguageAlias} is preamble only. % \begin{syntax} % \cs{zcDeclareLanguageAlias} \marg{language alias} \marg{aliased language} % \end{syntax} @@ -918,21 +934,21 @@ declension .code:n = { \prop_gput:cnn - { g_@@_dict_ \l_@@_dict_language_tl _prop } + { g_@@_lang_ \l_@@_base_language_tl _prop } { declension } {#1} } , declension .value_required:n = true , gender .code:n = { \prop_gput:cnn - { g_@@_dict_ \l_@@_dict_language_tl _prop } + { g_@@_lang_ \l_@@_base_language_tl _prop } { gender } {#1} } , gender .value_required:n = true , allcaps .code:n = { \prop_gput:cnn - { g_@@_dict_ \l_@@_dict_language_tl _prop } + { g_@@_lang_ \l_@@_base_language_tl _prop } { allcaps } { true } } , allcaps .value_forbidden:n = true , @@ -956,7 +972,7 @@ { \exp_args:NNx \prop_get:NnNTF \g_@@_languages_prop { \l_@@_ref_language_tl } - \l_@@_dict_language_tl + \l_@@_base_language_tl { % \end{macrocode} % Validate the declension case (\opt{d}) option against the declared cases for @@ -967,16 +983,16 @@ % warning about it. % \begin{macrocode} \exp_args:NNx \seq_set_from_clist:Nn - \l_@@_dict_declension_seq + \l_@@_lang_declension_seq { \prop_item:cn { - g_@@_dict_ - \l_@@_dict_language_tl _prop + g_@@_lang_ + \l_@@_base_language_tl _prop } { declension } } - \seq_if_empty:NTF \l_@@_dict_declension_seq + \seq_if_empty:NTF \l_@@_lang_declension_seq { \tl_if_empty:NF \l_@@_ref_decl_case_tl { @@ -990,18 +1006,18 @@ { \tl_if_empty:NTF \l_@@_ref_decl_case_tl { - \seq_get_left:NN \l_@@_dict_declension_seq + \seq_get_left:NN \l_@@_lang_declension_seq \l_@@_ref_decl_case_tl } { - \seq_if_in:NVF \l_@@_dict_declension_seq + \seq_if_in:NVF \l_@@_lang_declension_seq \l_@@_ref_decl_case_tl { \msg_warning:nnxx { zref-clever } { unknown-decl-case } { \l_@@_ref_decl_case_tl } { \l_@@_ref_language_tl } - \seq_get_left:NN \l_@@_dict_declension_seq + \seq_get_left:NN \l_@@_lang_declension_seq \l_@@_ref_decl_case_tl } } @@ -1012,16 +1028,16 @@ % genders declared for the former, clear \cs{l_@@_ref_gender_tl} and warn. % \begin{macrocode} \exp_args:NNx \seq_set_from_clist:Nn - \l_@@_dict_gender_seq + \l_@@_lang_gender_seq { \prop_item:cn { - g_@@_dict_ - \l_@@_dict_language_tl _prop + g_@@_lang_ + \l_@@_base_language_tl _prop } { gender } } - \seq_if_empty:NTF \l_@@_dict_gender_seq + \seq_if_empty:NTF \l_@@_lang_gender_seq { \tl_if_empty:NF \l_@@_ref_gender_tl { @@ -1036,7 +1052,7 @@ { \tl_if_empty:NF \l_@@_ref_gender_tl { - \seq_if_in:NVF \l_@@_dict_gender_seq + \seq_if_in:NVF \l_@@_lang_gender_seq \l_@@_ref_gender_tl { \msg_warning:nnxx { zref-clever } @@ -1048,20 +1064,20 @@ } } % \end{macrocode} -% Ensure \cs{l_@@_capitalize_bool} is set to \texttt{true} when the language -% was declared with \opt{allcaps} option. +% Ensure the \opt{cap} in \cs{l_@@_ref_options_prop} is set to \texttt{true} +% when the language was declared with \opt{allcaps} option. % \begin{macrocode} \str_if_eq:eeT { \prop_item:cn { - g_@@_dict_ - \l_@@_dict_language_tl _prop + g_@@_lang_ + \l_@@_base_language_tl _prop } { allcaps } } { true } - { \bool_set_true:N \l_@@_capitalize_bool } + { \prop_put:Nnn \l_@@_ref_options_prop { cap } { true } } } { % \end{macrocode} @@ -1091,26 +1107,25 @@ % % % -% \subsection{Dictionaries} +% \subsection{Language files} % % Contrary to general options and type options, which are always \emph{local}, -% ``dictionaries'', ``translations'' or ``language-specific settings'' are -% always \emph{global}. Hence, the loading of built-in dictionaries, as well -% as settings done with \cs{zcLanguageSetup}, should set the relevant -% variables globally. -% -% The built-in dictionaries and their related infrastructure are designed to -% perform ``on the fly'' loading of dictionaries, ``lazily'' as needed. Much -% like \pkg{babel} does for languages not declared in the preamble, but used -% in the document. This offers some convenience, of course, and that's one -% reason to do it. But it also has the purpose of parsimony, of ``loading the -% least possible''. Therefore, we load at \texttt{begindocument} one single -% language (see \zcref[ref=title, noname]{sec:lang-option}), as specified by -% the user in the preamble with the \opt{lang} option or, failing any -% specification, the current language of the document, which is the default. -% Anything else is lazily loaded, on the fly, along the document. -% -% This design decision has also implications to the \emph{form} the dictionary +% language-specific settings are always \emph{global}. Hence, the loading of +% built-in language files, as well as settings done with \cs{zcLanguageSetup}, +% should set the relevant variables globally. +% +% The built-in language files and their related infrastructure are designed to +% perform ``on the fly'' loading of the language files, ``lazily'' as needed. +% Much like \pkg{babel} does for languages not declared in the preamble, but +% used in the document. This offers some convenience, of course, and that's +% one reason to do it. But it also has the purpose of parsimony, of ``loading +% the least possible''. Therefore, we load at \texttt{begindocument} one +% single language (see \zcref[ref=title, noname]{sec:lang-option}), as +% specified by the user in the preamble with the \opt{lang} option or, failing +% any specification, the current language of the document, which is the +% default. Anything else is lazily loaded, on the fly, along the document. +% +% This design decision has also implications to the \emph{form} the language % files assumed. As far as my somewhat impressionistic sampling goes, % dictionary or localization files of the most common packages in this area of % functionality, are usually a set of commands which perform the relevant @@ -1126,193 +1141,196 @@ % \file{.ini} files are not in this form, but actually resemble % ``configuration files'' of sorts, which means they are read and processed % somehow else than with just \cs{input}. So we do the more or less the same -% here. It seems a reasonable way to ensure we can load dictionaries on the +% here. It seems a reasonable way to ensure we can load language files on the % fly robustly mid-document, without getting paranoid with the last bit of % white-space in them, and without introducing any undue content on the stream % when we cannot afford to do it. Hence, \pkg{zref-clever}'s built-in -% dictionary files are a set of \emph{key-value options} which are read from -% the file, and fed to \texttt{\cs{keys_set:nn}\{zref-clever/dictionary\}} by -% \cs{@@_provide_dictionary:n}. And they use the same syntax and options as -% \cs{zcLanguageSetup} does. The dictionary file itself is read with +% language files are a set of \emph{key-value options} which are read from the +% file, and fed to \texttt{\cs{keys_set:nn}\{zref-clever/langfile\}} by +% \cs{@@_provide_langfile:n}. And they use the same syntax and options as +% \cs{zcLanguageSetup} does. The language file itself is read with % \cs{ExplSyntaxOn} with the usual implications for white-space and catcodes. % -% \cs{@@_provide_dictionary:n} is only meant to load the built-in -% dictionaries. For languages declared by the user, or for any settings to a -% known language made with \cs{zcLanguageSetup}, values are populated directly -% to a variable \cs{g_@@_dict_\meta{language}_prop}. Hence, there is no need -% to ``load'' anything in this case: definitions and assignments made by the -% user are performed immediately. +% \cs{@@_provide_langfile:n} is only meant to load the built-in language +% files. For languages declared by the user, or for any settings to a known +% language made with \cs{zcLanguageSetup}, values are populated directly to a +% variable \cs{g_@@_lang_\meta{language}_prop}. Hence, there is no need to +% ``load'' anything in this case: definitions and assignments made by the user +% are performed immediately. % % % \subsubsection*{Provide} % -% \begin{macro}{\g_@@_loaded_dictionaries_seq} -% Used to keep track of whether a dictionary has already been loaded or not. +% \begin{macro}{\g_@@_loaded_langfiles_seq} +% Used to keep track of whether a language file has already been loaded or +% not. % \begin{macrocode} -\seq_new:N \g_@@_loaded_dictionaries_seq +\seq_new:N \g_@@_loaded_langfiles_seq % \end{macrocode} % \end{macro} % -% \begin{macro}{\l_@@_load_dict_verbose_bool} -% Controls whether \cs{@@_provide_dictionary:n} fails silently or verbosely -% in case of unknown languages or dictionaries not found. +% \begin{macro}{\l_@@_load_langfile_verbose_bool} +% Controls whether \cs{@@_provide_langfile:n} fails silently or verbosely +% in case of unknown languages or not found language files. % \begin{macrocode} -\bool_new:N \l_@@_load_dict_verbose_bool +\bool_new:N \l_@@_load_langfile_verbose_bool % \end{macrocode} % \end{macro} % % -% \begin{macro}{\@@_provide_dictionary:n} -% Load dictionary for known \meta{language} if it is available and if it has -% not already been loaded. +% \begin{macro}{\@@_provide_langfile:n} +% Load language file for known \meta{language} if it is available and if it +% has not already been loaded. % \begin{syntax} -% \cs{@@_provide_dictionary:n} \Arg{language} +% \cs{@@_provide_langfile:n} \Arg{language} % \end{syntax} % \begin{macrocode} -\cs_new_protected:Npn \@@_provide_dictionary:n #1 +\cs_new_protected:Npn \@@_provide_langfile:n #1 { \group_begin: \@bsphack \prop_get:NnNTF \g_@@_languages_prop {#1} - \l_@@_dict_language_tl + \l_@@_base_language_tl { \seq_if_in:NVF - \g_@@_loaded_dictionaries_seq - \l_@@_dict_language_tl + \g_@@_loaded_langfiles_seq + \l_@@_base_language_tl { \exp_args:Nx \file_get:nnNTF - { zref-clever- \l_@@_dict_language_tl .dict } + { zref-clever- \l_@@_base_language_tl .lang } { \ExplSyntaxOn } \l_tmpa_tl { \tl_clear:N \l_@@_setup_type_tl \exp_args:NNx \seq_set_from_clist:Nn - \l_@@_dict_declension_seq + \l_@@_lang_declension_seq { \prop_item:cn { - g_@@_dict_ - \l_@@_dict_language_tl _prop + g_@@_lang_ + \l_@@_base_language_tl _prop } { declension } } - \seq_if_empty:NTF \l_@@_dict_declension_seq - { \tl_clear:N \l_@@_dict_decl_case_tl } + \seq_if_empty:NTF \l_@@_lang_declension_seq + { \tl_clear:N \l_@@_lang_decl_case_tl } { - \seq_get_left:NN \l_@@_dict_declension_seq - \l_@@_dict_decl_case_tl + \seq_get_left:NN \l_@@_lang_declension_seq + \l_@@_lang_decl_case_tl } \exp_args:NNx \seq_set_from_clist:Nn - \l_@@_dict_gender_seq + \l_@@_lang_gender_seq { \prop_item:cn { - g_@@_dict_ - \l_@@_dict_language_tl _prop + g_@@_lang_ + \l_@@_base_language_tl _prop } { gender } } - \keys_set:nV { zref-clever / dictionary } \l_tmpa_tl - \seq_gput_right:NV \g_@@_loaded_dictionaries_seq - \l_@@_dict_language_tl - \msg_note:nnx { zref-clever } { dict-loaded } - { \l_@@_dict_language_tl } + \keys_set:nV { zref-clever / langfile } \l_tmpa_tl + \seq_gput_right:NV \g_@@_loaded_langfiles_seq + \l_@@_base_language_tl + \msg_note:nnx { zref-clever } { langfile-loaded } + { \l_@@_base_language_tl } } { - \bool_if:NT \l_@@_load_dict_verbose_bool + \bool_if:NT \l_@@_load_langfile_verbose_bool { - \msg_warning:nnx { zref-clever } { dict-not-available } - { \l_@@_dict_language_tl } + \msg_warning:nnx { zref-clever } { langfile-not-available } + { \l_@@_base_language_tl } } % \end{macrocode} -% Even if we don't have the actual dictionary, we register it as ``loaded''. -% At this point, it is a known language, properly declared. There is no point -% in trying to load it multiple times, because users cannot really provide the -% dictionary files (well, technically they could, but we are working so they -% don't need to, and have better ways to do what they want). And if the users -% had provided some translations themselves, by means of \cs{zcLanguageSetup}, -% everything would be in place, and they could use the \opt{lang} option -% multiple times, and the \texttt{dict-not-available} warning would never go -% away. -% \begin{macrocode} - \seq_gput_right:NV \g_@@_loaded_dictionaries_seq - \l_@@_dict_language_tl +% Even if we don't have the actual language file, we register it as +% ``loaded''. At this point, it is a known language, properly declared. +% There is no point in trying to load it multiple times, because users cannot +% really provide the language files (well, technically they could, but we are +% working so they don't need to, and have better ways to do what they want). +% And if the users had provided some language-specific options themselves, by +% means of \cs{zcLanguageSetup}, everything would be in place, and they could +% use the \opt{lang} option multiple times, and the +% \texttt{langfile-not-available} warning would never go away. +% \begin{macrocode} + \seq_gput_right:NV \g_@@_loaded_langfiles_seq + \l_@@_base_language_tl } } } { - \bool_if:NT \l_@@_load_dict_verbose_bool + \bool_if:NT \l_@@_load_langfile_verbose_bool { \msg_warning:nnn { zref-clever } { unknown-language-load } {#1} } } \@esphack \group_end: } -\cs_generate_variant:Nn \@@_provide_dictionary:n { x } +\cs_generate_variant:Nn \@@_provide_langfile:n { x } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\@@_provide_dictionary_verbose:n} -% Does the same as \cs{@@_provide_dictionary:n}, but warns if the loading of -% the dictionary has failed. +% \begin{macro}{\@@_provide_langfile_verbose:n} +% Does the same as \cs{@@_provide_langfile:n}, but warns if the loading of +% the language file has failed. % \begin{syntax} -% \cs{@@_provide_dictionary_verbose:n} \Arg{language} +% \cs{@@_provide_langfile_verbose:n} \Arg{language} % \end{syntax} % \begin{macrocode} -\cs_new_protected:Npn \@@_provide_dictionary_verbose:n #1 +\cs_new_protected:Npn \@@_provide_langfile_verbose:n #1 { \group_begin: - \bool_set_true:N \l_@@_load_dict_verbose_bool - \@@_provide_dictionary:n {#1} + \bool_set_true:N \l_@@_load_langfile_verbose_bool + \@@_provide_langfile:n {#1} \group_end: } -\cs_generate_variant:Nn \@@_provide_dictionary_verbose:n { x } +\cs_generate_variant:Nn \@@_provide_langfile_verbose:n { x } % \end{macrocode} % \end{macro} % % % \begin{macro} % { -% \@@_provide_dict_type_transl:nn , -% \@@_provide_dict_default_transl:nn , +% \@@_provide_lang_opt_type:nn , +% \@@_provide_lang_opt_default:nn , % } % A couple of auxiliary functions for the of -% \texttt{{zref-clever/dictionary}} keys set in -% \cs{@@_provide_dictionary:n}. They respectively ``provide'' (i.e. set if +% \texttt{{zref-clever/langfile}} keys set in +% \cs{@@_provide_langfile:n}. They respectively ``provide'' (i.e. set if % it value does not exist, do nothing if it already does) ``type-specific'' -% and ``default'' translations. Both receive \meta{key} and -% \meta{translation} as arguments, but \cs{@@_provide_dict_type_transl:nn} +% and ``default'' language options. Both receive \meta{key} and +% \meta{value} as arguments, but \cs{@@_provide_lang_opt_type:nn} % relies on the current value of \cs{l_@@_setup_type_tl}, as set by the % \texttt{type} key. % \begin{syntax} -% \cs{@@_provide_dict_type_transl:nn} \Arg{key} \Arg{translation} -% \cs{@@_provide_dict_default_transl:nn} \Arg{key} \Arg{translation} +% \cs{@@_provide_lang_opt_type:nn} \Arg{key} \Arg{value} +% \cs{@@_provide_lang_opt_default:nn} \Arg{key} \Arg{value} % \end{syntax} % \begin{macrocode} -\cs_new_protected:Npn \@@_provide_dict_type_transl:nn #1#2 +\cs_new_protected:Npn \@@_provide_lang_opt_type:nn #1#2 { \exp_args:Nnx \prop_gput_if_new:cnn - { g_@@_dict_ \l_@@_dict_language_tl _prop } + { g_@@_lang_ \l_@@_base_language_tl _prop } { type- \l_@@_setup_type_tl - #1 } {#2} } -\cs_new_protected:Npn \@@_provide_dict_default_transl:nn #1#2 +\cs_generate_variant:Nn \@@_provide_lang_opt_type:nn { nV } +\cs_new_protected:Npn \@@_provide_lang_opt_default:nn #1#2 { \prop_gput_if_new:cnn - { g_@@_dict_ \l_@@_dict_language_tl _prop } + { g_@@_lang_ \l_@@_base_language_tl _prop } { default- #1 } {#2} } +\cs_generate_variant:Nn \@@_provide_lang_opt_default:nn { nV } % \end{macrocode} % \end{macro} % % -% The set of keys for \texttt{{zref-clever/dictionary}}, which is used to -% process the dictionary files in \cs{@@_provide_dictionary:n}. The no-op -% cases for each category have their messages sent to ``info''. These -% messages should not occur, as long as the dictionaries are well formed, but -% they're placed there nevertheless, and can be leveraged in regression tests. +% The set of keys for \texttt{{zref-clever/langfile}}, which is used to +% process the language files in \cs{@@_provide_langfile:n}. The no-op cases +% for each category have their messages sent to ``info''. These messages +% should not occur, as long as the language files are well formed, but they're +% placed there nevertheless, and can be leveraged in regression tests. % % \begin{macrocode} -\keys_define:nn { zref-clever / dictionary } +\keys_define:nn { zref-clever / langfile } { type .code:n = { @@ -1320,31 +1338,33 @@ { \tl_clear:N \l_@@_setup_type_tl } { \tl_set:Nn \l_@@_setup_type_tl {#1} } } , + case .code:n = { - \seq_if_empty:NTF \l_@@_dict_declension_seq + \seq_if_empty:NTF \l_@@_lang_declension_seq { \msg_info:nnxx { zref-clever } { language-no-decl-setup } - { \l_@@_dict_language_tl } {#1} + { \l_@@_base_language_tl } {#1} } { - \seq_if_in:NnTF \l_@@_dict_declension_seq {#1} - { \tl_set:Nn \l_@@_dict_decl_case_tl {#1} } + \seq_if_in:NnTF \l_@@_lang_declension_seq {#1} + { \tl_set:Nn \l_@@_lang_decl_case_tl {#1} } { \msg_info:nnxx { zref-clever } { unknown-decl-case } - {#1} { \l_@@_dict_language_tl } - \seq_get_left:NN \l_@@_dict_declension_seq - \l_@@_dict_decl_case_tl + {#1} { \l_@@_base_language_tl } + \seq_get_left:NN \l_@@_lang_declension_seq + \l_@@_lang_decl_case_tl } } } , case .value_required:n = true , + gender .code:n = { - \seq_if_empty:NTF \l_@@_dict_gender_seq + \seq_if_empty:NTF \l_@@_lang_gender_seq { \msg_info:nnxxx { zref-clever } { language-no-gender } - { \l_@@_dict_language_tl } { gender } {#1} + { \l_@@_base_language_tl } { gender } {#1} } { \tl_if_empty:NTF \l_@@_setup_type_tl @@ -1353,27 +1373,71 @@ { option-only-type-specific } { gender } } { - \seq_if_in:NnTF \l_@@_dict_gender_seq {#1} - { \@@_provide_dict_type_transl:nn { gender } {#1} } + \clist_clear:N \l_tmpa_clist + \clist_map_inline:nn {#1} + { + \seq_if_in:NnTF \l_@@_lang_gender_seq {##1} + { \clist_put_right:Nn \l_tmpa_clist {##1} } + { + \msg_info:nnxx { zref-clever } + { gender-not-declared } + { \l_@@_base_language_tl } {##1} + } + } + \clist_if_empty:NF \l_tmpa_clist { - \msg_info:nnxx { zref-clever } { gender-not-declared } - { \l_@@_dict_language_tl } {#1} + \exp_args:Nnx \@@_provide_lang_opt_type:nn + { gender } { \clist_use:Nn \l_tmpa_clist { , } } } } } } , gender .value_required:n = true , + + cap .choices:nn = + { true , false } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_provide_lang_opt_default:nV + { cap } \l_keys_choice_tl + } + { + \@@_provide_lang_opt_type:nV + { cap } \l_keys_choice_tl + } + } , + cap .default:n = true , + nocap .meta:n = { cap = false } , + nocap .value_forbidden:n = true , + + abbrev .choices:nn = + { true , false } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_provide_lang_opt_default:nV + { abbrev } \l_keys_choice_tl + } + { + \@@_provide_lang_opt_type:nV + { abbrev } \l_keys_choice_tl + } + } , + abbrev .default:n = true , + noabbrev .meta:n = { abbrev = false }, + noabbrev .value_forbidden:n = true , } \seq_map_inline:Nn \c_@@_ref_options_necessarily_not_type_specific_seq { - \keys_define:nn { zref-clever / dictionary } + \keys_define:nn { zref-clever / langfile } { #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl - { \@@_provide_dict_default_transl:nn {#1} {##1} } + { \@@_provide_lang_opt_default:nn {#1} {##1} } { \msg_info:nnn { zref-clever } { option-not-type-specific } {#1} @@ -1384,21 +1448,21 @@ \seq_map_inline:Nn \c_@@_ref_options_possibly_type_specific_seq { - \keys_define:nn { zref-clever / dictionary } + \keys_define:nn { zref-clever / langfile } { #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl - { \@@_provide_dict_default_transl:nn {#1} {##1} } - { \@@_provide_dict_type_transl:nn {#1} {##1} } + { \@@_provide_lang_opt_default:nn {#1} {##1} } + { \@@_provide_lang_opt_type:nn {#1} {##1} } } , } } \seq_map_inline:Nn \c_@@_ref_options_type_names_seq { - \keys_define:nn { zref-clever / dictionary } + \keys_define:nn { zref-clever / langfile } { #1 .value_required:n = true , #1 .code:n = @@ -1409,11 +1473,11 @@ { option-only-type-specific } {#1} } { - \tl_if_empty:NTF \l_@@_dict_decl_case_tl - { \@@_provide_dict_type_transl:nn {#1} {##1} } + \tl_if_empty:NTF \l_@@_lang_decl_case_tl + { \@@_provide_lang_opt_type:nn {#1} {##1} } { - \@@_provide_dict_type_transl:nn - { \l_@@_dict_decl_case_tl - #1 } {##1} + \@@_provide_lang_opt_type:nn + { \l_@@_lang_decl_case_tl - #1 } {##1} } } } , @@ -1425,22 +1489,22 @@ % % \subsubsection*{Fallback} % -% All ``strings'' queried with \cs{@@_get_ref_string:nN} -- in practice, those -% in either \cs{c_@@_ref_options_necessarily_not_type_specific_seq} or +% All ``strings'' queried with \cs{@@_get_ref_opt_typeset:nN} -- in practice, +% those in either \cs{c_@@_ref_options_necessarily_not_type_specific_seq} or % \cs{c_@@_ref_options_possibly_type_specific_seq} -- must have their values % set for ``fallback'', even if to empty ones, since this is what will be -% retrieved in the absence of a proper translation, which will be the case if -% \pkg{babel} or \pkg{polyglossia} is loaded and sets a language which -% \pkg{zref-clever} does not know. On the other hand, ``type names'' are not -% looked for in ``fallback'', since it is indeed impossible to provide any -% reasonable value for them for a ``specified but unknown language''. Also -% ``font'' options -- those in \cs{c_@@_ref_options_font_seq}, and queried -% with \cs{@@_get_ref_font:nN} -- do not need to be provided here, since the -% later function sets an empty value if the option is not found. +% retrieved in the absence of a proper language-specific option, which will be +% the case if \pkg{babel} or \pkg{polyglossia} is loaded and sets a language +% which \pkg{zref-clever} does not know. On the other hand, ``type names'' +% are not looked for in ``fallback'', since it is indeed impossible to provide +% any reasonable value for them for a ``specified but unknown language''. +% Also ``font'' options -- those in \cs{c_@@_ref_options_font_seq}, and +% queried with \cs{@@_get_ref_opt_font:nN} -- do not need to be provided here, +% since the later function sets an empty value if the option is not found. % % \begin{macrocode} -\prop_new:N \g_@@_fallback_dict_prop -\prop_gset_from_keyval:Nn \g_@@_fallback_dict_prop +\prop_new:N \g_@@_fallback_unknown_lang_prop +\prop_gset_from_keyval:Nn \g_@@_fallback_unknown_lang_prop { tpairsep = {,~} , tlistsep = {,~} , @@ -1451,33 +1515,33 @@ listsep = {,~} , lastsep = {,~} , rangesep = {\textendash} , - refpre = {} , - refpos = {} , + preref = {} , + postref = {} , } % \end{macrocode} % % % -% \subsubsection*{Get translations} +% \subsubsection*{Get language options} % -% \begin{macro}{\@@_get_type_transl:nnnNF} -% Get type-specific translation of \meta{key} for \meta{type} and +% \begin{macro}{\@@_get_lang_opt_type:nnnNF} +% Get type-specific language option of \meta{key} for \meta{type} and % \meta{language}, and store it in \meta{tl variable} if found. If not % found, leave the \meta{false code} on the stream, in which case the value % of \meta{tl variable} should not be relied upon. % \begin{syntax} -% \cs{@@_get_type_transl:nnnNF} \Arg{language} \Arg{type} \Arg{key} +% \cs{@@_get_lang_opt_type:nnnNF} \Arg{language} \Arg{type} \Arg{key} % ~~\meta{tl variable} \Arg{false code} % \end{syntax} % \begin{macrocode} \prg_new_protected_conditional:Npnn - \@@_get_type_transl:nnnN #1#2#3#4 { F } + \@@_get_lang_opt_type:nnnN #1#2#3#4 { F } { \prop_get:NnNTF \g_@@_languages_prop {#1} - \l_@@_dict_language_tl + \l_@@_base_language_tl { \prop_get:cnNTF - { g_@@_dict_ \l_@@_dict_language_tl _prop } + { g_@@_lang_ \l_@@_base_language_tl _prop } { type- #2 - #3 } #4 { \prg_return_true: } { \prg_return_false: } @@ -1485,29 +1549,29 @@ { \prg_return_false: } } \prg_generate_conditional_variant:Nnn - \@@_get_type_transl:nnnN { xxxN , xxnN } { F } + \@@_get_lang_opt_type:nnnN { xxxN , xxnN } { F } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\@@_get_default_transl:nnNF} -% Get default translation of \meta{key} for \meta{language}, and store it in -% \meta{tl variable} if found. If not found, leave the \meta{false code} on -% the stream, in which case the value of \meta{tl variable} should not be -% relied upon. +% \begin{macro}{\@@_get_lang_opt_default:nnNF} +% Get default language option of \meta{key} for \meta{language}, and store +% it in \meta{tl variable} if found. If not found, leave the \meta{false +% code} on the stream, in which case the value of \meta{tl variable} should +% not be relied upon. % \begin{syntax} -% \cs{@@_get_default_transl:nnNF} \Arg{language} \Arg{key} +% \cs{@@_get_lang_opt_default:nnNF} \Arg{language} \Arg{key} % ~~\meta{tl variable} \Arg{false code} % \end{syntax} % \begin{macrocode} \prg_new_protected_conditional:Npnn - \@@_get_default_transl:nnN #1#2#3 { F } + \@@_get_lang_opt_default:nnN #1#2#3 { F } { \prop_get:NnNTF \g_@@_languages_prop {#1} - \l_@@_dict_language_tl + \l_@@_base_language_tl { \prop_get:cnNTF - { g_@@_dict_ \l_@@_dict_language_tl _prop } + { g_@@_lang_ \l_@@_base_language_tl _prop } { default- #2 } #3 { \prg_return_true: } { \prg_return_false: } @@ -1515,25 +1579,26 @@ { \prg_return_false: } } \prg_generate_conditional_variant:Nnn - \@@_get_default_transl:nnN { xnN } { F } + \@@_get_lang_opt_default:nnN { xnN } { F } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\@@_get_fallback_transl:nNF} -% Get fallback translation of \meta{key}, and store it in \meta{tl variable} -% if found. If not found, leave the \meta{false code} on the stream, in -% which case the value of \meta{tl variable} should not be relied upon. +% \begin{macro}{\@@_get_fallback_unknown_lang_opt:nNF} +% Get fallback language option of \meta{key}, and store it in \meta{tl +% variable} if found. If not found, leave the \meta{false code} on the +% stream, in which case the value of \meta{tl variable} should not be relied +% upon. % \begin{syntax} -% \cs{@@_get_fallback_transl:nNF} \Arg{key} +% \cs{@@_get_fallback_unknown_lang_opt:nNF} \Arg{key} % ~~\meta{tl variable} \Arg{false code} % \end{syntax} % \begin{macrocode} % {<key>}<tl var to set> \prg_new_protected_conditional:Npnn - \@@_get_fallback_transl:nN #1#2 { F } + \@@_get_fallback_unknown_lang_opt:nN #1#2 { F } { - \prop_get:NnNTF \g_@@_fallback_dict_prop + \prop_get:NnNTF \g_@@_fallback_unknown_lang_prop { #1 } #2 { \prg_return_true: } { \prg_return_false: } @@ -1712,14 +1777,26 @@ % \subsubsection*{\opt{cap} and \opt{capfirst} options} % % \begin{macrocode} -\bool_new:N \l_@@_capitalize_bool \bool_new:N \l_@@_capitalize_first_bool \keys_define:nn { zref-clever / reference } { - cap .bool_set:N = \l_@@_capitalize_bool , - cap .initial:n = false , + cap .code:n = + { + \tl_if_empty:nTF {#1} + { \prop_remove:Nn \l_@@_ref_options_prop { cap } } + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#1} { true } } + { \str_if_eq_p:nn {#1} { false } } + { \prop_put:Nnn \l_@@_ref_options_prop { cap } {#1} } + { + \msg_warning:nnn { zref-clever } + { key-boolean-or-empty } {#1} + } + } + } , cap .default:n = true , - nocap .meta:n = { cap = false }, + nocap .meta:n = { cap = false } , nocap .value_forbidden:n = true , capfirst .bool_set:N = \l_@@_capitalize_first_bool , @@ -1732,12 +1809,24 @@ % \subsubsection*{\opt{abbrev} and \opt{noabbrevfirst} options} % % \begin{macrocode} -\bool_new:N \l_@@_abbrev_bool \bool_new:N \l_@@_noabbrev_first_bool \keys_define:nn { zref-clever / reference } { - abbrev .bool_set:N = \l_@@_abbrev_bool , - abbrev .initial:n = false , + abbrev .code:n = + { + \tl_if_empty:nTF {#1} + { \prop_remove:Nn \l_@@_ref_options_prop { abbrev } } + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#1} { true } } + { \str_if_eq_p:nn {#1} { false } } + { \prop_put:Nnn \l_@@_ref_options_prop { abbrev } {#1} } + { + \msg_warning:nnn { zref-clever } + { key-boolean-or-empty } {#1} + } + } + } , abbrev .default:n = true , noabbrev .meta:n = { abbrev = false }, noabbrev .value_forbidden:n = true , @@ -1871,8 +1960,8 @@ % executed. Finally, we set a third \texttt{begindocument} hook, at % \texttt{begindocument/before}, so that it runs after any options set in the % preamble. This hook redefines the \opt{lang} option for immediate execution -% in the document body, and ensures the \texttt{current} language's dictionary -% gets loaded, if it hadn't been already. +% in the document body, and ensures the \texttt{current} language's language +% file gets loaded, if it hadn't been already. % % For the \pkg{babel} and \pkg{polyglossia} variables which store the % ``current'' and ``main'' languages, see @@ -1911,9 +2000,9 @@ % Provide default value for \cs{l_@@_ref_language_tl} corresponding to option % \opt{current}, but do so outside of the \pkg{l3keys} machinery (that is, % instead of using \texttt{.initial:n}), so that we are able to distinguish -% when the user actually gave the option, in which case the dictionary loading -% is done verbosely, from when we are setting the default value (here), in -% which case the dictionary loading is done silently. +% when the user actually gave the option, in which case the language file +% loading is done verbosely, from when we are setting the default value +% (here), in which case the language file loading is done silently. % \begin{macrocode} \tl_set:Nn \l_@@_ref_language_tl { \l_@@_current_language_tl } @@ -1934,7 +2023,7 @@ { \tl_set:Nn \l_@@_ref_language_tl { \l_@@_current_language_tl } - \@@_provide_dictionary_verbose:x + \@@_provide_langfile_verbose:x { \l_@@_ref_language_tl } } @@ -1942,7 +2031,7 @@ { \tl_set:Nn \l_@@_ref_language_tl { \l_@@_main_language_tl } - \@@_provide_dictionary_verbose:x + \@@_provide_langfile_verbose:x { \l_@@_ref_language_tl } } } @@ -1955,7 +2044,7 @@ \tl_set:Nn \l_@@_ref_language_tl { \l_@@_current_language_tl } } - \@@_provide_dictionary_verbose:x + \@@_provide_langfile_verbose:x { \l_@@_ref_language_tl } } } @@ -1975,12 +2064,12 @@ % language is already loaded, otherwise, ensure the default one % (\texttt{current}) gets loaded early, but not verbosely. % \begin{macrocode} - \@@_provide_dictionary:x { \l_@@_ref_language_tl } + \@@_provide_langfile:x { \l_@@_ref_language_tl } % \end{macrocode} % Redefinition of the \texttt{lang} key option for the document body. Also, -% drop the verbose dictionary loading in the document body, as it can become -% intrusive depending on the use case, and does not provide much ``juice'' -% anyway: in \cs{zcref} missing names warnings will already ensue. +% drop the verbose language file loading in the document body, as it can +% become intrusive depending on the use case, and does not provide much +% ``juice'' anyway: in \cs{zcref} missing names warnings will already ensue. % \begin{macrocode} \keys_define:nn { zref-clever / reference } { @@ -1992,7 +2081,7 @@ { \tl_set:Nn \l_@@_ref_language_tl { \l_@@_current_language_tl } - \@@_provide_dictionary:x + \@@_provide_langfile:x { \l_@@_ref_language_tl } } @@ -2000,7 +2089,7 @@ { \tl_set:Nn \l_@@_ref_language_tl { \l_@@_main_language_tl } - \@@_provide_dictionary:x + \@@_provide_langfile:x { \l_@@_ref_language_tl } } } @@ -2013,7 +2102,7 @@ \tl_set:Nn \l_@@_ref_language_tl { \l_@@_current_language_tl } } - \@@_provide_dictionary:x + \@@_provide_langfile:x { \l_@@_ref_language_tl } } } , @@ -2480,8 +2569,8 @@ % ``not necessarily type-specific'' options are pertinent here. However, they % \emph{may} either be type-specific or language-specific, and thus must be % stored in a property list, \cs{l_@@_ref_options_prop}, in order to be -% retrieved from the option \emph{name} by \cs{@@_get_ref_string:nN} and -% \cs{@@_get_ref_font:nN} according to context and precedence rules. +% retrieved from the option \emph{name} by \cs{@@_get_ref_opt_typeset:nN} and +% \cs{@@_get_ref_opt_font:nN} according to context and precedence rules. % % The keys are set so that any value, including an empty one, is added to % \cs{l_@@_ref_options_prop}, while a key with \emph{no value} removes the @@ -2505,6 +2594,21 @@ } , } } +\keys_define:nn { zref-clever / reference } + { + refpre .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpre } { preref } + } , + refpos .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpos } { postref } + } , + } % \end{macrocode} % % @@ -2573,13 +2677,12 @@ % % \cs{zcRefTypeSetup} is the main user interface for ``type-specific'' % reference formatting. Settings done by this command have a higher -% precedence than any translation, hence they override any language-specific -% setting, either done at \cs{zcLanguageSetup} or by the package's -% dictionaries. On the other hand, they have a lower precedence than non -% type-specific general options. The \meta{options} should be given in the -% usual \texttt{key=val} format. The \meta{type} does not need to pre-exist, -% the property list variable to store the properties for the type gets created -% if need be. +% precedence than any language-specific setting, either done at +% \cs{zcLanguageSetup} or by the package's language files. On the other hand, +% they have a lower precedence than non type-specific general options. The +% \meta{options} should be given in the usual \texttt{key=val} format. The +% \meta{type} does not need to pre-exist, the property list variable to store +% the properties for the type gets created if need be. % % \begin{macro}[int]{\zcRefTypeSetup} % \begin{syntax} @@ -2599,14 +2702,14 @@ % % Inside \cs{zcRefTypeSetup} any of the options \emph{can} receive empty % values, and those values, if they exist in the property list, will override -% translations, regardless of their emptiness. In principle, we could live -% with the situation of, once a setting has been made in +% language-specific options, regardless of their emptiness. In principle, we +% could live with the situation of, once a setting has been made in % \cs{l_@@_type_<type>_options_prop} or in \cs{l_@@_ref_options_prop} it stays % there forever, and can only be overridden by a new value at the same % precedence level or a higher one. But it would be nice if an user can % ``unset'' an option at either of those scopes to go back to the lower -% precedence level of the translations at any given point. So both in -% \cs{zcRefTypeSetup} and in setting reference options (see +% precedence level of the language-specific options at any given point. So +% both in \cs{zcRefTypeSetup} and in setting reference options (see % \zcref{sec:reference-options}), we leverage the distinction of an ``empty % valued key'' (\texttt{key=} or \texttt{key=\{\}}) from a ``key with no % value'' (\texttt{key}). This distinction is captured internally by the @@ -2618,6 +2721,79 @@ % \url{https://tex.stackexchange.com/q/614690} and % \url{https://github.com/latex3/latex3/pull/988}. % +% +% \begin{macrocode} +\keys_define:nn { zref-clever / typesetup } + { + cap .code:n = + { + \tl_if_empty:nTF {#1} + { + \prop_remove:cn + { + l_@@_type_ + \l_@@_setup_type_tl _options_prop + } + { cap } + } + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#1} { true } } + { \str_if_eq_p:nn {#1} { false } } + { + \prop_put:cnn + { + l_@@_type_ + \l_@@_setup_type_tl _options_prop + } + { cap } {#1} + } + { + \msg_warning:nnn { zref-clever } + { key-boolean-or-empty } {#1} + } + } + } , + cap .default:n = true , + nocap .meta:n = { cap = false } , + nocap .value_forbidden:n = true , + + abbrev .code:n = + { + \tl_if_empty:nTF {#1} + { + \prop_remove:cn + { + l_@@_type_ + \l_@@_setup_type_tl _options_prop + } + { abbrev } + } + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#1} { true } } + { \str_if_eq_p:nn {#1} { false } } + { + \prop_put:cnn + { + l_@@_type_ + \l_@@_setup_type_tl _options_prop + } + { abbrev } {#1} + } + { + \msg_warning:nnn { zref-clever } + { key-boolean-or-empty } {#1} + } + } + } , + abbrev .default:n = true , + noabbrev .meta:n = { abbrev = false }, + noabbrev .value_forbidden:n = true , + } +% \end{macrocode} +% +% % \begin{macrocode} \seq_map_inline:Nn \c_@@_ref_options_necessarily_not_type_specific_seq @@ -2663,6 +2839,21 @@ } , } } +\keys_define:nn { zref-clever / typesetup } + { + refpre .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpre } { preref } + } , + refpos .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpos } { postref } + } , + } % \end{macrocode} % % @@ -2674,9 +2865,9 @@ % between the two cases is captured by the \texttt{type} key, which works as a % sort of a ``switch''. Inside the \meta{options} argument of % \cs{zcLanguageSetup}, any options made before the first \texttt{type} key -% declare ``default'' (non type-specific) translations. When the +% declare ``default'' (non type-specific) language options. When the % \texttt{type} key is given with a value, the options following it will set -% ``type-specific'' translations for that type. The current type can be +% ``type-specific'' language options for that type. The current type can be % switched off by an empty \texttt{type} key. \cs{zcLanguageSetup} is % preamble only. % @@ -2689,32 +2880,32 @@ { \group_begin: \prop_get:NnNTF \g_@@_languages_prop {#1} - \l_@@_dict_language_tl + \l_@@_base_language_tl { \tl_clear:N \l_@@_setup_type_tl \exp_args:NNx \seq_set_from_clist:Nn - \l_@@_dict_declension_seq + \l_@@_lang_declension_seq { \prop_item:cn { - g_@@_dict_ - \l_@@_dict_language_tl _prop + g_@@_lang_ + \l_@@_base_language_tl _prop } { declension } } - \seq_if_empty:NTF \l_@@_dict_declension_seq - { \tl_clear:N \l_@@_dict_decl_case_tl } + \seq_if_empty:NTF \l_@@_lang_declension_seq + { \tl_clear:N \l_@@_lang_decl_case_tl } { - \seq_get_left:NN \l_@@_dict_declension_seq - \l_@@_dict_decl_case_tl + \seq_get_left:NN \l_@@_lang_declension_seq + \l_@@_lang_decl_case_tl } \exp_args:NNx \seq_set_from_clist:Nn - \l_@@_dict_gender_seq + \l_@@_lang_gender_seq { \prop_item:cn { - g_@@_dict_ - \l_@@_dict_language_tl _prop + g_@@_lang_ + \l_@@_base_language_tl _prop } { gender } } @@ -2730,38 +2921,39 @@ % % \begin{macro} % { -% \@@_declare_type_transl:nnnn , -% \@@_declare_default_transl:nnn , +% \@@_declare_lang_opt_type:nnnn , +% \@@_declare_lang_opt_default:nnn , % } % A couple of auxiliary functions for the of -% \texttt{{zref-clever/translation}} keys set in \cs{zcLanguageSetup}. They +% \texttt{{zref-clever/langsetup}} keys set in \cs{zcLanguageSetup}. They % respectively declare (unconditionally set) ``type-specific'' and -% ``default'' translations. +% ``default'' language-specific options. % \begin{syntax} -% \cs{@@_declare_type_transl:nnnn} \Arg{language} \Arg{type} -% ~~\Arg{key} \Arg{translation} -% \cs{@@_declare_default_transl:nnn} \Arg{language} -% ~~\Arg{key} \Arg{translation} +% \cs{@@_declare_lang_opt_type:nnnn} \Arg{language} \Arg{type} +% ~~\Arg{key} \Arg{value} +% \cs{@@_declare_lang_opt_default:nnn} \Arg{language} +% ~~\Arg{key} \Arg{value} % \end{syntax} % \begin{macrocode} -\cs_new_protected:Npn \@@_declare_type_transl:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_declare_lang_opt_type:nnnn #1#2#3#4 { - \prop_gput:cnn { g_@@_dict_ #1 _prop } + \prop_gput:cnn { g_@@_lang_ #1 _prop } { type- #2 - #3 } {#4} } -\cs_generate_variant:Nn \@@_declare_type_transl:nnnn { VVnn , VVxn } -\cs_new_protected:Npn \@@_declare_default_transl:nnn #1#2#3 +\cs_generate_variant:Nn + \@@_declare_lang_opt_type:nnnn { VVnn , VVxn , VVnx , VVnV } +\cs_new_protected:Npn \@@_declare_lang_opt_default:nnn #1#2#3 { - \prop_gput:cnn { g_@@_dict_ #1 _prop } + \prop_gput:cnn { g_@@_lang_ #1 _prop } { default- #2 } {#3} } -\cs_generate_variant:Nn \@@_declare_default_transl:nnn { Vnn } +\cs_generate_variant:Nn \@@_declare_lang_opt_default:nnn { Vnn , VnV } % \end{macrocode} % \end{macro} % % -% The set of keys for \texttt{{zref-clever/langsetup}}, which is used to -% set language-specific translations in \cs{zcLanguageSetup}. +% The set of keys for \texttt{{zref-clever/langsetup}}, which is used to set +% language-specific options in \cs{zcLanguageSetup}. % % \begin{macrocode} \keys_define:nn { zref-clever / langsetup } @@ -2772,31 +2964,33 @@ { \tl_clear:N \l_@@_setup_type_tl } { \tl_set:Nn \l_@@_setup_type_tl {#1} } } , + case .code:n = { - \seq_if_empty:NTF \l_@@_dict_declension_seq + \seq_if_empty:NTF \l_@@_lang_declension_seq { \msg_warning:nnxx { zref-clever } { language-no-decl-setup } - { \l_@@_dict_language_tl } {#1} + { \l_@@_base_language_tl } {#1} } { - \seq_if_in:NnTF \l_@@_dict_declension_seq {#1} - { \tl_set:Nn \l_@@_dict_decl_case_tl {#1} } + \seq_if_in:NnTF \l_@@_lang_declension_seq {#1} + { \tl_set:Nn \l_@@_lang_decl_case_tl {#1} } { \msg_warning:nnxx { zref-clever } { unknown-decl-case } - {#1} { \l_@@_dict_language_tl } - \seq_get_left:NN \l_@@_dict_declension_seq - \l_@@_dict_decl_case_tl + {#1} { \l_@@_base_language_tl } + \seq_get_left:NN \l_@@_lang_declension_seq + \l_@@_lang_decl_case_tl } } } , case .value_required:n = true , + gender .code:n = { - \seq_if_empty:NTF \l_@@_dict_gender_seq + \seq_if_empty:NTF \l_@@_lang_gender_seq { \msg_warning:nnxxx { zref-clever } { language-no-gender } - { \l_@@_dict_language_tl } { gender } {#1} + { \l_@@_base_language_tl } { gender } {#1} } { \tl_if_empty:NTF \l_@@_setup_type_tl @@ -2805,21 +2999,68 @@ { option-only-type-specific } { gender } } { - \seq_if_in:NnTF \l_@@_dict_gender_seq {#1} + \clist_clear:N \l_tmpa_clist + \clist_map_inline:nn {#1} { - \@@_declare_type_transl:VVnn - \l_@@_dict_language_tl - \l_@@_setup_type_tl - { gender } {#1} + \seq_if_in:NnTF \l_@@_lang_gender_seq {##1} + { \clist_put_right:Nn \l_tmpa_clist {##1} } + { + \msg_warning:nnxx { zref-clever } + { gender-not-declared } + { \l_@@_base_language_tl } {##1} + } } + \clist_if_empty:NF \l_tmpa_clist { - \msg_warning:nnxx { zref-clever } { gender-not-declared } - { \l_@@_dict_language_tl } {#1} + \@@_declare_lang_opt_type:VVnx + \l_@@_base_language_tl + \l_@@_setup_type_tl + { gender } { \clist_use:Nn \l_tmpa_clist { , } } } } } } , gender .value_required:n = true , + + cap .choices:nn = + { true , false } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_declare_lang_opt_default:VnV + \l_@@_base_language_tl + { cap } \l_keys_choice_tl + } + { + \@@_declare_lang_opt_type:VVnV + \l_@@_base_language_tl + \l_@@_setup_type_tl + { cap } \l_keys_choice_tl + } + } , + cap .default:n = true , + nocap .meta:n = { cap = false } , + nocap .value_forbidden:n = true , + + abbrev .choices:nn = + { true , false } + { + \tl_if_empty:NTF \l_@@_setup_type_tl + { + \@@_declare_lang_opt_default:VnV + \l_@@_base_language_tl + { abbrev } \l_keys_choice_tl + } + { + \@@_declare_lang_opt_type:VVnV + \l_@@_base_language_tl + \l_@@_setup_type_tl + { abbrev } \l_keys_choice_tl + } + } , + abbrev .default:n = true , + noabbrev .meta:n = { abbrev = false }, + noabbrev .value_forbidden:n = true , } \seq_map_inline:Nn \c_@@_ref_options_necessarily_not_type_specific_seq @@ -2831,8 +3072,8 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \@@_declare_default_transl:Vnn - \l_@@_dict_language_tl + \@@_declare_lang_opt_default:Vnn + \l_@@_base_language_tl {#1} {##1} } { @@ -2852,19 +3093,34 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \@@_declare_default_transl:Vnn - \l_@@_dict_language_tl + \@@_declare_lang_opt_default:Vnn + \l_@@_base_language_tl {#1} {##1} } { - \@@_declare_type_transl:VVnn - \l_@@_dict_language_tl + \@@_declare_lang_opt_type:VVnn + \l_@@_base_language_tl \l_@@_setup_type_tl {#1} {##1} } } , } } +\keys_define:nn { zref-clever / langsetup } + { + refpre .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpre } { preref } + } , + refpos .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpos } { postref } + } , + } \seq_map_inline:Nn \c_@@_ref_options_type_names_seq { @@ -2879,18 +3135,18 @@ { option-only-type-specific } {#1} } { - \tl_if_empty:NTF \l_@@_dict_decl_case_tl + \tl_if_empty:NTF \l_@@_lang_decl_case_tl { - \@@_declare_type_transl:VVnn - \l_@@_dict_language_tl + \@@_declare_lang_opt_type:VVnn + \l_@@_base_language_tl \l_@@_setup_type_tl {#1} {##1} } { - \@@_declare_type_transl:VVxn - \l_@@_dict_language_tl + \@@_declare_lang_opt_type:VVxn + \l_@@_base_language_tl \l_@@_setup_type_tl - { \l_@@_dict_decl_case_tl - #1 } {##1} + { \l_@@_lang_decl_case_tl - #1 } {##1} } } } , @@ -2938,13 +3194,13 @@ \seq_set_from_clist:Nn \l_@@_zcref_labels_seq {#1} \bool_set:Nn \l_@@_link_star_bool {#2} % \end{macrocode} -% Ensure dictionary for reference language is loaded, if available. We cannot -% rely on \cs{keys_set:nn} for the task, since if the \opt{lang} option is set -% for \texttt{current}, the actual language may have changed outside our -% control. \cs{@@_provide_dictionary:x} does nothing if the dictionary is -% already loaded. +% Ensure language file for reference language is loaded, if available. We +% cannot rely on \cs{keys_set:nn} for the task, since if the \opt{lang} option +% is set for \texttt{current}, the actual language may have changed outside +% our control. \cs{@@_provide_langfile:x} does nothing if the language file +% is already loaded. % \begin{macrocode} - \@@_provide_dictionary:x { \l_@@_ref_language_tl } + \@@_provide_langfile:x { \l_@@_ref_language_tl } % \end{macrocode} % Process \cs{zcDeclareLanguage} options. % \begin{macrocode} @@ -2976,7 +3232,7 @@ % \begin{macrocode} \tl_if_empty:NF \l_@@_zcref_note_tl { - \@@_get_ref_string:nN { notesep } \l_tmpa_tl + \@@_get_ref_opt_typeset:nN { notesep } \l_tmpa_tl \l_tmpa_tl \l_@@_zcref_note_tl } @@ -3175,7 +3431,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_label_type_put_new_right:n #1 { - \@@_def_extract:Nnnn + \@@_extract_default:Nnnn \l_@@_label_type_a_tl {#1} { zc@type } { \c_empty_tl } \seq_if_in:NVF \l_@@_label_types_seq \l_@@_label_type_a_tl @@ -3201,9 +3457,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_sort_default:nn #1#2 { - \@@_def_extract:Nnnn + \@@_extract_default:Nnnn \l_@@_label_type_a_tl {#1} { zc@type } { zc@missingtype } - \@@_def_extract:Nnnn + \@@_extract_default:Nnnn \l_@@_label_type_b_tl {#2} { zc@type } { zc@missingtype } \tl_if_eq:NNTF @@ -3223,15 +3479,15 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_sort_default_same_type:nn #1#2 { - \@@_def_extract:Nnnn \l_@@_label_enclval_a_tl + \@@_extract_default:Nnnn \l_@@_label_enclval_a_tl {#1} { zc@enclval } { \c_empty_tl } \tl_reverse:N \l_@@_label_enclval_a_tl - \@@_def_extract:Nnnn \l_@@_label_enclval_b_tl + \@@_extract_default:Nnnn \l_@@_label_enclval_b_tl {#2} { zc@enclval } { \c_empty_tl } \tl_reverse:N \l_@@_label_enclval_b_tl - \@@_def_extract:Nnnn \l_@@_label_extdoc_a_tl + \@@_extract_default:Nnnn \l_@@_label_extdoc_a_tl {#1} { externaldocument } { \c_empty_tl } - \@@_def_extract:Nnnn \l_@@_label_extdoc_b_tl + \@@_extract_default:Nnnn \l_@@_label_extdoc_b_tl {#2} { externaldocument } { \c_empty_tl } \bool_set_false:N \l_@@_sort_decided_bool @@ -3638,13 +3894,15 @@ % \l_@@_listsep_tl , % \l_@@_lastsep_tl , % \l_@@_rangesep_tl , -% \l_@@_refpre_tl , -% \l_@@_refpos_tl , +% \l_@@_preref_tl , +% \l_@@_postref_tl , % \l_@@_namefont_tl , % \l_@@_reffont_tl , +% \l_@@_capitalize_bool , +% \l_@@_abbrev_bool , % } -% Auxiliary variables for \cs{@@_typeset_refs:} separators, refpre/pos and -% font options. +% Auxiliary variables for \cs{@@_typeset_refs:} separators, pre-/postref and +% font and other options. % \begin{macrocode} \tl_new:N \l_@@_tpairsep_tl \tl_new:N \l_@@_tlistsep_tl @@ -3654,10 +3912,12 @@ \tl_new:N \l_@@_listsep_tl \tl_new:N \l_@@_lastsep_tl \tl_new:N \l_@@_rangesep_tl -\tl_new:N \l_@@_refpre_tl -\tl_new:N \l_@@_refpos_tl +\tl_new:N \l_@@_preref_tl +\tl_new:N \l_@@_postref_tl \tl_new:N \l_@@_namefont_tl \tl_new:N \l_@@_reffont_tl +\bool_new:N \l_@@_capitalize_bool +\bool_new:N \l_@@_abbrev_bool % \end{macrocode} % \end{macro} % @@ -3692,11 +3952,11 @@ \int_zero:N \l_@@_range_same_count_int % Get type block options (not type-specific). - \@@_get_ref_string:nN { tpairsep } + \@@_get_ref_opt_typeset:nN { tpairsep } \l_@@_tpairsep_tl - \@@_get_ref_string:nN { tlistsep } + \@@_get_ref_opt_typeset:nN { tlistsep } \l_@@_tlistsep_tl - \@@_get_ref_string:nN { tlastsep } + \@@_get_ref_opt_typeset:nN { tlastsep } \l_@@_tlastsep_tl % Process label stack. @@ -3721,9 +3981,11 @@ \tl_set:Nn \l_@@_label_type_b_tl { page } } { - \@@_def_extract:NVnn \l_@@_label_type_a_tl + \@@_extract_default:NVnn + \l_@@_label_type_a_tl \l_@@_label_a_tl { zc@type } { zc@missingtype } - \@@_def_extract:NVnn \l_@@_label_type_b_tl + \@@_extract_default:NVnn + \l_@@_label_type_b_tl \l_@@_label_b_tl { zc@type } { zc@missingtype } } @@ -3777,28 +4039,32 @@ } } - % Get type-specific separators, refpre/pos and font options, once per - % type. + % Get type-specific separators, pre-/postref font and other options, + % once per type. \int_compare:nNnT { \l_@@_label_count_int } = { 0 } { - \@@_get_ref_string:nN { namesep } + \@@_get_ref_opt_typeset:nN { namesep } \l_@@_namesep_tl - \@@_get_ref_string:nN { pairsep } + \@@_get_ref_opt_typeset:nN { pairsep } \l_@@_pairsep_tl - \@@_get_ref_string:nN { listsep } + \@@_get_ref_opt_typeset:nN { listsep } \l_@@_listsep_tl - \@@_get_ref_string:nN { lastsep } + \@@_get_ref_opt_typeset:nN { lastsep } \l_@@_lastsep_tl - \@@_get_ref_string:nN { rangesep } + \@@_get_ref_opt_typeset:nN { rangesep } \l_@@_rangesep_tl - \@@_get_ref_string:nN { refpre } - \l_@@_refpre_tl - \@@_get_ref_string:nN { refpos } - \l_@@_refpos_tl - \@@_get_ref_font:nN { namefont } + \@@_get_ref_opt_typeset:nN { preref } + \l_@@_preref_tl + \@@_get_ref_opt_typeset:nN { postref } + \l_@@_postref_tl + \@@_get_ref_opt_font:nN { namefont } \l_@@_namefont_tl - \@@_get_ref_font:nN { reffont } + \@@_get_ref_opt_font:nN { reffont } \l_@@_reffont_tl + \@@_get_ref_opt_bool:nnN { cap } { false } + \l_@@_capitalize_bool + \@@_get_ref_opt_bool:nnN { abbrev } { false } + \l_@@_abbrev_bool } % Here we send this to a couple of auxiliary functions. @@ -4348,33 +4614,33 @@ } { \bool_if:NF \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpre_tl } + { \exp_not:V \l_@@_preref_tl } % It's two `@s', but escaped for DocStrip. \exp_not:N \hyper@@@@link { \@@_extract_url_unexp:n {#1} } { \@@_extract_unexp:nnn {#1} { anchor } { } } { \bool_if:NT \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpre_tl } + { \exp_not:V \l_@@_preref_tl } \exp_not:N \group_begin: \exp_not:V \l_@@_reffont_tl \@@_extract_unexp:nvn {#1} { l_@@_ref_property_tl } { } \exp_not:N \group_end: \bool_if:NT \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpos_tl } + { \exp_not:V \l_@@_postref_tl } } \bool_if:NF \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpos_tl } + { \exp_not:V \l_@@_postref_tl } } { - \exp_not:V \l_@@_refpre_tl + \exp_not:V \l_@@_preref_tl \exp_not:N \group_begin: \exp_not:V \l_@@_reffont_tl \@@_extract_unexp:nvn {#1} { l_@@_ref_property_tl } { } \exp_not:N \group_end: - \exp_not:V \l_@@_refpos_tl + \exp_not:V \l_@@_postref_tl } } { \@@_ref_default: } @@ -4421,7 +4687,7 @@ \exp_not:V \l_@@_type_name_tl \exp_not:N \group_end: \exp_not:V \l_@@_namesep_tl - \exp_not:V \l_@@_refpre_tl + \exp_not:V \l_@@_preref_tl \exp_not:N \group_begin: \exp_not:V \l_@@_reffont_tl \@@_extract_unexp:Vvn @@ -4429,10 +4695,10 @@ { l_@@_ref_property_tl } { } \exp_not:N \group_end: \bool_if:NT \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpos_tl } + { \exp_not:V \l_@@_postref_tl } } \bool_if:NF \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpos_tl } + { \exp_not:V \l_@@_postref_tl } } { \exp_not:N \group_begin: @@ -4467,7 +4733,7 @@ } { \bool_if:NF \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpre_tl } + { \exp_not:V \l_@@_preref_tl } % It's two '@s', but escaped for DocStrip. \exp_not:N \hyper@@@@link { @@ -4480,7 +4746,7 @@ } { \bool_if:NT \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpre_tl } + { \exp_not:V \l_@@_preref_tl } \exp_not:N \group_begin: \exp_not:V \l_@@_reffont_tl \@@_extract_unexp:Vvn @@ -4488,20 +4754,20 @@ { l_@@_ref_property_tl } { } \exp_not:N \group_end: \bool_if:NT \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpos_tl } + { \exp_not:V \l_@@_postref_tl } } \bool_if:NF \l_@@_preposinlink_bool - { \exp_not:V \l_@@_refpos_tl } + { \exp_not:V \l_@@_postref_tl } } { - \exp_not:V \l_@@_refpre_tl + \exp_not:V \l_@@_preref_tl \exp_not:N \group_begin: \exp_not:V \l_@@_reffont_tl \@@_extract_unexp:Vvn \l_@@_type_first_label_tl { l_@@_ref_property_tl } { } \exp_not:N \group_end: - \exp_not:V \l_@@_refpos_tl + \exp_not:V \l_@@_postref_tl } } { \@@_ref_default: } @@ -4594,15 +4860,17 @@ { \l_@@_nudge_gender_bool } { ! \tl_if_empty_p:N \l_@@_ref_gender_tl } { - \@@_get_type_transl:xxnNF + \@@_get_lang_opt_type:xxnNF { \l_@@_ref_language_tl } { \l_@@_type_first_label_type_tl } { gender } \l_@@_type_name_gender_tl { \tl_clear:N \l_@@_type_name_gender_tl } - \tl_if_eq:NNF - \l_@@_ref_gender_tl + \clist_set:NV \l_tmpa_clist \l_@@_type_name_gender_tl + \clist_if_in:NVF + \l_tmpa_clist + \l_@@_ref_gender_tl { \tl_if_empty:NTF \l_@@_type_name_gender_tl { @@ -4640,7 +4908,7 @@ \tl_put_left:NV \l_@@_name_format_tl \l_@@_ref_decl_case_tl } - \@@_get_type_transl:xxxNF + \@@_get_lang_opt_type:xxxNF { \l_@@_ref_language_tl } { \l_@@_type_first_label_type_tl } { \l_@@_name_format_tl } @@ -4682,13 +4950,13 @@ \l_@@_name_format_fallback_tl \l_@@_ref_decl_case_tl } - \@@_get_type_transl:xxxNF + \@@_get_lang_opt_type:xxxNF { \l_@@_ref_language_tl } { \l_@@_type_first_label_type_tl } { \l_@@_name_format_tl } \l_@@_type_name_tl { - \@@_get_type_transl:xxxNF + \@@_get_lang_opt_type:xxxNF { \l_@@_ref_language_tl } { \l_@@_type_first_label_type_tl } { \l_@@_name_format_fallback_tl } @@ -4776,9 +5044,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_labels_in_sequence:nn #1#2 { - \@@_def_extract:Nnnn \l_@@_label_extdoc_a_tl + \@@_extract_default:Nnnn \l_@@_label_extdoc_a_tl {#1} { externaldocument } { \c_empty_tl } - \@@_def_extract:Nnnn \l_@@_label_extdoc_b_tl + \@@_extract_default:Nnnn \l_@@_label_extdoc_b_tl {#2} { externaldocument } { \c_empty_tl } \tl_if_eq:NNT @@ -4855,27 +5123,28 @@ % % % -% Finally, a couple of functions for retrieving options values, according to -% the relevant precedence rules. They both receive an \meta{option} as -% argument, and store the retrieved value in \meta{tl variable}. Though these -% are mostly general functions (for a change\dots{}), they are not completely -% so, they rely on the current state of \cs{l_@@_label_type_a_tl}, as set -% during the processing of the label stack. This could be easily generalized, -% of course, but I don't think it is worth it, \cs{l_@@_label_type_a_tl} is -% indeed what we want in all practical cases. The difference between -% \cs{@@_get_ref_string:nN} and \cs{@@_get_ref_font:nN} is the kind of option -% each should be used for. \cs{@@_get_ref_string:nN} is meant for the general -% options, and attempts to find values for them in all precedence levels (four -% plus ``fallback''). \cs{@@_get_ref_font:nN} is intended for ``font'' +% Finally, some functions for retrieving reference options values, according +% to the relevant precedence rules. They both receive an \meta{option} as +% argument, and store the retrieved value in an appropriate. Though these are +% mostly general functions (for a change\dots{}), they are not completely so, +% they rely on the current state of \cs{l_@@_label_type_a_tl}, as set during +% the processing of the label stack. This could be easily generalized, of +% course, but I don't think it is worth it, \cs{l_@@_label_type_a_tl} is +% indeed what we want in all practical cases. The difference between each of +% these functions is the kind of option each should be used for. +% \cs{@@_get_ref_opt_typeset:nN} is meant for the general options, and +% attempts to find values for them in all precedence levels (four plus +% ``fallback''). \cs{@@_get_ref_opt_font:nN} is intended for ``font'' % options, which cannot be ``language-specific'', thus for these we just -% search general options and type options. +% search general options and type options. \cs{@@_get_ref_opt_bool:nN} is +% intended for boolean options. % -% \begin{macro}{\@@_get_ref_string:nN} +% \begin{macro}{\@@_get_ref_opt_typeset:nN} % \begin{syntax} -% \cs{@@_get_ref_string:nN} \Arg{option} \Arg{tl variable} +% \cs{@@_get_ref_opt_typeset:nN} \Arg{option} \Arg{tl variable} % \end{syntax} % \begin{macrocode} -\cs_new_protected:Npn \@@_get_ref_string:nN #1#2 +\cs_new_protected:Npn \@@_get_ref_opt_typeset:nN #1#2 { % First attempt: general options. \prop_get:NnNF \l_@@_ref_options_prop {#1} #2 @@ -4906,19 +5175,19 @@ {#1} #2 } { - % If not found, try type specific translations. - \@@_get_type_transl:xxnNF + % If not found, try type- and language-specific. + \@@_get_lang_opt_type:xxnNF { \l_@@_ref_language_tl } { \l_@@_label_type_a_tl } {#1} #2 { - % If not found, try default translations. - \@@_get_default_transl:xnNF + % If not found, try language-specific default. + \@@_get_lang_opt_default:xnNF { \l_@@_ref_language_tl } {#1} #2 { % If not found, try fallback. - \@@_get_fallback_transl:nNF {#1} #2 + \@@_get_fallback_unknown_lang_opt:nNF {#1} #2 { \tl_clear:N #2 \msg_warning:nnn { zref-clever } @@ -4932,12 +5201,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_get_ref_font:nN} +% \begin{macro}{\@@_get_ref_opt_font:nN} % \begin{syntax} -% \cs{@@_get_ref_font:nN} \Arg{option} \Arg{tl variable} +% \cs{@@_get_ref_opt_font:nN} \Arg{option} \Arg{tl variable} % \end{syntax} % \begin{macrocode} -\cs_new_protected:Npn \@@_get_ref_font:nN #1#2 +\cs_new_protected:Npn \@@_get_ref_opt_font:nN #1#2 { % First attempt: general options. \prop_get:NnNF \l_@@_ref_options_prop {#1} #2 @@ -4967,6 +5236,74 @@ % \end{macro} % % +% \begin{macro}{\@@_get_ref_opt_bool:nnN} +% \begin{syntax} +% \cs{@@_get_ref_opt_bool:nN} \Arg{option} +% ~~\Arg{default} \Arg{bool variable} +% \end{syntax} +% \begin{macrocode} +\cs_new_protected:Npn \@@_get_ref_opt_bool:nnN #1#2#3 + { + % First attempt: general options. + \prop_get:NnNF \l_@@_ref_options_prop {#1} \l_tmpa_tl + { + % If not found, try type specific options. + \bool_lazy_and:nnTF + { + \prop_if_exist_p:c + { + l_@@_type_ + \l_@@_label_type_a_tl _options_prop + } + } + { + \prop_if_in_p:cn + { + l_@@_type_ + \l_@@_label_type_a_tl _options_prop + } + {#1} + } + { + \prop_get:cnN + { + l_@@_type_ + \l_@@_label_type_a_tl _options_prop + } + {#1} \l_tmpa_tl + } + { + % If not found, try type- and language-specific. + \@@_get_lang_opt_type:xxnNF + { \l_@@_ref_language_tl } + { \l_@@_label_type_a_tl } + {#1} \l_tmpa_tl + { + % If not found, try language-specific default. + \@@_get_lang_opt_default:xnNF + { \l_@@_ref_language_tl } + {#1} \l_tmpa_tl + { + % If not found, use default argument. + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#2} { true } } + { \str_if_eq_p:nn {#2} { false } } + { \tl_set:Nn \l_tmpa_tl {#2} } + { + % And, if even that fails, presume false. + \tl_set:Nn \l_tmpa_tl { false } + } + } + } + } + } + % Having retrieved the option value, set the boolean. At this point, we + % *know* '\l_tmpa_tl' is either 'true' or 'false'. + \use:c { bool_set_ \l_tmpa_tl :N } #3 + } +% \end{macrocode} +% \end{macro} +% % % \section{Compatibility} % @@ -5461,8 +5798,8 @@ \zcRefTypeSetup { equation } { reffont = \upshape , - refpre = {\textup{(}} , - refpos = {\textup{)}} , + preref = {\textup{(}} , + postref = {\textup{)}} , } \msg_info:nnn { zref-clever } { compat-package } { amsmath } } @@ -5752,10 +6089,10 @@ % % % -% \section{Dictionaries} +% \section{Language files} % % Initial values for the English, German, French, Portuguese, and Spanish, -% dictionaries have been provided by the author. Translations available for +% language files have been provided by the author. Translations available for % document elements' names in other packages have been an useful reference for % the purpose, namely: \pkg{babel}, \pkg{cleveref}, \pkg{translator}, and % \pkg{translations}. @@ -5763,7 +6100,7 @@ % % \subsection{English} % -% English dictionary has been initially provided by the author. +% English language file has been initially provided by the author. % % \begin{macrocode} %<*package> @@ -5779,7 +6116,7 @@ % \end{macrocode} % % \begin{macrocode} -%<*dict-english> +%<*lang-english> % \end{macrocode} % % \begin{macrocode} @@ -5838,8 +6175,6 @@ type = page , name-sg = page , Name-pl = Pages , name-pl = pages , - name-sg-ab = p. , - name-pl-ab = pp. , rangesep = {\textendash} , type = line , @@ -5897,8 +6232,8 @@ type = equation , name-sg-ab = eq. , Name-pl-ab = Eqs. , name-pl-ab = eqs. , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , Name-sg = Theorem , @@ -5980,14 +6315,14 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%</dict-english> +%</lang-english> % \end{macrocode} % % % % \subsection{German} % -% German dictionary has been initially provided by the author. +% German language file has been initially provided by the author. % % \begin{macrocode} %<*package> @@ -6004,7 +6339,7 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%<*dict-german> +%<*lang-german> % \end{macrocode} % % \begin{macrocode} @@ -6251,8 +6586,8 @@ type = equation , case = G , Name-sg = Gleichung , Name-pl = Gleichungen , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , gender = n , @@ -6451,18 +6786,18 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%</dict-german> +%</lang-german> % \end{macrocode} % % % % \subsection{French} % -% French dictionary has been initially provided by the author, and has been -% improved thanks to Denis Bitouzé (\githubissue{1}) and participants of the -% Groupe francophone des Utilisateurs de \TeX{} (GUTenberg) (at -% \url{https://groups.google.com/g/gut_fr/c/rNLm6weGcyg}) and the -% \texttt{fr.comp.text.tex} (at +% French language file has been initially provided by the author, and has been +% improved thanks to Denis Bitouzé and François Lagarde (at \githubissue{1}) +% and participants of the Groupe francophone des Utilisateurs de \TeX{} +% (GUTenberg) (at \url{https://groups.google.com/g/gut_fr/c/rNLm6weGcyg}) and +% the \texttt{fr.comp.text.tex} (at % \url{https://groups.google.com/g/fr.comp.text.tex/c/Fa11Tf6MFFs}) mailing % lists. % @@ -6477,7 +6812,7 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%<*dict-french> +%<*lang-french> % \end{macrocode} % % \begin{macrocode} @@ -6596,8 +6931,8 @@ type = equation , name-sg = équation , Name-pl = Équations , name-pl = équations , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , gender = m , @@ -6692,14 +7027,14 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%</dict-french> +%</lang-french> % \end{macrocode} % % % % \subsection{Portuguese} % -% Portuguese dictionary provided by the author, who's a native speaker of +% Portuguese language file provided by the author, who's a native speaker of % (Brazilian) Portuguese. I do expect this to be sufficiently general, but if % Portuguese speakers from other places feel the need for a Portuguese % variant, please let me know. @@ -6714,7 +7049,7 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%<*dict-portuguese> +%<*lang-portuguese> % \end{macrocode} % % \begin{macrocode} @@ -6780,8 +7115,6 @@ type = page , name-sg = página , Name-pl = Páginas , name-pl = páginas , - name-sg-ab = p. , - name-pl-ab = pp. , rangesep = {\textendash} , type = line , @@ -6847,8 +7180,8 @@ type = equation , name-sg-ab = eq. , Name-pl-ab = Eqs. , name-pl-ab = eqs. , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , gender = m , @@ -6943,14 +7276,14 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%</dict-portuguese> +%</lang-portuguese> % \end{macrocode} % % % % \subsection{Spanish} % -% Spanish dictionary has been initially provided by the author. +% Spanish language file has been initially provided by the author. % % \begin{macrocode} %<*package> @@ -6959,7 +7292,7 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%<*dict-spanish> +%<*lang-spanish> % \end{macrocode} % % \begin{macrocode} @@ -7078,8 +7411,8 @@ type = equation , name-sg = ecuación , Name-pl = Ecuaciones , name-pl = ecuaciones , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , gender = m , @@ -7174,7 +7507,255 @@ type = solution , % \end{macrocode} % % \begin{macrocode} -%</dict-spanish> +%</lang-spanish> +% \end{macrocode} +% +% +% +% \subsection{Dutch} +% +% Dutch language file initially contributed by \texttt{niluxv} (\githubPR{5}). +% All genders were checked against the ``Dikke Van Dale''. Many words have +% multiple genders. +% +% \begin{macrocode} +%<*package> +\zcDeclareLanguage [ gender = { f , m , n } ] { dutch } +%</package> +% \end{macrocode} +% +% \begin{macrocode} +%<*lang-dutch> +% \end{macrocode} +% +% \begin{macrocode} +namesep = {\nobreakspace} , +pairsep = {~en\nobreakspace} , +listsep = {,~} , +lastsep = {~en\nobreakspace} , +tpairsep = {~en\nobreakspace} , +tlistsep = {,~} , +tlastsep = {,~en\nobreakspace} , +notesep = {~} , +rangesep = {~t/m\nobreakspace} , + +type = book , + gender = n , + Name-sg = Boek , + name-sg = boek , + Name-pl = Boeken , + name-pl = boeken , + +type = part , + gender = n , + Name-sg = Deel , + name-sg = deel , + Name-pl = Delen , + name-pl = delen , + +type = chapter , + gender = n , + Name-sg = Hoofdstuk , + name-sg = hoofdstuk , + Name-pl = Hoofdstukken , + name-pl = hoofdstukken , + +type = section , + gender = m , + Name-sg = Paragraaf , + name-sg = paragraaf , + Name-pl = Paragrafen , + name-pl = paragrafen , + +type = paragraph , + gender = f , + Name-sg = Alinea , + name-sg = alinea , + Name-pl = Alinea's , + name-pl = alinea's , + +type = appendix , + gender = { m , n } , + Name-sg = Appendix , + name-sg = appendix , + Name-pl = Appendices , + name-pl = appendices , + +type = page , + gender = { f , m } , + Name-sg = Pagina , + name-sg = pagina , + Name-pl = Pagina's , + name-pl = pagina's , + rangesep = {\textendash} , + +type = line , + gender = m , + Name-sg = Regel , + name-sg = regel , + Name-pl = Regels , + name-pl = regels , + +type = figure , + gender = { n , f , m } , + Name-sg = Figuur , + name-sg = figuur , + Name-pl = Figuren , + name-pl = figuren , + +type = table , + gender = { f , m } , + Name-sg = Tabel , + name-sg = tabel , + Name-pl = Tabellen , + name-pl = tabellen , + +type = item , + gender = n , + Name-sg = Punt , + name-sg = punt , + Name-pl = Punten , + name-pl = punten , + +type = footnote , + gender = { f , m } , + Name-sg = Voetnoot , + name-sg = voetnoot , + Name-pl = Voetnoten , + name-pl = voetnoten , + +type = endnote , + gender = { f , m } , + Name-sg = Eindnoot , + name-sg = eindnoot , + Name-pl = Eindnoten , + name-pl = eindnoten , + +type = note , + gender = f , + Name-sg = Opmerking , + name-sg = opmerking , + Name-pl = Opmerkingen , + name-pl = opmerkingen , + +type = equation , + gender = f , + Name-sg = Vergelijking , + name-sg = vergelijking , + Name-pl = Vergelijkingen , + name-pl = vergelijkingen , + Name-sg-ab = Vgl. , + name-sg-ab = vgl. , + Name-pl-ab = Vgl.'s , + name-pl-ab = vgl.'s , + preref = {(} , + postref = {)} , + +type = theorem , + gender = f , + Name-sg = Stelling , + name-sg = stelling , + Name-pl = Stellingen , + name-pl = stellingen , +% \end{macrocode} +% +% 2022-01-09, \texttt{niluxv}: An alternative plural is ``lemmata''. That is +% also a correct English plural for lemma, but the English language file +% chooses ``lemmas''. For consistency we therefore choose ``lemma's''. +% +% \begin{macrocode} +type = lemma , + gender = n , + Name-sg = Lemma , + name-sg = lemma , + Name-pl = Lemma's , + name-pl = lemma's , + +type = corollary , + gender = n , + Name-sg = Gevolg , + name-sg = gevolg , + Name-pl = Gevolgen , + name-pl = gevolgen , + +type = proposition , + gender = f , + Name-sg = Propositie , + name-sg = propositie , + Name-pl = Proposities , + name-pl = proposities , + +type = definition , + gender = f , + Name-sg = Definitie , + name-sg = definitie , + Name-pl = Definities , + name-pl = definities , + +type = proof , + gender = n , + Name-sg = Bewijs , + name-sg = bewijs , + Name-pl = Bewijzen , + name-pl = bewijzen , + +type = result , + gender = n , + Name-sg = Resultaat , + name-sg = resultaat , + Name-pl = Resultaten , + name-pl = resultaten , + +type = remark , + gender = f , + Name-sg = Opmerking , + name-sg = opmerking , + Name-pl = Opmerkingen , + name-pl = opmerkingen , + +type = example , + gender = n , + Name-sg = Voorbeeld , + name-sg = voorbeeld , + Name-pl = Voorbeelden , + name-pl = voorbeelden , + +type = algorithm , + gender = { n , f , m } , + Name-sg = Algoritme , + name-sg = algoritme , + Name-pl = Algoritmes , + name-pl = algoritmes , +% \end{macrocode} +% +% 2022-01-09, \texttt{niluxv}: EN-NL Van Dale translates listing as (3) +% ``uitdraai van computerprogramma'', ``listing''. +% +% \begin{macrocode} +type = listing , + gender = m , + Name-sg = Listing , + name-sg = listing , + Name-pl = Listings , + name-pl = listings , + +type = exercise , + gender = { f , m } , + Name-sg = Opgave , + name-sg = opgave , + Name-pl = Opgaven , + name-pl = opgaven , + +type = solution , + gender = f , + Name-sg = Oplossing , + name-sg = oplossing , + Name-pl = Oplossingen , + name-pl = oplossingen , +% \end{macrocode} +% +% \begin{macrocode} +%</lang-dutch> % \end{macrocode} % % diff --git a/Master/texmf-dist/source/latex/zref-clever/zref-clever.ins b/Master/texmf-dist/source/latex/zref-clever/zref-clever.ins index 46d9982dc46..69c052679e4 100644 --- a/Master/texmf-dist/source/latex/zref-clever/zref-clever.ins +++ b/Master/texmf-dist/source/latex/zref-clever/zref-clever.ins @@ -4,7 +4,7 @@ % % This file is part of the LaTeX package "zref-clever". % -% Copyright (C) 2021 Gustavo Barros +% Copyright (C) 2021-2022 Gustavo Barros % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ This file was generated from file(s) of the LaTeX package "zref-clever". -Copyright (C) 2021 Gustavo Barros +Copyright (C) 2021-2022 Gustavo Barros It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -90,10 +90,11 @@ for those people who are interested. \endpostamble \generate{\file{zref-clever.sty}{\from{zref-clever.dtx}{package}}} -\generate{\file{zref-clever-english.dict}{\from{zref-clever.dtx}{dict-english}}} -\generate{\file{zref-clever-german.dict}{\from{zref-clever.dtx}{dict-german}}} -\generate{\file{zref-clever-french.dict}{\from{zref-clever.dtx}{dict-french}}} -\generate{\file{zref-clever-portuguese.dict}{\from{zref-clever.dtx}{dict-portuguese}}} -\generate{\file{zref-clever-spanish.dict}{\from{zref-clever.dtx}{dict-spanish}}} +\generate{\file{zref-clever-english.lang}{\from{zref-clever.dtx}{lang-english}}} +\generate{\file{zref-clever-german.lang}{\from{zref-clever.dtx}{lang-german}}} +\generate{\file{zref-clever-french.lang}{\from{zref-clever.dtx}{lang-french}}} +\generate{\file{zref-clever-portuguese.lang}{\from{zref-clever.dtx}{lang-portuguese}}} +\generate{\file{zref-clever-spanish.lang}{\from{zref-clever.dtx}{lang-spanish}}} +\generate{\file{zref-clever-dutch.lang}{\from{zref-clever.dtx}{lang-dutch}}} \endbatchfile diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-dutch.lang b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-dutch.lang new file mode 100644 index 00000000000..26d2d0cb821 --- /dev/null +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-dutch.lang @@ -0,0 +1,257 @@ +%% +%% This is file `zref-clever-dutch.lang', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% zref-clever.dtx (with options: `lang-dutch') +%% +%% This file was generated from file(s) of the LaTeX package "zref-clever". +%% +%% Copyright (C) 2021-2022 Gustavo Barros +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file: +%% +%% https://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Gustavo Barros. +%% +%% This work consists of the files zref-clever.dtx, +%% zref-clever.ins, +%% zref-clever.tex, +%% zref-clever-code.tex, +%% and the files listed in MANIFEST.md. +%% +%% The released version of this package is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the package can be found at +%% +%% https://github.com/gusbrs/zref-clever +%% +%% for those people who are interested. +%% +%% ----------------------------------------------------------------------- +%% +namesep = {\nobreakspace} , +pairsep = {~en\nobreakspace} , +listsep = {,~} , +lastsep = {~en\nobreakspace} , +tpairsep = {~en\nobreakspace} , +tlistsep = {,~} , +tlastsep = {,~en\nobreakspace} , +notesep = {~} , +rangesep = {~t/m\nobreakspace} , + +type = book , + gender = n , + Name-sg = Boek , + name-sg = boek , + Name-pl = Boeken , + name-pl = boeken , + +type = part , + gender = n , + Name-sg = Deel , + name-sg = deel , + Name-pl = Delen , + name-pl = delen , + +type = chapter , + gender = n , + Name-sg = Hoofdstuk , + name-sg = hoofdstuk , + Name-pl = Hoofdstukken , + name-pl = hoofdstukken , + +type = section , + gender = m , + Name-sg = Paragraaf , + name-sg = paragraaf , + Name-pl = Paragrafen , + name-pl = paragrafen , + +type = paragraph , + gender = f , + Name-sg = Alinea , + name-sg = alinea , + Name-pl = Alinea's , + name-pl = alinea's , + +type = appendix , + gender = { m , n } , + Name-sg = Appendix , + name-sg = appendix , + Name-pl = Appendices , + name-pl = appendices , + +type = page , + gender = { f , m } , + Name-sg = Pagina , + name-sg = pagina , + Name-pl = Pagina's , + name-pl = pagina's , + rangesep = {\textendash} , + +type = line , + gender = m , + Name-sg = Regel , + name-sg = regel , + Name-pl = Regels , + name-pl = regels , + +type = figure , + gender = { n , f , m } , + Name-sg = Figuur , + name-sg = figuur , + Name-pl = Figuren , + name-pl = figuren , + +type = table , + gender = { f , m } , + Name-sg = Tabel , + name-sg = tabel , + Name-pl = Tabellen , + name-pl = tabellen , + +type = item , + gender = n , + Name-sg = Punt , + name-sg = punt , + Name-pl = Punten , + name-pl = punten , + +type = footnote , + gender = { f , m } , + Name-sg = Voetnoot , + name-sg = voetnoot , + Name-pl = Voetnoten , + name-pl = voetnoten , + +type = endnote , + gender = { f , m } , + Name-sg = Eindnoot , + name-sg = eindnoot , + Name-pl = Eindnoten , + name-pl = eindnoten , + +type = note , + gender = f , + Name-sg = Opmerking , + name-sg = opmerking , + Name-pl = Opmerkingen , + name-pl = opmerkingen , + +type = equation , + gender = f , + Name-sg = Vergelijking , + name-sg = vergelijking , + Name-pl = Vergelijkingen , + name-pl = vergelijkingen , + Name-sg-ab = Vgl. , + name-sg-ab = vgl. , + Name-pl-ab = Vgl.'s , + name-pl-ab = vgl.'s , + preref = {(} , + postref = {)} , + +type = theorem , + gender = f , + Name-sg = Stelling , + name-sg = stelling , + Name-pl = Stellingen , + name-pl = stellingen , +type = lemma , + gender = n , + Name-sg = Lemma , + name-sg = lemma , + Name-pl = Lemma's , + name-pl = lemma's , + +type = corollary , + gender = n , + Name-sg = Gevolg , + name-sg = gevolg , + Name-pl = Gevolgen , + name-pl = gevolgen , + +type = proposition , + gender = f , + Name-sg = Propositie , + name-sg = propositie , + Name-pl = Proposities , + name-pl = proposities , + +type = definition , + gender = f , + Name-sg = Definitie , + name-sg = definitie , + Name-pl = Definities , + name-pl = definities , + +type = proof , + gender = n , + Name-sg = Bewijs , + name-sg = bewijs , + Name-pl = Bewijzen , + name-pl = bewijzen , + +type = result , + gender = n , + Name-sg = Resultaat , + name-sg = resultaat , + Name-pl = Resultaten , + name-pl = resultaten , + +type = remark , + gender = f , + Name-sg = Opmerking , + name-sg = opmerking , + Name-pl = Opmerkingen , + name-pl = opmerkingen , + +type = example , + gender = n , + Name-sg = Voorbeeld , + name-sg = voorbeeld , + Name-pl = Voorbeelden , + name-pl = voorbeelden , + +type = algorithm , + gender = { n , f , m } , + Name-sg = Algoritme , + name-sg = algoritme , + Name-pl = Algoritmes , + name-pl = algoritmes , +type = listing , + gender = m , + Name-sg = Listing , + name-sg = listing , + Name-pl = Listings , + name-pl = listings , + +type = exercise , + gender = { f , m } , + Name-sg = Opgave , + name-sg = opgave , + Name-pl = Opgaven , + name-pl = opgaven , + +type = solution , + gender = f , + Name-sg = Oplossing , + name-sg = oplossing , + Name-pl = Oplossingen , + name-pl = oplossingen , +%% +%% +%% End of file `zref-clever-dutch.lang'. diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-english.dict b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-english.lang index 5abce90bf8a..bc51e268916 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-english.dict +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-english.lang @@ -1,14 +1,14 @@ %% -%% This is file `zref-clever-english.dict', +%% This is file `zref-clever-english.lang', %% generated with the docstrip utility. %% %% The original source files were: %% -%% zref-clever.dtx (with options: `dict-english') +%% zref-clever.dtx (with options: `lang-english') %% %% This file was generated from file(s) of the LaTeX package "zref-clever". %% -%% Copyright (C) 2021 Gustavo Barros +%% Copyright (C) 2021-2022 Gustavo Barros %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -97,8 +97,6 @@ type = page , name-sg = page , Name-pl = Pages , name-pl = pages , - name-sg-ab = p. , - name-pl-ab = pp. , rangesep = {\textendash} , type = line , @@ -156,8 +154,8 @@ type = equation , name-sg-ab = eq. , Name-pl-ab = Eqs. , name-pl-ab = eqs. , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , Name-sg = Theorem , @@ -238,4 +236,4 @@ type = solution , name-pl = solutions , %% %% -%% End of file `zref-clever-english.dict'. +%% End of file `zref-clever-english.lang'. diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-french.dict b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-french.lang index 53ea1fc1395..81f4f69c206 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-french.dict +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-french.lang @@ -1,14 +1,14 @@ %% -%% This is file `zref-clever-french.dict', +%% This is file `zref-clever-french.lang', %% generated with the docstrip utility. %% %% The original source files were: %% -%% zref-clever.dtx (with options: `dict-french') +%% zref-clever.dtx (with options: `lang-french') %% %% This file was generated from file(s) of the LaTeX package "zref-clever". %% -%% Copyright (C) 2021 Gustavo Barros +%% Copyright (C) 2021-2022 Gustavo Barros %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -157,8 +157,8 @@ type = equation , name-sg = équation , Name-pl = Équations , name-pl = équations , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , gender = m , @@ -252,4 +252,4 @@ type = solution , name-pl = solutions , %% %% -%% End of file `zref-clever-french.dict'. +%% End of file `zref-clever-french.lang'. diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-german.dict b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-german.lang index e293e0112b9..610818f09fd 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-german.dict +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-german.lang @@ -1,14 +1,14 @@ %% -%% This is file `zref-clever-german.dict', +%% This is file `zref-clever-german.lang', %% generated with the docstrip utility. %% %% The original source files were: %% -%% zref-clever.dtx (with options: `dict-german') +%% zref-clever.dtx (with options: `lang-german') %% %% This file was generated from file(s) of the LaTeX package "zref-clever". %% -%% Copyright (C) 2021 Gustavo Barros +%% Copyright (C) 2021-2022 Gustavo Barros %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -285,8 +285,8 @@ type = equation , case = G , Name-sg = Gleichung , Name-pl = Gleichungen , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , gender = n , @@ -484,4 +484,4 @@ type = solution , Name-pl = Lösungen , %% %% -%% End of file `zref-clever-german.dict'. +%% End of file `zref-clever-german.lang'. diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-portuguese.dict b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-portuguese.lang index e2295a49441..6e02ea9dd0b 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-portuguese.dict +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-portuguese.lang @@ -1,14 +1,14 @@ %% -%% This is file `zref-clever-portuguese.dict', +%% This is file `zref-clever-portuguese.lang', %% generated with the docstrip utility. %% %% The original source files were: %% -%% zref-clever.dtx (with options: `dict-portuguese') +%% zref-clever.dtx (with options: `lang-portuguese') %% %% This file was generated from file(s) of the LaTeX package "zref-clever". %% -%% Copyright (C) 2021 Gustavo Barros +%% Copyright (C) 2021-2022 Gustavo Barros %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -104,8 +104,6 @@ type = page , name-sg = página , Name-pl = Páginas , name-pl = páginas , - name-sg-ab = p. , - name-pl-ab = pp. , rangesep = {\textendash} , type = line , @@ -171,8 +169,8 @@ type = equation , name-sg-ab = eq. , Name-pl-ab = Eqs. , name-pl-ab = eqs. , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , gender = m , @@ -266,4 +264,4 @@ type = solution , name-pl = soluções , %% %% -%% End of file `zref-clever-portuguese.dict'. +%% End of file `zref-clever-portuguese.lang'. diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-spanish.dict b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-spanish.lang index 13038fb9d59..e96c8d6c712 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-spanish.dict +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-spanish.lang @@ -1,14 +1,14 @@ %% -%% This is file `zref-clever-spanish.dict', +%% This is file `zref-clever-spanish.lang', %% generated with the docstrip utility. %% %% The original source files were: %% -%% zref-clever.dtx (with options: `dict-spanish') +%% zref-clever.dtx (with options: `lang-spanish') %% %% This file was generated from file(s) of the LaTeX package "zref-clever". %% -%% Copyright (C) 2021 Gustavo Barros +%% Copyright (C) 2021-2022 Gustavo Barros %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -157,8 +157,8 @@ type = equation , name-sg = ecuación , Name-pl = Ecuaciones , name-pl = ecuaciones , - refpre = {(} , - refpos = {)} , + preref = {(} , + postref = {)} , type = theorem , gender = m , @@ -252,4 +252,4 @@ type = solution , name-pl = soluciones , %% %% -%% End of file `zref-clever-spanish.dict'. +%% End of file `zref-clever-spanish.lang'. diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty b/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty index 34700408b24..61f5127c2e5 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty @@ -8,7 +8,7 @@ %% %% This file was generated from file(s) of the LaTeX package "zref-clever". %% -%% Copyright (C) 2021 Gustavo Barros +%% Copyright (C) 2021-2022 Gustavo Barros %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -53,7 +53,7 @@ }% \endinput }% -\ProvidesExplPackage {zref-clever} {2021-12-07} {0.1.1-alpha} +\ProvidesExplPackage {zref-clever} {2022-01-10} {0.1.2-alpha} {Clever LaTeX cross-references based on zref} \RequirePackage { zref-base } \RequirePackage { zref-user } @@ -165,6 +165,11 @@ } \msg_new:nnn { zref-clever } { key-requires-value } { The~'#1'~key~'#2'~requires~a~value~\msg_line_context:. } +\msg_new:nnn { zref-clever } { key-boolean-or-empty } + { + The~key~'#1'~only~accepts~the~values~'true',~'false'~ + or~an~empty~value~\msg_line_context:. + } \msg_new:nnn { zref-clever } { language-declared } { Language~'#1'~is~already~declared~\msg_line_context:.~Nothing~to~do. } \msg_new:nnn { zref-clever } { unknown-language-alias } @@ -242,14 +247,15 @@ { Unknown~value~'#1'~for~'nudgeif'~option~\msg_line_context:. } \msg_new:nnn { zref-clever } { option-document-only } { Option~'#1'~is~only~available~after~\iow_char:N\\begin\{document\}. } -\msg_new:nnn { zref-clever } { dict-loaded } - { Loaded~'#1'~dictionary. } -\msg_new:nnn { zref-clever } { dict-not-available } - { Dictionary~for~'#1'~not~available~\msg_line_context:. } +\msg_new:nnn { zref-clever } { langfile-loaded } + { Loaded~'#1'~language~file. } +\msg_new:nnn { zref-clever } { langfile-not-available } + { Language~file~for~'#1'~not~available~\msg_line_context:. } \msg_new:nnn { zref-clever } { unknown-language-load } { - Language~'#1'~is~unknown~\msg_line_context:.~Unable~to~load~dictionary.~ - See~documentation~for~'\iow_char:N\\zcDeclareLanguage'~and~ + Language~'#1'~is~unknown~\msg_line_context:.~ + Unable~to~load~language~file.~See~documentation~for~ + '\iow_char:N\\zcDeclareLanguage'~and~ '\iow_char:N\\zcDeclareLanguageAlias'. } \msg_new:nnn { zref-clever } { zref-property-undefined } @@ -299,12 +305,17 @@ { Loaded~support~for~'#1'~package. } \msg_new:nnn { zref-clever } { compat-class } { Loaded~support~for~'#1'~documentclass. } -\cs_new_protected:Npn \__zrefclever_def_extract:Nnnn #1#2#3#4 +\msg_new:nnn { zref-clever } { option-deprecated } + { + Option~'#1'~has~been~deprecated~\msg_line_context:.\iow_newline: + Use~'#2'~instead. + } +\cs_new_protected:Npn \__zrefclever_extract_default:Nnnn #1#2#3#4 { \exp_args:NNNo \exp_args:NNo \tl_set:Nn #1 { \zref@extractdefault {#2} {#3} {#4} } } -\cs_generate_variant:Nn \__zrefclever_def_extract:Nnnn { NVnn } +\cs_generate_variant:Nn \__zrefclever_extract_default:Nnnn { NVnn } \cs_new:Npn \__zrefclever_extract_unexp:nnn #1#2#3 { \exp_args:NNo \exp_args:No @@ -314,10 +325,10 @@ \cs_new:Npn \__zrefclever_extract:nnn #1#2#3 { \zref@extractdefault {#1} {#2} {#3} } \tl_new:N \l__zrefclever_setup_type_tl -\tl_new:N \l__zrefclever_dict_language_tl -\tl_new:N \l__zrefclever_dict_decl_case_tl -\seq_new:N \l__zrefclever_dict_declension_seq -\seq_new:N \l__zrefclever_dict_gender_seq +\tl_new:N \l__zrefclever_base_language_tl +\tl_new:N \l__zrefclever_lang_decl_case_tl +\seq_new:N \l__zrefclever_lang_declension_seq +\seq_new:N \l__zrefclever_lang_gender_seq \seq_const_from_clist:Nn \c__zrefclever_ref_options_necessarily_not_type_specific_seq { @@ -334,8 +345,8 @@ listsep , lastsep , rangesep , - refpre , - refpos , + preref , + postref , } \seq_const_from_clist:Nn \c__zrefclever_ref_options_type_names_seq @@ -379,8 +390,8 @@ { \msg_warning:nnn { zref-clever } { language-declared } {#2} } { \prop_gput:Nnn \g__zrefclever_languages_prop {#2} {#2} - \prop_new:c { g__zrefclever_dict_ #2 _prop } - \tl_set:Nn \l__zrefclever_dict_language_tl {#2} + \prop_new:c { g__zrefclever_lang_ #2 _prop } + \tl_set:Nn \l__zrefclever_base_language_tl {#2} \keys_set:nn { zref-clever / declarelang } {#1} } } @@ -406,21 +417,21 @@ declension .code:n = { \prop_gput:cnn - { g__zrefclever_dict_ \l__zrefclever_dict_language_tl _prop } + { g__zrefclever_lang_ \l__zrefclever_base_language_tl _prop } { declension } {#1} } , declension .value_required:n = true , gender .code:n = { \prop_gput:cnn - { g__zrefclever_dict_ \l__zrefclever_dict_language_tl _prop } + { g__zrefclever_lang_ \l__zrefclever_base_language_tl _prop } { gender } {#1} } , gender .value_required:n = true , allcaps .code:n = { \prop_gput:cnn - { g__zrefclever_dict_ \l__zrefclever_dict_language_tl _prop } + { g__zrefclever_lang_ \l__zrefclever_base_language_tl _prop } { allcaps } { true } } , allcaps .value_forbidden:n = true , @@ -429,19 +440,19 @@ { \exp_args:NNx \prop_get:NnNTF \g__zrefclever_languages_prop { \l__zrefclever_ref_language_tl } - \l__zrefclever_dict_language_tl + \l__zrefclever_base_language_tl { \exp_args:NNx \seq_set_from_clist:Nn - \l__zrefclever_dict_declension_seq + \l__zrefclever_lang_declension_seq { \prop_item:cn { - g__zrefclever_dict_ - \l__zrefclever_dict_language_tl _prop + g__zrefclever_lang_ + \l__zrefclever_base_language_tl _prop } { declension } } - \seq_if_empty:NTF \l__zrefclever_dict_declension_seq + \seq_if_empty:NTF \l__zrefclever_lang_declension_seq { \tl_if_empty:NF \l__zrefclever_ref_decl_case_tl { @@ -455,33 +466,33 @@ { \tl_if_empty:NTF \l__zrefclever_ref_decl_case_tl { - \seq_get_left:NN \l__zrefclever_dict_declension_seq + \seq_get_left:NN \l__zrefclever_lang_declension_seq \l__zrefclever_ref_decl_case_tl } { - \seq_if_in:NVF \l__zrefclever_dict_declension_seq + \seq_if_in:NVF \l__zrefclever_lang_declension_seq \l__zrefclever_ref_decl_case_tl { \msg_warning:nnxx { zref-clever } { unknown-decl-case } { \l__zrefclever_ref_decl_case_tl } { \l__zrefclever_ref_language_tl } - \seq_get_left:NN \l__zrefclever_dict_declension_seq + \seq_get_left:NN \l__zrefclever_lang_declension_seq \l__zrefclever_ref_decl_case_tl } } } \exp_args:NNx \seq_set_from_clist:Nn - \l__zrefclever_dict_gender_seq + \l__zrefclever_lang_gender_seq { \prop_item:cn { - g__zrefclever_dict_ - \l__zrefclever_dict_language_tl _prop + g__zrefclever_lang_ + \l__zrefclever_base_language_tl _prop } { gender } } - \seq_if_empty:NTF \l__zrefclever_dict_gender_seq + \seq_if_empty:NTF \l__zrefclever_lang_gender_seq { \tl_if_empty:NF \l__zrefclever_ref_gender_tl { @@ -496,7 +507,7 @@ { \tl_if_empty:NF \l__zrefclever_ref_gender_tl { - \seq_if_in:NVF \l__zrefclever_dict_gender_seq + \seq_if_in:NVF \l__zrefclever_lang_gender_seq \l__zrefclever_ref_gender_tl { \msg_warning:nnxx { zref-clever } @@ -511,13 +522,13 @@ { \prop_item:cn { - g__zrefclever_dict_ - \l__zrefclever_dict_language_tl _prop + g__zrefclever_lang_ + \l__zrefclever_base_language_tl _prop } { allcaps } } { true } - { \bool_set_true:N \l__zrefclever_capitalize_bool } + { \prop_put:Nnn \l__zrefclever_ref_options_prop { cap } { true } } } { \tl_if_empty:NF \l__zrefclever_ref_decl_case_tl @@ -538,97 +549,99 @@ } } } -\seq_new:N \g__zrefclever_loaded_dictionaries_seq -\bool_new:N \l__zrefclever_load_dict_verbose_bool -\cs_new_protected:Npn \__zrefclever_provide_dictionary:n #1 +\seq_new:N \g__zrefclever_loaded_langfiles_seq +\bool_new:N \l__zrefclever_load_langfile_verbose_bool +\cs_new_protected:Npn \__zrefclever_provide_langfile:n #1 { \group_begin: \@bsphack \prop_get:NnNTF \g__zrefclever_languages_prop {#1} - \l__zrefclever_dict_language_tl + \l__zrefclever_base_language_tl { \seq_if_in:NVF - \g__zrefclever_loaded_dictionaries_seq - \l__zrefclever_dict_language_tl + \g__zrefclever_loaded_langfiles_seq + \l__zrefclever_base_language_tl { \exp_args:Nx \file_get:nnNTF - { zref-clever- \l__zrefclever_dict_language_tl .dict } + { zref-clever- \l__zrefclever_base_language_tl .lang } { \ExplSyntaxOn } \l_tmpa_tl { \tl_clear:N \l__zrefclever_setup_type_tl \exp_args:NNx \seq_set_from_clist:Nn - \l__zrefclever_dict_declension_seq + \l__zrefclever_lang_declension_seq { \prop_item:cn { - g__zrefclever_dict_ - \l__zrefclever_dict_language_tl _prop + g__zrefclever_lang_ + \l__zrefclever_base_language_tl _prop } { declension } } - \seq_if_empty:NTF \l__zrefclever_dict_declension_seq - { \tl_clear:N \l__zrefclever_dict_decl_case_tl } + \seq_if_empty:NTF \l__zrefclever_lang_declension_seq + { \tl_clear:N \l__zrefclever_lang_decl_case_tl } { - \seq_get_left:NN \l__zrefclever_dict_declension_seq - \l__zrefclever_dict_decl_case_tl + \seq_get_left:NN \l__zrefclever_lang_declension_seq + \l__zrefclever_lang_decl_case_tl } \exp_args:NNx \seq_set_from_clist:Nn - \l__zrefclever_dict_gender_seq + \l__zrefclever_lang_gender_seq { \prop_item:cn { - g__zrefclever_dict_ - \l__zrefclever_dict_language_tl _prop + g__zrefclever_lang_ + \l__zrefclever_base_language_tl _prop } { gender } } - \keys_set:nV { zref-clever / dictionary } \l_tmpa_tl - \seq_gput_right:NV \g__zrefclever_loaded_dictionaries_seq - \l__zrefclever_dict_language_tl - \msg_note:nnx { zref-clever } { dict-loaded } - { \l__zrefclever_dict_language_tl } + \keys_set:nV { zref-clever / langfile } \l_tmpa_tl + \seq_gput_right:NV \g__zrefclever_loaded_langfiles_seq + \l__zrefclever_base_language_tl + \msg_note:nnx { zref-clever } { langfile-loaded } + { \l__zrefclever_base_language_tl } } { - \bool_if:NT \l__zrefclever_load_dict_verbose_bool + \bool_if:NT \l__zrefclever_load_langfile_verbose_bool { - \msg_warning:nnx { zref-clever } { dict-not-available } - { \l__zrefclever_dict_language_tl } + \msg_warning:nnx { zref-clever } { langfile-not-available } + { \l__zrefclever_base_language_tl } } - \seq_gput_right:NV \g__zrefclever_loaded_dictionaries_seq - \l__zrefclever_dict_language_tl + \seq_gput_right:NV \g__zrefclever_loaded_langfiles_seq + \l__zrefclever_base_language_tl } } } { - \bool_if:NT \l__zrefclever_load_dict_verbose_bool + \bool_if:NT \l__zrefclever_load_langfile_verbose_bool { \msg_warning:nnn { zref-clever } { unknown-language-load } {#1} } } \@esphack \group_end: } -\cs_generate_variant:Nn \__zrefclever_provide_dictionary:n { x } -\cs_new_protected:Npn \__zrefclever_provide_dictionary_verbose:n #1 +\cs_generate_variant:Nn \__zrefclever_provide_langfile:n { x } +\cs_new_protected:Npn \__zrefclever_provide_langfile_verbose:n #1 { \group_begin: - \bool_set_true:N \l__zrefclever_load_dict_verbose_bool - \__zrefclever_provide_dictionary:n {#1} + \bool_set_true:N \l__zrefclever_load_langfile_verbose_bool + \__zrefclever_provide_langfile:n {#1} \group_end: } -\cs_generate_variant:Nn \__zrefclever_provide_dictionary_verbose:n { x } -\cs_new_protected:Npn \__zrefclever_provide_dict_type_transl:nn #1#2 +\cs_generate_variant:Nn \__zrefclever_provide_langfile_verbose:n { x } +\cs_new_protected:Npn \__zrefclever_provide_lang_opt_type:nn #1#2 { \exp_args:Nnx \prop_gput_if_new:cnn - { g__zrefclever_dict_ \l__zrefclever_dict_language_tl _prop } + { g__zrefclever_lang_ \l__zrefclever_base_language_tl _prop } { type- \l__zrefclever_setup_type_tl - #1 } {#2} } -\cs_new_protected:Npn \__zrefclever_provide_dict_default_transl:nn #1#2 +\cs_generate_variant:Nn \__zrefclever_provide_lang_opt_type:nn { nV } +\cs_new_protected:Npn \__zrefclever_provide_lang_opt_default:nn #1#2 { \prop_gput_if_new:cnn - { g__zrefclever_dict_ \l__zrefclever_dict_language_tl _prop } + { g__zrefclever_lang_ \l__zrefclever_base_language_tl _prop } { default- #1 } {#2} } -\keys_define:nn { zref-clever / dictionary } +\cs_generate_variant:Nn \__zrefclever_provide_lang_opt_default:nn { nV } +\keys_define:nn { zref-clever / langfile } { type .code:n = { @@ -636,31 +649,33 @@ { \tl_clear:N \l__zrefclever_setup_type_tl } { \tl_set:Nn \l__zrefclever_setup_type_tl {#1} } } , + case .code:n = { - \seq_if_empty:NTF \l__zrefclever_dict_declension_seq + \seq_if_empty:NTF \l__zrefclever_lang_declension_seq { \msg_info:nnxx { zref-clever } { language-no-decl-setup } - { \l__zrefclever_dict_language_tl } {#1} + { \l__zrefclever_base_language_tl } {#1} } { - \seq_if_in:NnTF \l__zrefclever_dict_declension_seq {#1} - { \tl_set:Nn \l__zrefclever_dict_decl_case_tl {#1} } + \seq_if_in:NnTF \l__zrefclever_lang_declension_seq {#1} + { \tl_set:Nn \l__zrefclever_lang_decl_case_tl {#1} } { \msg_info:nnxx { zref-clever } { unknown-decl-case } - {#1} { \l__zrefclever_dict_language_tl } - \seq_get_left:NN \l__zrefclever_dict_declension_seq - \l__zrefclever_dict_decl_case_tl + {#1} { \l__zrefclever_base_language_tl } + \seq_get_left:NN \l__zrefclever_lang_declension_seq + \l__zrefclever_lang_decl_case_tl } } } , case .value_required:n = true , + gender .code:n = { - \seq_if_empty:NTF \l__zrefclever_dict_gender_seq + \seq_if_empty:NTF \l__zrefclever_lang_gender_seq { \msg_info:nnxxx { zref-clever } { language-no-gender } - { \l__zrefclever_dict_language_tl } { gender } {#1} + { \l__zrefclever_base_language_tl } { gender } {#1} } { \tl_if_empty:NTF \l__zrefclever_setup_type_tl @@ -669,27 +684,71 @@ { option-only-type-specific } { gender } } { - \seq_if_in:NnTF \l__zrefclever_dict_gender_seq {#1} - { \__zrefclever_provide_dict_type_transl:nn { gender } {#1} } + \clist_clear:N \l_tmpa_clist + \clist_map_inline:nn {#1} + { + \seq_if_in:NnTF \l__zrefclever_lang_gender_seq {##1} + { \clist_put_right:Nn \l_tmpa_clist {##1} } + { + \msg_info:nnxx { zref-clever } + { gender-not-declared } + { \l__zrefclever_base_language_tl } {##1} + } + } + \clist_if_empty:NF \l_tmpa_clist { - \msg_info:nnxx { zref-clever } { gender-not-declared } - { \l__zrefclever_dict_language_tl } {#1} + \exp_args:Nnx \__zrefclever_provide_lang_opt_type:nn + { gender } { \clist_use:Nn \l_tmpa_clist { , } } } } } } , gender .value_required:n = true , + + cap .choices:nn = + { true , false } + { + \tl_if_empty:NTF \l__zrefclever_setup_type_tl + { + \__zrefclever_provide_lang_opt_default:nV + { cap } \l_keys_choice_tl + } + { + \__zrefclever_provide_lang_opt_type:nV + { cap } \l_keys_choice_tl + } + } , + cap .default:n = true , + nocap .meta:n = { cap = false } , + nocap .value_forbidden:n = true , + + abbrev .choices:nn = + { true , false } + { + \tl_if_empty:NTF \l__zrefclever_setup_type_tl + { + \__zrefclever_provide_lang_opt_default:nV + { abbrev } \l_keys_choice_tl + } + { + \__zrefclever_provide_lang_opt_type:nV + { abbrev } \l_keys_choice_tl + } + } , + abbrev .default:n = true , + noabbrev .meta:n = { abbrev = false }, + noabbrev .value_forbidden:n = true , } \seq_map_inline:Nn \c__zrefclever_ref_options_necessarily_not_type_specific_seq { - \keys_define:nn { zref-clever / dictionary } + \keys_define:nn { zref-clever / langfile } { #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l__zrefclever_setup_type_tl - { \__zrefclever_provide_dict_default_transl:nn {#1} {##1} } + { \__zrefclever_provide_lang_opt_default:nn {#1} {##1} } { \msg_info:nnn { zref-clever } { option-not-type-specific } {#1} @@ -700,21 +759,21 @@ \seq_map_inline:Nn \c__zrefclever_ref_options_possibly_type_specific_seq { - \keys_define:nn { zref-clever / dictionary } + \keys_define:nn { zref-clever / langfile } { #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l__zrefclever_setup_type_tl - { \__zrefclever_provide_dict_default_transl:nn {#1} {##1} } - { \__zrefclever_provide_dict_type_transl:nn {#1} {##1} } + { \__zrefclever_provide_lang_opt_default:nn {#1} {##1} } + { \__zrefclever_provide_lang_opt_type:nn {#1} {##1} } } , } } \seq_map_inline:Nn \c__zrefclever_ref_options_type_names_seq { - \keys_define:nn { zref-clever / dictionary } + \keys_define:nn { zref-clever / langfile } { #1 .value_required:n = true , #1 .code:n = @@ -725,18 +784,18 @@ { option-only-type-specific } {#1} } { - \tl_if_empty:NTF \l__zrefclever_dict_decl_case_tl - { \__zrefclever_provide_dict_type_transl:nn {#1} {##1} } + \tl_if_empty:NTF \l__zrefclever_lang_decl_case_tl + { \__zrefclever_provide_lang_opt_type:nn {#1} {##1} } { - \__zrefclever_provide_dict_type_transl:nn - { \l__zrefclever_dict_decl_case_tl - #1 } {##1} + \__zrefclever_provide_lang_opt_type:nn + { \l__zrefclever_lang_decl_case_tl - #1 } {##1} } } } , } } -\prop_new:N \g__zrefclever_fallback_dict_prop -\prop_gset_from_keyval:Nn \g__zrefclever_fallback_dict_prop +\prop_new:N \g__zrefclever_fallback_unknown_lang_prop +\prop_gset_from_keyval:Nn \g__zrefclever_fallback_unknown_lang_prop { tpairsep = {,~} , tlistsep = {,~} , @@ -747,17 +806,17 @@ listsep = {,~} , lastsep = {,~} , rangesep = {\textendash} , - refpre = {} , - refpos = {} , + preref = {} , + postref = {} , } \prg_new_protected_conditional:Npnn - \__zrefclever_get_type_transl:nnnN #1#2#3#4 { F } + \__zrefclever_get_lang_opt_type:nnnN #1#2#3#4 { F } { \prop_get:NnNTF \g__zrefclever_languages_prop {#1} - \l__zrefclever_dict_language_tl + \l__zrefclever_base_language_tl { \prop_get:cnNTF - { g__zrefclever_dict_ \l__zrefclever_dict_language_tl _prop } + { g__zrefclever_lang_ \l__zrefclever_base_language_tl _prop } { type- #2 - #3 } #4 { \prg_return_true: } { \prg_return_false: } @@ -765,15 +824,15 @@ { \prg_return_false: } } \prg_generate_conditional_variant:Nnn - \__zrefclever_get_type_transl:nnnN { xxxN , xxnN } { F } + \__zrefclever_get_lang_opt_type:nnnN { xxxN , xxnN } { F } \prg_new_protected_conditional:Npnn - \__zrefclever_get_default_transl:nnN #1#2#3 { F } + \__zrefclever_get_lang_opt_default:nnN #1#2#3 { F } { \prop_get:NnNTF \g__zrefclever_languages_prop {#1} - \l__zrefclever_dict_language_tl + \l__zrefclever_base_language_tl { \prop_get:cnNTF - { g__zrefclever_dict_ \l__zrefclever_dict_language_tl _prop } + { g__zrefclever_lang_ \l__zrefclever_base_language_tl _prop } { default- #2 } #3 { \prg_return_true: } { \prg_return_false: } @@ -781,11 +840,11 @@ { \prg_return_false: } } \prg_generate_conditional_variant:Nnn - \__zrefclever_get_default_transl:nnN { xnN } { F } + \__zrefclever_get_lang_opt_default:nnN { xnN } { F } \prg_new_protected_conditional:Npnn - \__zrefclever_get_fallback_transl:nN #1#2 { F } + \__zrefclever_get_fallback_unknown_lang_opt:nN #1#2 { F } { - \prop_get:NnNTF \g__zrefclever_fallback_dict_prop + \prop_get:NnNTF \g__zrefclever_fallback_unknown_lang_prop { #1 } #2 { \prg_return_true: } { \prg_return_false: } @@ -881,26 +940,50 @@ range .initial:n = false , range .default:n = true , } -\bool_new:N \l__zrefclever_capitalize_bool \bool_new:N \l__zrefclever_capitalize_first_bool \keys_define:nn { zref-clever / reference } { - cap .bool_set:N = \l__zrefclever_capitalize_bool , - cap .initial:n = false , + cap .code:n = + { + \tl_if_empty:nTF {#1} + { \prop_remove:Nn \l__zrefclever_ref_options_prop { cap } } + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#1} { true } } + { \str_if_eq_p:nn {#1} { false } } + { \prop_put:Nnn \l__zrefclever_ref_options_prop { cap } {#1} } + { + \msg_warning:nnn { zref-clever } + { key-boolean-or-empty } {#1} + } + } + } , cap .default:n = true , - nocap .meta:n = { cap = false }, + nocap .meta:n = { cap = false } , nocap .value_forbidden:n = true , capfirst .bool_set:N = \l__zrefclever_capitalize_first_bool , capfirst .initial:n = false , capfirst .default:n = true , } -\bool_new:N \l__zrefclever_abbrev_bool \bool_new:N \l__zrefclever_noabbrev_first_bool \keys_define:nn { zref-clever / reference } { - abbrev .bool_set:N = \l__zrefclever_abbrev_bool , - abbrev .initial:n = false , + abbrev .code:n = + { + \tl_if_empty:nTF {#1} + { \prop_remove:Nn \l__zrefclever_ref_options_prop { abbrev } } + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#1} { true } } + { \str_if_eq_p:nn {#1} { false } } + { \prop_put:Nnn \l__zrefclever_ref_options_prop { abbrev } {#1} } + { + \msg_warning:nnn { zref-clever } + { key-boolean-or-empty } {#1} + } + } + } , abbrev .default:n = true , noabbrev .meta:n = { abbrev = false }, noabbrev .value_forbidden:n = true , @@ -1015,7 +1098,7 @@ { \tl_set:Nn \l__zrefclever_ref_language_tl { \l__zrefclever_current_language_tl } - \__zrefclever_provide_dictionary_verbose:x + \__zrefclever_provide_langfile_verbose:x { \l__zrefclever_ref_language_tl } } @@ -1023,7 +1106,7 @@ { \tl_set:Nn \l__zrefclever_ref_language_tl { \l__zrefclever_main_language_tl } - \__zrefclever_provide_dictionary_verbose:x + \__zrefclever_provide_langfile_verbose:x { \l__zrefclever_ref_language_tl } } } @@ -1036,7 +1119,7 @@ \tl_set:Nn \l__zrefclever_ref_language_tl { \l__zrefclever_current_language_tl } } - \__zrefclever_provide_dictionary_verbose:x + \__zrefclever_provide_langfile_verbose:x { \l__zrefclever_ref_language_tl } } } @@ -1047,7 +1130,7 @@ { \AddToHook { begindocument } { - \__zrefclever_provide_dictionary:x { \l__zrefclever_ref_language_tl } + \__zrefclever_provide_langfile:x { \l__zrefclever_ref_language_tl } \keys_define:nn { zref-clever / reference } { lang .code:n = @@ -1058,7 +1141,7 @@ { \tl_set:Nn \l__zrefclever_ref_language_tl { \l__zrefclever_current_language_tl } - \__zrefclever_provide_dictionary:x + \__zrefclever_provide_langfile:x { \l__zrefclever_ref_language_tl } } @@ -1066,7 +1149,7 @@ { \tl_set:Nn \l__zrefclever_ref_language_tl { \l__zrefclever_main_language_tl } - \__zrefclever_provide_dictionary:x + \__zrefclever_provide_langfile:x { \l__zrefclever_ref_language_tl } } } @@ -1079,7 +1162,7 @@ \tl_set:Nn \l__zrefclever_ref_language_tl { \l__zrefclever_current_language_tl } } - \__zrefclever_provide_dictionary:x + \__zrefclever_provide_langfile:x { \l__zrefclever_ref_language_tl } } } , @@ -1377,6 +1460,21 @@ } , } } +\keys_define:nn { zref-clever / reference } + { + refpre .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpre } { preref } + } , + refpos .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpos } { postref } + } , + } \keys_define:nn { } { zref-clever / zcsetup .inherit:n = @@ -1398,6 +1496,74 @@ \tl_set:Nn \l__zrefclever_setup_type_tl {#1} \keys_set:nn { zref-clever / typesetup } {#2} } +\keys_define:nn { zref-clever / typesetup } + { + cap .code:n = + { + \tl_if_empty:nTF {#1} + { + \prop_remove:cn + { + l__zrefclever_type_ + \l__zrefclever_setup_type_tl _options_prop + } + { cap } + } + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#1} { true } } + { \str_if_eq_p:nn {#1} { false } } + { + \prop_put:cnn + { + l__zrefclever_type_ + \l__zrefclever_setup_type_tl _options_prop + } + { cap } {#1} + } + { + \msg_warning:nnn { zref-clever } + { key-boolean-or-empty } {#1} + } + } + } , + cap .default:n = true , + nocap .meta:n = { cap = false } , + nocap .value_forbidden:n = true , + + abbrev .code:n = + { + \tl_if_empty:nTF {#1} + { + \prop_remove:cn + { + l__zrefclever_type_ + \l__zrefclever_setup_type_tl _options_prop + } + { abbrev } + } + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#1} { true } } + { \str_if_eq_p:nn {#1} { false } } + { + \prop_put:cnn + { + l__zrefclever_type_ + \l__zrefclever_setup_type_tl _options_prop + } + { abbrev } {#1} + } + { + \msg_warning:nnn { zref-clever } + { key-boolean-or-empty } {#1} + } + } + } , + abbrev .default:n = true , + noabbrev .meta:n = { abbrev = false }, + noabbrev .value_forbidden:n = true , + } \seq_map_inline:Nn \c__zrefclever_ref_options_necessarily_not_type_specific_seq { @@ -1438,36 +1604,51 @@ } , } } +\keys_define:nn { zref-clever / typesetup } + { + refpre .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpre } { preref } + } , + refpos .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpos } { postref } + } , + } \NewDocumentCommand \zcLanguageSetup { m m } { \group_begin: \prop_get:NnNTF \g__zrefclever_languages_prop {#1} - \l__zrefclever_dict_language_tl + \l__zrefclever_base_language_tl { \tl_clear:N \l__zrefclever_setup_type_tl \exp_args:NNx \seq_set_from_clist:Nn - \l__zrefclever_dict_declension_seq + \l__zrefclever_lang_declension_seq { \prop_item:cn { - g__zrefclever_dict_ - \l__zrefclever_dict_language_tl _prop + g__zrefclever_lang_ + \l__zrefclever_base_language_tl _prop } { declension } } - \seq_if_empty:NTF \l__zrefclever_dict_declension_seq - { \tl_clear:N \l__zrefclever_dict_decl_case_tl } + \seq_if_empty:NTF \l__zrefclever_lang_declension_seq + { \tl_clear:N \l__zrefclever_lang_decl_case_tl } { - \seq_get_left:NN \l__zrefclever_dict_declension_seq - \l__zrefclever_dict_decl_case_tl + \seq_get_left:NN \l__zrefclever_lang_declension_seq + \l__zrefclever_lang_decl_case_tl } \exp_args:NNx \seq_set_from_clist:Nn - \l__zrefclever_dict_gender_seq + \l__zrefclever_lang_gender_seq { \prop_item:cn { - g__zrefclever_dict_ - \l__zrefclever_dict_language_tl _prop + g__zrefclever_lang_ + \l__zrefclever_base_language_tl _prop } { gender } } @@ -1477,18 +1658,19 @@ \group_end: } \@onlypreamble \zcLanguageSetup -\cs_new_protected:Npn \__zrefclever_declare_type_transl:nnnn #1#2#3#4 +\cs_new_protected:Npn \__zrefclever_declare_lang_opt_type:nnnn #1#2#3#4 { - \prop_gput:cnn { g__zrefclever_dict_ #1 _prop } + \prop_gput:cnn { g__zrefclever_lang_ #1 _prop } { type- #2 - #3 } {#4} } -\cs_generate_variant:Nn \__zrefclever_declare_type_transl:nnnn { VVnn , VVxn } -\cs_new_protected:Npn \__zrefclever_declare_default_transl:nnn #1#2#3 +\cs_generate_variant:Nn + \__zrefclever_declare_lang_opt_type:nnnn { VVnn , VVxn , VVnx , VVnV } +\cs_new_protected:Npn \__zrefclever_declare_lang_opt_default:nnn #1#2#3 { - \prop_gput:cnn { g__zrefclever_dict_ #1 _prop } + \prop_gput:cnn { g__zrefclever_lang_ #1 _prop } { default- #2 } {#3} } -\cs_generate_variant:Nn \__zrefclever_declare_default_transl:nnn { Vnn } +\cs_generate_variant:Nn \__zrefclever_declare_lang_opt_default:nnn { Vnn , VnV } \keys_define:nn { zref-clever / langsetup } { type .code:n = @@ -1497,31 +1679,33 @@ { \tl_clear:N \l__zrefclever_setup_type_tl } { \tl_set:Nn \l__zrefclever_setup_type_tl {#1} } } , + case .code:n = { - \seq_if_empty:NTF \l__zrefclever_dict_declension_seq + \seq_if_empty:NTF \l__zrefclever_lang_declension_seq { \msg_warning:nnxx { zref-clever } { language-no-decl-setup } - { \l__zrefclever_dict_language_tl } {#1} + { \l__zrefclever_base_language_tl } {#1} } { - \seq_if_in:NnTF \l__zrefclever_dict_declension_seq {#1} - { \tl_set:Nn \l__zrefclever_dict_decl_case_tl {#1} } + \seq_if_in:NnTF \l__zrefclever_lang_declension_seq {#1} + { \tl_set:Nn \l__zrefclever_lang_decl_case_tl {#1} } { \msg_warning:nnxx { zref-clever } { unknown-decl-case } - {#1} { \l__zrefclever_dict_language_tl } - \seq_get_left:NN \l__zrefclever_dict_declension_seq - \l__zrefclever_dict_decl_case_tl + {#1} { \l__zrefclever_base_language_tl } + \seq_get_left:NN \l__zrefclever_lang_declension_seq + \l__zrefclever_lang_decl_case_tl } } } , case .value_required:n = true , + gender .code:n = { - \seq_if_empty:NTF \l__zrefclever_dict_gender_seq + \seq_if_empty:NTF \l__zrefclever_lang_gender_seq { \msg_warning:nnxxx { zref-clever } { language-no-gender } - { \l__zrefclever_dict_language_tl } { gender } {#1} + { \l__zrefclever_base_language_tl } { gender } {#1} } { \tl_if_empty:NTF \l__zrefclever_setup_type_tl @@ -1530,21 +1714,68 @@ { option-only-type-specific } { gender } } { - \seq_if_in:NnTF \l__zrefclever_dict_gender_seq {#1} + \clist_clear:N \l_tmpa_clist + \clist_map_inline:nn {#1} { - \__zrefclever_declare_type_transl:VVnn - \l__zrefclever_dict_language_tl - \l__zrefclever_setup_type_tl - { gender } {#1} + \seq_if_in:NnTF \l__zrefclever_lang_gender_seq {##1} + { \clist_put_right:Nn \l_tmpa_clist {##1} } + { + \msg_warning:nnxx { zref-clever } + { gender-not-declared } + { \l__zrefclever_base_language_tl } {##1} + } } + \clist_if_empty:NF \l_tmpa_clist { - \msg_warning:nnxx { zref-clever } { gender-not-declared } - { \l__zrefclever_dict_language_tl } {#1} + \__zrefclever_declare_lang_opt_type:VVnx + \l__zrefclever_base_language_tl + \l__zrefclever_setup_type_tl + { gender } { \clist_use:Nn \l_tmpa_clist { , } } } } } } , gender .value_required:n = true , + + cap .choices:nn = + { true , false } + { + \tl_if_empty:NTF \l__zrefclever_setup_type_tl + { + \__zrefclever_declare_lang_opt_default:VnV + \l__zrefclever_base_language_tl + { cap } \l_keys_choice_tl + } + { + \__zrefclever_declare_lang_opt_type:VVnV + \l__zrefclever_base_language_tl + \l__zrefclever_setup_type_tl + { cap } \l_keys_choice_tl + } + } , + cap .default:n = true , + nocap .meta:n = { cap = false } , + nocap .value_forbidden:n = true , + + abbrev .choices:nn = + { true , false } + { + \tl_if_empty:NTF \l__zrefclever_setup_type_tl + { + \__zrefclever_declare_lang_opt_default:VnV + \l__zrefclever_base_language_tl + { abbrev } \l_keys_choice_tl + } + { + \__zrefclever_declare_lang_opt_type:VVnV + \l__zrefclever_base_language_tl + \l__zrefclever_setup_type_tl + { abbrev } \l_keys_choice_tl + } + } , + abbrev .default:n = true , + noabbrev .meta:n = { abbrev = false }, + noabbrev .value_forbidden:n = true , } \seq_map_inline:Nn \c__zrefclever_ref_options_necessarily_not_type_specific_seq @@ -1556,8 +1787,8 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \__zrefclever_declare_default_transl:Vnn - \l__zrefclever_dict_language_tl + \__zrefclever_declare_lang_opt_default:Vnn + \l__zrefclever_base_language_tl {#1} {##1} } { @@ -1577,19 +1808,34 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \__zrefclever_declare_default_transl:Vnn - \l__zrefclever_dict_language_tl + \__zrefclever_declare_lang_opt_default:Vnn + \l__zrefclever_base_language_tl {#1} {##1} } { - \__zrefclever_declare_type_transl:VVnn - \l__zrefclever_dict_language_tl + \__zrefclever_declare_lang_opt_type:VVnn + \l__zrefclever_base_language_tl \l__zrefclever_setup_type_tl {#1} {##1} } } , } } +\keys_define:nn { zref-clever / langsetup } + { + refpre .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpre } { preref } + } , + refpos .code:n = + { + % NOTE Option deprecated in 2022-01-10 for v0.1.2-alpha. + \msg_warning:nnnn { zref-clever }{ option-deprecated } + { refpos } { postref } + } , + } \seq_map_inline:Nn \c__zrefclever_ref_options_type_names_seq { @@ -1604,18 +1850,18 @@ { option-only-type-specific } {#1} } { - \tl_if_empty:NTF \l__zrefclever_dict_decl_case_tl + \tl_if_empty:NTF \l__zrefclever_lang_decl_case_tl { - \__zrefclever_declare_type_transl:VVnn - \l__zrefclever_dict_language_tl + \__zrefclever_declare_lang_opt_type:VVnn + \l__zrefclever_base_language_tl \l__zrefclever_setup_type_tl {#1} {##1} } { - \__zrefclever_declare_type_transl:VVxn - \l__zrefclever_dict_language_tl + \__zrefclever_declare_lang_opt_type:VVxn + \l__zrefclever_base_language_tl \l__zrefclever_setup_type_tl - { \l__zrefclever_dict_decl_case_tl - #1 } {##1} + { \l__zrefclever_lang_decl_case_tl - #1 } {##1} } } } , @@ -1629,7 +1875,7 @@ \keys_set:nn { zref-clever / reference } {#3} \seq_set_from_clist:Nn \l__zrefclever_zcref_labels_seq {#1} \bool_set:Nn \l__zrefclever_link_star_bool {#2} - \__zrefclever_provide_dictionary:x { \l__zrefclever_ref_language_tl } + \__zrefclever_provide_langfile:x { \l__zrefclever_ref_language_tl } \__zrefclever_process_language_options: \bool_lazy_and:nnT { \l__zrefclever_zrefcheck_available_bool } @@ -1645,7 +1891,7 @@ \group_end: \tl_if_empty:NF \l__zrefclever_zcref_note_tl { - \__zrefclever_get_ref_string:nN { notesep } \l_tmpa_tl + \__zrefclever_get_ref_opt_typeset:nN { notesep } \l_tmpa_tl \l_tmpa_tl \l__zrefclever_zcref_note_tl } @@ -1726,7 +1972,7 @@ } \cs_new_protected:Npn \__zrefclever_label_type_put_new_right:n #1 { - \__zrefclever_def_extract:Nnnn + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_type_a_tl {#1} { zc@type } { \c_empty_tl } \seq_if_in:NVF \l__zrefclever_label_types_seq \l__zrefclever_label_type_a_tl @@ -1737,9 +1983,9 @@ } \cs_new_protected:Npn \__zrefclever_sort_default:nn #1#2 { - \__zrefclever_def_extract:Nnnn + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_type_a_tl {#1} { zc@type } { zc@missingtype } - \__zrefclever_def_extract:Nnnn + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_type_b_tl {#2} { zc@type } { zc@missingtype } \tl_if_eq:NNTF @@ -1750,15 +1996,15 @@ } \cs_new_protected:Npn \__zrefclever_sort_default_same_type:nn #1#2 { - \__zrefclever_def_extract:Nnnn \l__zrefclever_label_enclval_a_tl + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_enclval_a_tl {#1} { zc@enclval } { \c_empty_tl } \tl_reverse:N \l__zrefclever_label_enclval_a_tl - \__zrefclever_def_extract:Nnnn \l__zrefclever_label_enclval_b_tl + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_enclval_b_tl {#2} { zc@enclval } { \c_empty_tl } \tl_reverse:N \l__zrefclever_label_enclval_b_tl - \__zrefclever_def_extract:Nnnn \l__zrefclever_label_extdoc_a_tl + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_extdoc_a_tl {#1} { externaldocument } { \c_empty_tl } - \__zrefclever_def_extract:Nnnn \l__zrefclever_label_extdoc_b_tl + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_extdoc_b_tl {#2} { externaldocument } { \c_empty_tl } \bool_set_false:N \l__zrefclever_sort_decided_bool @@ -1968,10 +2214,12 @@ \tl_new:N \l__zrefclever_listsep_tl \tl_new:N \l__zrefclever_lastsep_tl \tl_new:N \l__zrefclever_rangesep_tl -\tl_new:N \l__zrefclever_refpre_tl -\tl_new:N \l__zrefclever_refpos_tl +\tl_new:N \l__zrefclever_preref_tl +\tl_new:N \l__zrefclever_postref_tl \tl_new:N \l__zrefclever_namefont_tl \tl_new:N \l__zrefclever_reffont_tl +\bool_new:N \l__zrefclever_capitalize_bool +\bool_new:N \l__zrefclever_abbrev_bool \bool_new:N \l__zrefclever_verbose_testing_bool \cs_new_protected:Npn \__zrefclever_typeset_refs: { @@ -1988,11 +2236,11 @@ \int_zero:N \l__zrefclever_range_same_count_int % Get type block options (not type-specific). - \__zrefclever_get_ref_string:nN { tpairsep } + \__zrefclever_get_ref_opt_typeset:nN { tpairsep } \l__zrefclever_tpairsep_tl - \__zrefclever_get_ref_string:nN { tlistsep } + \__zrefclever_get_ref_opt_typeset:nN { tlistsep } \l__zrefclever_tlistsep_tl - \__zrefclever_get_ref_string:nN { tlastsep } + \__zrefclever_get_ref_opt_typeset:nN { tlastsep } \l__zrefclever_tlastsep_tl % Process label stack. @@ -2017,9 +2265,11 @@ \tl_set:Nn \l__zrefclever_label_type_b_tl { page } } { - \__zrefclever_def_extract:NVnn \l__zrefclever_label_type_a_tl + \__zrefclever_extract_default:NVnn + \l__zrefclever_label_type_a_tl \l__zrefclever_label_a_tl { zc@type } { zc@missingtype } - \__zrefclever_def_extract:NVnn \l__zrefclever_label_type_b_tl + \__zrefclever_extract_default:NVnn + \l__zrefclever_label_type_b_tl \l__zrefclever_label_b_tl { zc@type } { zc@missingtype } } @@ -2073,28 +2323,32 @@ } } - % Get type-specific separators, refpre/pos and font options, once per - % type. + % Get type-specific separators, pre-/postref font and other options, + % once per type. \int_compare:nNnT { \l__zrefclever_label_count_int } = { 0 } { - \__zrefclever_get_ref_string:nN { namesep } + \__zrefclever_get_ref_opt_typeset:nN { namesep } \l__zrefclever_namesep_tl - \__zrefclever_get_ref_string:nN { pairsep } + \__zrefclever_get_ref_opt_typeset:nN { pairsep } \l__zrefclever_pairsep_tl - \__zrefclever_get_ref_string:nN { listsep } + \__zrefclever_get_ref_opt_typeset:nN { listsep } \l__zrefclever_listsep_tl - \__zrefclever_get_ref_string:nN { lastsep } + \__zrefclever_get_ref_opt_typeset:nN { lastsep } \l__zrefclever_lastsep_tl - \__zrefclever_get_ref_string:nN { rangesep } + \__zrefclever_get_ref_opt_typeset:nN { rangesep } \l__zrefclever_rangesep_tl - \__zrefclever_get_ref_string:nN { refpre } - \l__zrefclever_refpre_tl - \__zrefclever_get_ref_string:nN { refpos } - \l__zrefclever_refpos_tl - \__zrefclever_get_ref_font:nN { namefont } + \__zrefclever_get_ref_opt_typeset:nN { preref } + \l__zrefclever_preref_tl + \__zrefclever_get_ref_opt_typeset:nN { postref } + \l__zrefclever_postref_tl + \__zrefclever_get_ref_opt_font:nN { namefont } \l__zrefclever_namefont_tl - \__zrefclever_get_ref_font:nN { reffont } + \__zrefclever_get_ref_opt_font:nN { reffont } \l__zrefclever_reffont_tl + \__zrefclever_get_ref_opt_bool:nnN { cap } { false } + \l__zrefclever_capitalize_bool + \__zrefclever_get_ref_opt_bool:nnN { abbrev } { false } + \l__zrefclever_abbrev_bool } % Here we send this to a couple of auxiliary functions. @@ -2565,33 +2819,33 @@ } { \bool_if:NF \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpre_tl } + { \exp_not:V \l__zrefclever_preref_tl } % It's two `@s', but escaped for DocStrip. \exp_not:N \hyper@@link { \__zrefclever_extract_url_unexp:n {#1} } { \__zrefclever_extract_unexp:nnn {#1} { anchor } { } } { \bool_if:NT \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpre_tl } + { \exp_not:V \l__zrefclever_preref_tl } \exp_not:N \group_begin: \exp_not:V \l__zrefclever_reffont_tl \__zrefclever_extract_unexp:nvn {#1} { l__zrefclever_ref_property_tl } { } \exp_not:N \group_end: \bool_if:NT \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpos_tl } + { \exp_not:V \l__zrefclever_postref_tl } } \bool_if:NF \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpos_tl } + { \exp_not:V \l__zrefclever_postref_tl } } { - \exp_not:V \l__zrefclever_refpre_tl + \exp_not:V \l__zrefclever_preref_tl \exp_not:N \group_begin: \exp_not:V \l__zrefclever_reffont_tl \__zrefclever_extract_unexp:nvn {#1} { l__zrefclever_ref_property_tl } { } \exp_not:N \group_end: - \exp_not:V \l__zrefclever_refpos_tl + \exp_not:V \l__zrefclever_postref_tl } } { \__zrefclever_ref_default: } @@ -2624,7 +2878,7 @@ \exp_not:V \l__zrefclever_type_name_tl \exp_not:N \group_end: \exp_not:V \l__zrefclever_namesep_tl - \exp_not:V \l__zrefclever_refpre_tl + \exp_not:V \l__zrefclever_preref_tl \exp_not:N \group_begin: \exp_not:V \l__zrefclever_reffont_tl \__zrefclever_extract_unexp:Vvn @@ -2632,10 +2886,10 @@ { l__zrefclever_ref_property_tl } { } \exp_not:N \group_end: \bool_if:NT \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpos_tl } + { \exp_not:V \l__zrefclever_postref_tl } } \bool_if:NF \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpos_tl } + { \exp_not:V \l__zrefclever_postref_tl } } { \exp_not:N \group_begin: @@ -2670,7 +2924,7 @@ } { \bool_if:NF \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpre_tl } + { \exp_not:V \l__zrefclever_preref_tl } % It's two '@s', but escaped for DocStrip. \exp_not:N \hyper@@link { @@ -2683,7 +2937,7 @@ } { \bool_if:NT \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpre_tl } + { \exp_not:V \l__zrefclever_preref_tl } \exp_not:N \group_begin: \exp_not:V \l__zrefclever_reffont_tl \__zrefclever_extract_unexp:Vvn @@ -2691,20 +2945,20 @@ { l__zrefclever_ref_property_tl } { } \exp_not:N \group_end: \bool_if:NT \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpos_tl } + { \exp_not:V \l__zrefclever_postref_tl } } \bool_if:NF \l__zrefclever_preposinlink_bool - { \exp_not:V \l__zrefclever_refpos_tl } + { \exp_not:V \l__zrefclever_postref_tl } } { - \exp_not:V \l__zrefclever_refpre_tl + \exp_not:V \l__zrefclever_preref_tl \exp_not:N \group_begin: \exp_not:V \l__zrefclever_reffont_tl \__zrefclever_extract_unexp:Vvn \l__zrefclever_type_first_label_tl { l__zrefclever_ref_property_tl } { } \exp_not:N \group_end: - \exp_not:V \l__zrefclever_refpos_tl + \exp_not:V \l__zrefclever_postref_tl } } { \__zrefclever_ref_default: } @@ -2780,15 +3034,17 @@ { \l__zrefclever_nudge_gender_bool } { ! \tl_if_empty_p:N \l__zrefclever_ref_gender_tl } { - \__zrefclever_get_type_transl:xxnNF + \__zrefclever_get_lang_opt_type:xxnNF { \l__zrefclever_ref_language_tl } { \l__zrefclever_type_first_label_type_tl } { gender } \l__zrefclever_type_name_gender_tl { \tl_clear:N \l__zrefclever_type_name_gender_tl } - \tl_if_eq:NNF - \l__zrefclever_ref_gender_tl + \clist_set:NV \l_tmpa_clist \l__zrefclever_type_name_gender_tl + \clist_if_in:NVF + \l_tmpa_clist + \l__zrefclever_ref_gender_tl { \tl_if_empty:NTF \l__zrefclever_type_name_gender_tl { @@ -2826,7 +3082,7 @@ \tl_put_left:NV \l__zrefclever_name_format_tl \l__zrefclever_ref_decl_case_tl } - \__zrefclever_get_type_transl:xxxNF + \__zrefclever_get_lang_opt_type:xxxNF { \l__zrefclever_ref_language_tl } { \l__zrefclever_type_first_label_type_tl } { \l__zrefclever_name_format_tl } @@ -2868,13 +3124,13 @@ \l__zrefclever_name_format_fallback_tl \l__zrefclever_ref_decl_case_tl } - \__zrefclever_get_type_transl:xxxNF + \__zrefclever_get_lang_opt_type:xxxNF { \l__zrefclever_ref_language_tl } { \l__zrefclever_type_first_label_type_tl } { \l__zrefclever_name_format_tl } \l__zrefclever_type_name_tl { - \__zrefclever_get_type_transl:xxxNF + \__zrefclever_get_lang_opt_type:xxxNF { \l__zrefclever_ref_language_tl } { \l__zrefclever_type_first_label_type_tl } { \l__zrefclever_name_format_fallback_tl } @@ -2934,9 +3190,9 @@ \cs_generate_variant:Nn \__zrefclever_extract_url_unexp:n { V } \cs_new_protected:Npn \__zrefclever_labels_in_sequence:nn #1#2 { - \__zrefclever_def_extract:Nnnn \l__zrefclever_label_extdoc_a_tl + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_extdoc_a_tl {#1} { externaldocument } { \c_empty_tl } - \__zrefclever_def_extract:Nnnn \l__zrefclever_label_extdoc_b_tl + \__zrefclever_extract_default:Nnnn \l__zrefclever_label_extdoc_b_tl {#2} { externaldocument } { \c_empty_tl } \tl_if_eq:NNT @@ -3008,7 +3264,7 @@ } } } -\cs_new_protected:Npn \__zrefclever_get_ref_string:nN #1#2 +\cs_new_protected:Npn \__zrefclever_get_ref_opt_typeset:nN #1#2 { % First attempt: general options. \prop_get:NnNF \l__zrefclever_ref_options_prop {#1} #2 @@ -3039,19 +3295,19 @@ {#1} #2 } { - % If not found, try type specific translations. - \__zrefclever_get_type_transl:xxnNF + % If not found, try type- and language-specific. + \__zrefclever_get_lang_opt_type:xxnNF { \l__zrefclever_ref_language_tl } { \l__zrefclever_label_type_a_tl } {#1} #2 { - % If not found, try default translations. - \__zrefclever_get_default_transl:xnNF + % If not found, try language-specific default. + \__zrefclever_get_lang_opt_default:xnNF { \l__zrefclever_ref_language_tl } {#1} #2 { % If not found, try fallback. - \__zrefclever_get_fallback_transl:nNF {#1} #2 + \__zrefclever_get_fallback_unknown_lang_opt:nNF {#1} #2 { \tl_clear:N #2 \msg_warning:nnn { zref-clever } @@ -3062,7 +3318,7 @@ } } } -\cs_new_protected:Npn \__zrefclever_get_ref_font:nN #1#2 +\cs_new_protected:Npn \__zrefclever_get_ref_opt_font:nN #1#2 { % First attempt: general options. \prop_get:NnNF \l__zrefclever_ref_options_prop {#1} #2 @@ -3088,6 +3344,65 @@ { \tl_clear:N #2 } } } +\cs_new_protected:Npn \__zrefclever_get_ref_opt_bool:nnN #1#2#3 + { + % First attempt: general options. + \prop_get:NnNF \l__zrefclever_ref_options_prop {#1} \l_tmpa_tl + { + % If not found, try type specific options. + \bool_lazy_and:nnTF + { + \prop_if_exist_p:c + { + l__zrefclever_type_ + \l__zrefclever_label_type_a_tl _options_prop + } + } + { + \prop_if_in_p:cn + { + l__zrefclever_type_ + \l__zrefclever_label_type_a_tl _options_prop + } + {#1} + } + { + \prop_get:cnN + { + l__zrefclever_type_ + \l__zrefclever_label_type_a_tl _options_prop + } + {#1} \l_tmpa_tl + } + { + % If not found, try type- and language-specific. + \__zrefclever_get_lang_opt_type:xxnNF + { \l__zrefclever_ref_language_tl } + { \l__zrefclever_label_type_a_tl } + {#1} \l_tmpa_tl + { + % If not found, try language-specific default. + \__zrefclever_get_lang_opt_default:xnNF + { \l__zrefclever_ref_language_tl } + {#1} \l_tmpa_tl + { + % If not found, use default argument. + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#2} { true } } + { \str_if_eq_p:nn {#2} { false } } + { \tl_set:Nn \l_tmpa_tl {#2} } + { + % And, if even that fails, presume false. + \tl_set:Nn \l_tmpa_tl { false } + } + } + } + } + } + % Having retrieved the option value, set the boolean. At this point, we + % *know* '\l_tmpa_tl' is either 'true' or 'false'. + \use:c { bool_set_ \l_tmpa_tl :N } #3 + } \__zrefclever_compat_module:nn { appendix } { \AddToHook { cmd / appendix / before } @@ -3325,8 +3640,8 @@ \zcRefTypeSetup { equation } { reffont = \upshape , - refpre = {\textup{(}} , - refpos = {\textup{)}} , + preref = {\textup{(}} , + postref = {\textup{)}} , } \msg_info:nnn { zref-clever } { compat-package } { amsmath } } @@ -3514,6 +3829,7 @@ \zcDeclareLanguageAlias { brazil } { portuguese } \zcDeclareLanguageAlias { portuges } { portuguese } \zcDeclareLanguage [ gender = { f , m } ] { spanish } +\zcDeclareLanguage [ gender = { f , m , n } ] { dutch } %% %% %% End of file `zref-clever.sty'. |