From 9a31450570f5578e8502f54797e614d4423e84c6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 18 Feb 2018 22:17:14 +0000 Subject: knowledge (18feb18) git-svn-id: svn://tug.org/texlive/trunk@46669 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/knowledge/knowledge-code.dtx | 79 +++++++++++++++------- .../source/latex/knowledge/knowledge-utils.dtx | 65 +++++++++--------- .../source/latex/knowledge/knowledge.ins | 1 + 3 files changed, 88 insertions(+), 57 deletions(-) (limited to 'Master/texmf-dist/source/latex/knowledge') 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 %\usepackage{expl3} -%\ProvidesExplPackage{knowledge}{2017/10/18}{1.07}{} +%\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, diff --git a/Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx b/Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx index eb50a561027..961ebf925b6 100644 --- a/Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx +++ b/Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx @@ -215,7 +215,7 @@ % \begin{macrocode} \cs_new:Nn\if_true:TF{#1} \cs_new:Nn\if_false:TF{#2} -\cs_generate_variant:Nn\int_compare:nNnTF{cNnTF} +%\cs_generate_variant:Nn\int_compare:nNnTF{cNnTF} \cs_generate_variant:Nn\use:nn{nx} % \end{macrocode} % The command |\cs_apply_inline:n| takes a first argument @@ -252,15 +252,15 @@ % \end{macrocode} % % \begin{macrocode} -\cs_generate_variant:Nn\cs_apply_inline:nn{nc} -\cs_generate_variant:Nn\cs_apply_inline:nnn{ncc} -\cs_generate_variant:Nn\cs_apply_inline:nnnn{nccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnn{ncccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnn{nccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnn{ncccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnn{nccccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnn{ncccccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnnn{nccccccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nn{nc} +%\cs_generate_variant:Nn\cs_apply_inline:nnn{ncc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnn{nccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnn{ncccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnn{nccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnnn{ncccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnn{nccccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnn{ncccccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnnn{nccccccccc} % \end{macrocode} %\fi % @@ -971,21 +971,21 @@ {\file_if_exist:nT{#1} {\group_begin: \bool_set_false:N\l_tmpa_bool - \ior_open:Nn\g_tmpa_ior{#1} - \iow_open:Nn\g_tmpa_iow{#2} + \ior_open:Nn\klg_tmpa_ior{#1} + \iow_open:Nn\klg_tmpa_iow{#2} \bool_do_until:Nn\l_tmpa_bool{ - \ior_if_eof:NTF\g_tmpa_ior + \ior_if_eof:NTF\klg_tmpa_ior {\bool_set_true:N\l_tmpa_bool} {\ior_get_str:NN - \g_tmpa_ior + \klg_tmpa_ior \l_tmpa_tl \exp_args:NNV \iow_now:Nn - \g_tmpa_iow + \klg_tmpa_iow \l_tmpa_tl} } - \ior_close:N\g_tmpa_ior - \iow_close:N\g_tmpa_iow + \ior_close:N\klg_tmpa_ior + \iow_close:N\klg_tmpa_iow \group_end:}} \cs_new_protected_with_variants:Nnn\kl_compare_files:Nnn{NnV,NVn,NVV} @@ -1000,22 +1000,22 @@ \file_if_exist:nT{#3} {\bool_set_false:N\l_tmpb_bool}} \bool_if:NF\l_tmpa_bool{ - \ior_open:Nn\g_tmpa_ior{#2} - \ior_open:Nn\g_tmpb_ior{#3} + \ior_open:Nn\klg_tmpa_ior{#2} + \ior_open:Nn\klg_tmpb_ior{#3} % \bool_do_until:Nn\l_tmpa_bool{ - \ior_if_eof:NTF\g_tmpa_ior + \ior_if_eof:NTF\klg_tmpa_ior {\bool_set_true:N\l_tmpa_bool - \ior_if_eof:NF\g_tmpb_ior + \ior_if_eof:NF\klg_tmpb_ior {\bool_set_false:N\l_tmp_bool}} - {\ior_if_eof:NTF\g_tmpb_ior + {\ior_if_eof:NTF\klg_tmpb_ior {\bool_set_true:N\l_tmpa_bool \bool_set_false:N\l_tmp_bool} {\ior_get_str:NN - \g_tmpa_ior + \klg_tmpa_ior \l_tmpa_tl \ior_get_str:NN - \g_tmpb_ior + \klg_tmpb_ior \l_tmpb_tl \tl_if_eq:NNF \l_tmpa_tl\l_tmpb_tl @@ -1023,17 +1023,17 @@ \bool_set_false:N\l_tmpb_bool} }} } - \ior_close:N\g_tmpa_ior - \ior_close:N\g_tmpb_ior} + \ior_close:N\klg_tmpa_ior + \ior_close:N\klg_tmpb_ior} \bool_if:NTF\l_tmpb_bool {\group_end:\bool_set_true:N#1} {\group_end:\bool_set_false:N#1} } \cs_new_protected:Nn\kl_tl_to_file:nn - {\iow_open:Nn\g_tmpa_iow{#1} - \iow_now:Nn\g_tmpa_iow{#2} - \iow_close:N\g_tmpa_iow} + {\iow_open:Nn\klg_tmpa_iow{#1} + \iow_now:Nn\klg_tmpa_iow{#2} + \iow_close:N\klg_tmpa_iow} % \end{macrocode} % % These macros are used for testing the modification of knowledges. @@ -1042,10 +1042,9 @@ % At the end, the two are compared. % % \begin{macrocode} -\ior_new:N\g_tmpa_ior -\ior_new:N\g_tmpb_ior -\iow_new:N\g_tmpa_iow -\iow_new:N\g_tmpb_iow +\ior_new:N\klg_tmpa_ior +\ior_new:N\klg_tmpb_ior +\iow_new:N\klg_tmpa_iow % \end{macrocode} % % diff --git a/Master/texmf-dist/source/latex/knowledge/knowledge.ins b/Master/texmf-dist/source/latex/knowledge/knowledge.ins index 7542c25b4b6..c203174f3f7 100644 --- a/Master/texmf-dist/source/latex/knowledge/knowledge.ins +++ b/Master/texmf-dist/source/latex/knowledge/knowledge.ins @@ -6,6 +6,7 @@ %% version 1.2 of this license or (at your option) any later %% version. The latest version of this license is in: %% + %% http://www.latex-project.org/lppl.txt %% %% and version 1.2 or later is part of all distributions of -- cgit v1.2.3