summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/yax
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/yax')
-rw-r--r--Master/texmf-dist/tex/generic/yax/t-yax.tex4
-rw-r--r--Master/texmf-dist/tex/generic/yax/yax.sty4
-rw-r--r--Master/texmf-dist/tex/generic/yax/yax.tex80
3 files changed, 73 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/generic/yax/t-yax.tex b/Master/texmf-dist/tex/generic/yax/t-yax.tex
index 49d6af4a0b5..11aaacab5da 100644
--- a/Master/texmf-dist/tex/generic/yax/t-yax.tex
+++ b/Master/texmf-dist/tex/generic/yax/t-yax.tex
@@ -5,11 +5,11 @@
% Author: Paul Isambert.
% E-mail: zappathustra AT free DOT fr
% Comments and suggestions are welcome.
-% Date: June 2010.
+% Date: July 2010.
%
%D \module
%D [ file=t-yax,
-%D version=2010.06.17,
+%D version=2010.07.10,
%D title=\CONTEXT\ User Module,
%D subtitle=YaX,
%D author=Paul Isambert,
diff --git a/Master/texmf-dist/tex/generic/yax/yax.sty b/Master/texmf-dist/tex/generic/yax/yax.sty
index 58477727ee7..a537c3d92fc 100644
--- a/Master/texmf-dist/tex/generic/yax/yax.sty
+++ b/Master/texmf-dist/tex/generic/yax/yax.sty
@@ -5,10 +5,10 @@
% Author: Paul Isambert.
% E-mail: zappathustra AT free DOT fr
% Comments and suggestions are welcome.
-% Date: June 2010.
+% Date: July 2010.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{yax}[2010/06/17 v.1.0 Yet Another Key System.]
+\ProvidesPackage{yax}[2010/07/10 v.1.01 Yet Another Key System.]
\chardef\formatnumber=4
\input yax.tex
\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/yax/yax.tex b/Master/texmf-dist/tex/generic/yax/yax.tex
index f799557634d..36cf486f02a 100644
--- a/Master/texmf-dist/tex/generic/yax/yax.tex
+++ b/Master/texmf-dist/tex/generic/yax/yax.tex
@@ -4,12 +4,25 @@
% Author: Paul Isambert.
% E-mail: zappathustra AT free DOT fr
% Comments and suggestions are welcome.
-% Date: June 2010.
+% Date: July 2010.
%
\input texapi % Everything I need. It figures: I wrote it for this.
+\ifcsname yax@already_loaded\endcsname
+ \expandafter\endinput
+\fi
+
+% No need to test texapi's version, since \texapiversion was
+% defined in v.1.01 and that's the one needed.
+\unless\ifdefined\texapiversion
+ \senderror{YaX}{You need texapi with version at least 1.01. I quit}
+ \expandafter\endinput
+\fi
+
\setcatcodes{@_=11}
-\def\yax@error{\senderror{YAX}}
+\def\yaxversion{1.01}
+\let\yax@already_loaded\relax
+\def\yax@error{\senderror{YaX}}
%
% Retrieval of parameter and attribute.
@@ -66,6 +79,7 @@
}
\newfor\yax@setattributes_loop#1={%
\passtrim{#1}\yax@setattributes_checkprefix
+ \addright\yax@attribute{ }% Final space delimiter
\pausefor\yax@setattributes_howgiven
}[\iffcs{yax@\yax@parameter @active}
{\usecs{yax@\yax@parameter @def}}]
@@ -83,14 +97,24 @@
\yax@setattributes_getquote
% No need for a new nospace: it has been removed
{\ifcatnext\foo
- \yax@setattributes_do % Since one visible \cs is supposed to be the only token in value.
+ \yax@setattributes_getcommand
\yax@setattributes_getspace}%
}
-\long\def\yax@setattributes_getquote"#1"{%
+\long\def\yax@setattribute_single#1#2{%
+ \def\yax@attribute{#2}%
\yax@setattributes_do{#1}%
}
+\long\def\yax@setattributes_getquote"#1"{%
+ \passexpanded{\yax@space_loop{\yax@setattribute_single{#1}}}{\yax@attribute}%
+ \nospace{\resumefor\yax@setattributes_loop}% Better not to forget this!
+ }
+\long\def\yax@setattributes_getcommand#1{%
+ \passexpanded{\yax@space_loop{\yax@setattribute_single{#1}}}{\yax@attribute}%
+ \nospace{\resumefor\yax@setattributes_loop}%
+ }
\long\def\yax@setattributes_getspace#1 {%
- \yax@setattributes_do{#1}%
+ \passexpanded{\yax@space_loop{\yax@setattribute_single{#1}}}{\yax@attribute}%
+ \nospace{\resumefor\yax@setattributes_loop}%
}
\newif\ifyax@makedef
\long\def\yax@setattributes_do#1{%
@@ -116,7 +140,6 @@
\ifyax@makedef
\yax@dodef{yax@\yax@parameter:\yax@attribute}{#1}%
\fi
- \resumefor\yax@setattributes_loop% Better not to forget this!
}
%
%
@@ -229,6 +252,34 @@
\letcs{yax@#1:#2}\yax@undefined
}
%
+% \setattribute <parameter> : <attribute> = <value>
+%
+\def\yax@removesign#1#2#3#4={#1{#2}{#3}}%
+\def\setattribute{%
+ \let\yax@dodef\defcs
+ \yax@getall{\yax@removesign\yax@setattribute}%
+ }
+\def\esetattribute{%
+ \let\yax@dodef\edefcs
+ \yax@getall{\yax@removesign\yax@setattribute}%
+ }
+\def\gsetattribute{%
+ \let\yax@dodef\gdefcs
+ \yax@getall{\yax@removesign\yax@setattribute}%
+ }
+\def\xsetattribute{%
+ \let\yax@dodef\xdefcs
+ \yax@getall{\yax@removesign\yax@setattribute}%
+ }
+\def\yax@setattribute#1#2{%
+ \def\yax@parameter{#1}%
+ \def\yax@attribute{#2}%
+ \nospace\yax@setattribute_getvalue
+ }
+\def\yax@setattribute_getvalue#1 {%
+ \yax@setattributes_do{#1}%
+ }
+%
%
%
%
@@ -406,13 +457,12 @@
% \ifvalue
%
\def\ifvalue{%
- \yax@getall{\yax@ifvalue_removesign\yax@ifvalue_getvalue}%
+ \yax@getall{\yax@removesign\yax@ifvalue_getvalue}%
}%
\def\yax@ifvalue_nometa{%
- \yax@getall{\yax@ifvalue_removesign\yax@ifvaluenometa_getvalue}%
+ \yax@getall{\yax@removesign\yax@ifvaluenometa_getvalue}%
}%
-\def\yax@ifvalue_removesign#1#2#3#4={#1{#2}{#3}}%
\long\def\yax@ifvalue_getvalue#1#2#3 {%
\ifemptystring{#3}
{\yax@ifvalue_getvalue{#1}{#2}}
@@ -488,6 +538,10 @@
\long\def\yax@newsyntax#1#2{%
\defcs{#2restrictattribute}#1{\yax@restrictattribute_getrestrictions{##1}{##2}}%
\defcs{#2deleteattribute}#1{\letcs{yax@##1:##2}\yax@undefined}%
+ \defcs{#2setattribute}#1{\let\yax@dodef\defcs\yax@removesign{\nospace\yax@setattribute}{##1}{##2}}%
+ \defcs{#2esetattribute}#1{\let\yax@dodef\edefcs\yax@removesign{\nospace\yax@setattribute}{##1}{##2}}%
+ \defcs{#2gsetattribute}#1{\let\yax@dodef\gdefcs\yax@removesign{\nospace\yax@setattribute}{##1}{##2}}%
+ \defcs{#2xsetattribute}#1{\let\yax@dodef\xdefcs\yax@removesign{\nospace\yax@setattribute}{##1}{##2}}%
\defcs{#2ifattribute}#1{\yax@ifattribute_and{}\gobbleone{##1}{##2}}%
\defcs{yax@#2ifattribute_nometa}#1{\yax@ifattributenometa_and\gobbleone{##1}{##2}}%
\yax@newsyntax_noarg{#2usevalue}{#1}\usecs
@@ -496,8 +550,8 @@
\passexpanded{\yax@newsyntax_onearg{#2passvaluenobraces}}{\yax@temp{##2}{##3}}\yax@passvalue_nobrace
\passexpanded{\yax@newsyntax_onearg{#2settovalue}}{\yax@temp{##2}{##3}}\yax@settovalue
\passexpanded{\yax@newsyntax_onearg{#2storevalue}}{\yax@temp{##2}{##3}}\yax@storevalue
- \defcs{#2ifvalue}#1{\yax@ifvalue_removesign\yax@ifvalue_getvalue{##1}{##2}}%
- \defcs{yax@#2ifvalue_nometa}#1{\yax@ifvalue_removesign\yax@ifvaluenometa_getvalue{##1}{##2}}%
+ \defcs{#2ifvalue}#1{\yax@removesign\yax@ifvalue_getvalue{##1}{##2}}%
+ \defcs{yax@#2ifvalue_nometa}#1{\yax@removesign\yax@ifvaluenometa_getvalue{##1}{##2}}%
\defcs{#2ifcasevalue}#1{\yax@ifcasevalue_getvalue{##1}{##2}}%
\defcs{yax@#2ifcasevalue_nometa}#1{\expandafter\nometa\yax@ifcasevalue_getvalue{##1}{##2}}%
}
@@ -512,6 +566,10 @@
\def\copysyntax#1#2{%
\letcstocs{#1restrictattribute}{#2restrictattribute}%
\letcstocs{#1deleteattribute}{#2deleteattribute}%
+ \letcstocs{#1setattribute}{#2setattribute}%
+ \letcstocs{#1esetattribute}{#2esetattribute}%
+ \letcstocs{#1gsetattribute}{#2gsetattribute}%
+ \letcstocs{#1xsetattribute}{#2xsetattribute}%
\yax@let{ifattribute}{#1}{#2}%
\yax@let_all{usevalue}{#1}{#2}\yax@let_all{passvalue}{#1}{#2}\yax@let_all{passvaluenobraces}{#1}{#2}%
\yax@let_all{settovalue}{#1}{#2}\yax@let_all{storevalue}{#1}{#2}%