diff options
author | Karl Berry <karl@freefriends.org> | 2018-02-18 22:17:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-02-18 22:17:14 +0000 |
commit | 9a31450570f5578e8502f54797e614d4423e84c6 (patch) | |
tree | 9b90846cc4dd9ce350e6618e40a2358eacb05940 /Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx | |
parent | f0dc75c4cecbf5c2b6f9d99c28f6740b3f89656b (diff) |
knowledge (18feb18)
git-svn-id: svn://tug.org/texlive/trunk@46669 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx | 79 |
1 files changed, 55 insertions, 24 deletions
diff --git a/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx b/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx index 209ecb410c6..b05e9b8cdf8 100644 --- a/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx +++ b/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx @@ -6,7 +6,7 @@ % % meta-comment % -% Copyright (C) 2017 by Thomas Colcombet +% Copyright (C) 2017-2018 by Thomas Colcombet % ----------------------------------- % % This file may be distributed and/or modified under the @@ -23,7 +23,7 @@ % % \iffalse %<head>\usepackage{expl3} -%<head>\ProvidesExplPackage{knowledge}{2017/10/18}{1.07}{} +%<head>\ProvidesExplPackage{knowledge}{2018/02/17}{1.10}{} %<*driver> \def\knowledgecode{active} \input{knowledge.tex} @@ -41,6 +41,8 @@ % \changes{1.06}{2017/10/10}{bug correction} % % \changes{1.07}{2017/10/15}{minor improvements} % % \changes{1.08}{2017/10/17}{minor changes and reorganization of the files} % +% \changes{1.09}{2017/10/31}{minor changes} % +% \changes{1.10}{2018/17/02}{bug fixes} % % \GetFileInfo{knowledge.sty} % % \DoNotIndex{} % @@ -60,8 +62,8 @@ This directory contains the package name: knowledge license: LaTeX Project Public License version 1.2 or above - version: v1.08 - date: 2017/10/17 + version: v1.10 + date: 2018/02/17 author: Thomas Colcombet mail: thomas.colcombet@irif.fr web: https://www.irif.fr/~colcombe/knowledge_en.html @@ -169,6 +171,11 @@ Content of the file knowledge-sources.zip: \cs_new:Nn\knowledge_error:n {\msg_error:nnn{knowledge}{knowledge~error}{#1}} % \end{macrocode} +% The command \csintro{\knowledge_werror:Nn} takes a boolean as argument, and behaves like \cs{\knowledge_error:n} if it is true, and \cs{\knowledge_warning:n} otherwise. +% \begin{macrocode} +\cs_new:Npn\knowledge_werror:Nn#1 + {\bool_if:NTF#1\knowledge_error:n\knowledge_warning:n} +% \end{macrocode} % \begin{macrocode} \msg_new:nnnn{knowledge}{knowledge~info}{#1}{#2} \msg_new:nnnn{knowledge}{knowledge~warning}{#1}{#2} @@ -262,7 +269,7 @@ Content of the file knowledge-sources.zip: % At the same time, it sets at package loading these options to be `posponed' (these will be executed) % when the package loading is completed. % \begin{macrocode} -\newrobustcmd\knowledgeconfigure[1]{ +\newrobustcmd\knowledgeconfigure[1]{ \keys_set:nn{ knowledge~configuration~options }{#1} } % \end{macrocode} @@ -389,6 +396,11 @@ Content of the file knowledge-sources.zip: % Code for a single feature. It takes the name of the trigger followed by the code. % % \begin{macrocode} +\bool_new:N\knowledge_warningstrict_bool +\bool_set_false:N\knowledge_warningstrict_bool +\KnowledgeConfigureBooleanOption[\knowledge_warningstrict_bool]{strict} +% \end{macrocode} +% \begin{macrocode} \bool_new:N\knowledge_configuration_quotation_bool \KnowledgeConfigureBooleanOptionTF[\knowledge_configuration_quotation_bool]{quotation}{\klactivatequotation}{\kldeactivatequotation} \KnowledgeConfigureTrigger{protect~quotation}{\kl_protect_environment_quotation:n{#1}} @@ -1777,10 +1789,10 @@ Content of the file knowledge-sources.zip: % \begin{macrocode} \keys_define:nn { knowledge~directives } { namespace .code:n = { \tl_set:Nn\knowledge_knowledge_namespace_tl{#1} }, - force .choice:, - force / false .code:n = {\bool_set_false:N\knowledge_knowledge_force_bool}, - force / true .code:n = {\bool_set_true:N\knowledge_knowledge_force_bool}, - force .default:n = false, + append .choice:, + append / false .code:n = {\bool_set_false:N\knowledge_knowledge_append_bool}, + append / true .code:n = {\bool_set_true:N\knowledge_knowledge_append_bool}, + append .default:n = false, clear .choice:, clear / false .code:n = {\bool_set_false:N\knowledge_knowledge_clear_bool}, clear / true .code:n = {\bool_set_true:N\knowledge_knowledge_clear_bool}, @@ -1827,7 +1839,11 @@ Content of the file knowledge-sources.zip: \knowledge_at:N\ktuple_if_exist:NTF {\bool_if:NTF\knowledge_knowledgestyle_bool {\knowledge_at:N\ktuple_gclear:N} - {\knowledge_warning:n{knowledge~'#3'~(namespace=#1,~scope=#2)~is~redefined.}}} + {\bool_if:NF\knowledge_knowledge_append_bool + {\bool_if:NF\knowledge_knowledge_clear_bool + \knowledge_werror:Nn\knowledge_warningstrict_bool + {knowledge~'#3'~(namespace=#1,~scope=#2)~is~redefined.}}} + } {\knowledge_at:N\ktuple_new:N} \keys_set:nn { knowledgenow~directives } { #4 } } @@ -1855,27 +1871,37 @@ Content of the file knowledge-sources.zip: % The command \csintro{\__knowledge_knowledge} is the center of the \cs{\knowledge} % command. It parses its arguments (in particular separating the synonyms using the "xparse@@package"), and executes \cs{\knowledge_knowledge_process:nn} % \begin{macrocode} -\NewDocumentCommand\__knowledge_knowledge{m >{\SplitList{|}}o m } +\NewDocumentCommand\__knowledge_knowledge{t! t+ m >{\SplitList{|}}o m } { \kl_hide_begin: \group_begin: + % + \IfBooleanTF{#1}{% + \bool_set_false:N\knowledge_knowledge_append_bool + \bool_set_true:N\knowledge_knowledge_clear_bool + }% + \IfBooleanTF{#2}{% + \bool_set_true:N\knowledge_knowledge_append_bool + \bool_set_false:N\knowledge_knowledge_clear_bool + }% + % \tl_set_eq:NN\knowledge_namespace_tl \knowledge_default_namespace_tl % \bool_gset_false:N\knowledge_knowledge_is_synonym_bool % \use:x{ - \exp_not:n{\knowledge_knowledge_process:nn{#1}} - {\exp_not:V\knowledge_knowledgedefault_tl,\exp_not:n{#3}}} + \exp_not:n{\knowledge_knowledge_process:nn{#3}} + {\exp_not:V\knowledge_knowledgedefault_tl,\exp_not:n{#5}}} % \bool_if:NF\knowledge_knowledge_is_synonym_bool - {\tl_gset:Nn\knowledge_knowledge_synonym_tl{#1} + {\tl_gset:Nn\knowledge_knowledge_synonym_tl{#3} \tl_gset_eq:NN\knowledge_knowledge_synonyminstance_tl \knowledge_knowledge_instance_tl} % - \IfNoValueTF{#2}{}{ + \IfNoValueTF{#4}{}{ \cs_set:Nn\l_tmpa_cs:n {\exp_args:Nnx\knowledge_knowledge_process:nn{##1}{synonym}} - \ProcessList{#2}\l_tmpa_cs:n + \ProcessList{#4}\l_tmpa_cs:n } % \group_end: @@ -1918,10 +1944,10 @@ Content of the file knowledge-sources.zip: \bool_new:N\knowledge_knowledge_alsonow_bool \bool_new:N\knowledge_knowledge_is_synonym_bool \bool_new:N\knowledge_knowledge_autoref_bool +\bool_new:N\knowledge_knowledge_clear_bool +\bool_new:N\knowledge_knowledge_append_bool \tl_clear_new:N\knowledge_knowledge_synonym_tl \tl_clear_new:N\knowledge_knowledge_synonyminstance_tl -\tl_clear_new:N\knowledge_knowledge_clear_bool -\tl_clear_new:N\knowledge_knowledge_force_bool \tl_clear_new:N\knowledge_knowledge_export_bool \tl_clear_new:N\knowledge_knowledge_key_tl \tl_clear_new:N\knowledge_knowledge_namespace_tl @@ -1932,9 +1958,7 @@ Content of the file knowledge-sources.zip: % is the heart of \cs{\knowledge} command. % \begin{macrocode} \cs_new:Nn\knowledge_knowledge_process:nn -{ \bool_set_false:N\knowledge_knowledge_clear_bool - \bool_set_false:N\knowledge_knowledge_force_bool - \bool_set_false:N\knowledge_knowledge_export_bool +{ \bool_set_false:N\knowledge_knowledge_export_bool \bool_set_false:N\knowledge_knowledge_autoref_bool \bool_set_false:N\knowledge_knowledge_now_bool \bool_set_false:N\knowledge_knowledge_alsonow_bool @@ -1952,6 +1976,11 @@ Content of the file knowledge-sources.zip: {\bool_set_true:N\knowledge_knowledge_now_bool} {} % + \bool_if:NT\knowledge_knowledge_clear_bool + {\tl_put_left:Nn\knowledge_knowledge_directives_tl{clear,}} + \bool_if:NT\knowledge_knowledge_append_bool + {\tl_put_left:Nn\knowledge_knowledge_directives_tl{force,}} + % \bool_if:nTF{\knowledge_knowledge_now_bool} {\use:x{ \exp_not:N\knowledge_new_now:nnnn @@ -2680,7 +2709,7 @@ Content of the file knowledge-sources.zip: \NewKnowledgeParamBool*{autoref~link}\kl_autoreflink_bool \NewKnowledgeParamBool*{invisible}\kl_invisible_bool \NewKnowledgeParamBool*{italic}\kl_italic_bool -\NewKnowledgeParamBool*{sc}\kl_sc_bool +\NewKnowledgeParamBool*{smallcaps}\kl_smallcaps_bool \NewKnowledgeParamBool*{md}\kl_md_bool \NewKnowledgeParamBool*{up}\kl_up_bool \NewKnowledgeParamBool*{boldface}\kl_boldface_bool @@ -2873,7 +2902,7 @@ Content of the file knowledge-sources.zip: \knowledge_kl_display_generic_cond:Nn\kl_boldface_bool\kl_bf:n \knowledge_kl_display_generic_cond:Nn\kl_up_bool\kl_up:n \knowledge_kl_display_generic_cond:Nn\kl_italic_bool\kl_it:n - \knowledge_kl_display_generic_cond:Nn\kl_sc_bool\kl_sc:n + \knowledge_kl_display_generic_cond:Nn\kl_smallcaps_bool\kl_smallcaps:n \knowledge_kl_display_generic_cond:Nn\kl_typewriter_bool\kl_tt:n % if math \knowledge_kl_display_generic_cond:Nn\kl_mathop_bool\mathop @@ -2956,6 +2985,8 @@ Content of the file knowledge-sources.zip: \cs_new:Npn\kl_md:n{\mode_if_math:TF\mathmd\textmd} \cs_new:Npn\kl_sc:n{\mode_if_math:TF\mathsc\textsc} \cs_new:Npn\kl_it:n{\mode_if_math:TF\mathit\textit} +\cs_new:Npn\mathscerror#1{\knowledge_error:n{`smallcaps'~only~allowed~in~math~mode.}} +\cs_new:Npn\kl_smallcaps:n{\mode_if_math:TF\mathscerror\textsc} \cs_new:Npn\kl_tt:n{\mode_if_math:TF\mathtt\texttt} \cs_new:Npn\kl_bf:n{\mode_if_math:TF\mathbf\textbf} \cs_new:Npn\kl_underline:n{\mode_if_math:TF\use:n\underline} @@ -3452,7 +3483,7 @@ Content of the file knowledge-sources.zip: default style={intro,autoref target}, unknown style= intro unknown, unknown style cont= intro unknown cont, - style directive=intro style + style directive= intro style } \knowledgenewvariant\phantomintro{ namespace=default, |