summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/core-con.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-con.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/core-con.mkiv420
1 files changed, 200 insertions, 220 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-con.mkiv b/Master/texmf-dist/tex/context/base/core-con.mkiv
index 2d2e5d5d78e..e43e4ecda55 100644
--- a/Master/texmf-dist/tex/context/base/core-con.mkiv
+++ b/Master/texmf-dist/tex/context/base/core-con.mkiv
@@ -17,7 +17,7 @@
\unprotect
-\ifx\currentlanguage\undefined \let\currentlanguage\empty \fi
+\ifx\currentlanguage\undefined \let\currentlanguage\empty \fi
\ifx\labeltext \undefined \let\labeltext\firstofoneargument \fi
%D This module deals with all kind of conversions from numbers
@@ -74,41 +74,41 @@
%D \showsetup{romannumerals}
%D \showsetup{Romannumerals}
-\def\romannumerals#1{\ctxlua{converters.romannumerals(\number#1)}}
-\def\Romannumerals#1{\ctxlua{converters.Romannumerals(\number#1)}}
+\def\romannumerals#1{\ctxcommand{romannumerals(\number#1)}}
+\def\Romannumerals#1{\ctxcommand{Romannumerals(\number#1)}}
%D Arabic etc:
-\def\abjadnumerals #1{\ctxlua{converters.abjadnumerals (\number#1)}}
-\def\abjadnodotnumerals#1{\ctxlua{converters.abjadnodotnumerals(\number#1)}}
-\def\abjadnaivenumerals#1{\ctxlua{converters.arabicnumerals (\number#1)}}
+\def\abjadnumerals #1{\ctxcommand{abjadnumerals (\number#1)}}
+\def\abjadnodotnumerals#1{\ctxcommand{abjadnodotnumerals(\number#1)}}
+\def\abjadnaivenumerals#1{\ctxcommand{arabicnumerals (\number#1)}}
-\def\languagecharacters#1{\ctxlua{converters.alphabetic(\number#1,"\currentlanguage")}} % new
-\def\languageCharacters#1{\ctxlua{converters.Alphabetic(\number#1,"\currentlanguage")}} % new
+\def\languagecharacters#1{\ctxcommand{alphabetic(\number#1,"\currentlanguage")}} % new
+\def\languageCharacters#1{\ctxcommand{Alphabetic(\number#1,"\currentlanguage")}} % new
% we could use an auxiliary macro to save some bytes in the format
%
-% \def\dolanguagecharacters#1#2{\ctxlua{converters.alphabetic(\number#2,"#1")}}
+% \def\dolanguagecharacters#1#2{\ctxcommand{alphabetic(\number#2,"#1")}}
-\def\thainumerals #1{\ctxlua{converters.alphabetic(\number#1,"thai")}}
-\def\devanagarinumerals#1{\ctxlua{converters.alphabetic(\number#1,"devanagari")}}
-\def\gurmurkhinumerals #1{\ctxlua{converters.alphabetic(\number#1,"gurmurkhi")}}
-\def\gujaratinumerals #1{\ctxlua{converters.alphabetic(\number#1,"gujarati")}}
-\def\tibetannumerals #1{\ctxlua{converters.alphabetic(\number#1,"tibetan")}}
-\def\greeknumerals #1{\ctxlua{converters.alphabetic(\number#1,"greek")}}
-\def\Greeknumerals #1{\ctxlua{converters.Alphabetic(\number#1,"greek")}}
-\def\arabicnumerals #1{\ctxlua{converters.alphabetic(\number#1,"arabic")}}
-\def\persiannumerals #1{\ctxlua{converters.alphabetic(\number#1,"persian")}}
+\def\thainumerals #1{\ctxcommand{alphabetic(\number#1,"thai")}}
+\def\devanagarinumerals#1{\ctxcommand{alphabetic(\number#1,"devanagari")}}
+\def\gurmurkhinumerals #1{\ctxcommand{alphabetic(\number#1,"gurmurkhi")}}
+\def\gujaratinumerals #1{\ctxcommand{alphabetic(\number#1,"gujarati")}}
+\def\tibetannumerals #1{\ctxcommand{alphabetic(\number#1,"tibetan")}}
+\def\greeknumerals #1{\ctxcommand{alphabetic(\number#1,"greek")}}
+\def\Greeknumerals #1{\ctxcommand{Alphabetic(\number#1,"greek")}}
+\def\arabicnumerals #1{\ctxcommand{alphabetic(\number#1,"arabic")}}
+\def\persiannumerals #1{\ctxcommand{alphabetic(\number#1,"persian")}}
-\let\arabicexnumerals \persiannumerals
+\let\arabicexnumerals \persiannumerals
-\def\koreannumerals #1{\ctxlua{converters.alphabetic(\number#1,"korean")}}
-\def\koreannumeralsp#1{\ctxlua{converters.alphabetic(\number#1,"korean-parent")}}
-\def\koreannumeralsc#1{\ctxlua{converters.alphabetic(\number#1,"korean-circle")}}
+\def\koreannumerals #1{\ctxcommand{alphabetic(\number#1,"korean")}}
+\def\koreannumeralsp #1{\ctxcommand{alphabetic(\number#1,"korean-parent")}}
+\def\koreannumeralsc #1{\ctxcommand{alphabetic(\number#1,"korean-circle")}}
-\def\chinesenumerals #1{\ctxlua{converters.chinesenumerals (\number#1)}}
-\def\chinesecapnumerals#1{\ctxlua{converters.chinesecapnumerals(\number#1,"cap")}}
-\def\chineseallnumerals#1{\ctxlua{converters.chineseallnumerals(\number#1,"all")}}
+\def\chinesenumerals #1{\ctxcommand{chinesenumerals (\number#1)}}
+\def\chinesecapnumerals#1{\ctxcommand{chinesecapnumerals(\number#1,"cap")}}
+\def\chineseallnumerals#1{\ctxcommand{chineseallnumerals(\number#1,"all")}}
%D \macros
%D {character,Character}
@@ -128,8 +128,8 @@
\def\unknowncharacter{-} % else in lists \relax
-\def\character#1{\ctxlua{converters.character (\number#1)}}
-\def\Character#1{\ctxlua{converters.Character (\number#1)}}
+\def\character#1{\ctxcommand{character(\number#1)}}
+\def\Character#1{\ctxcommand{Character(\number#1)}}
%D \macros
%D {characters,Characters}
@@ -141,16 +141,16 @@
%D \showsetup{characters}
%D \showsetup{Characters}
-\def\characters#1{\ctxlua{converters.characters(\number#1)}}
-\def\Characters#1{\ctxlua{converters.Characters(\number#1)}}
+\def\characters#1{\ctxcommand{characters(\number#1)}}
+\def\Characters#1{\ctxcommand{Characters(\number#1)}}
%D \macros
%D {greeknumerals,Greeknumerals}
%D
%D Why should we only honour the romans, and not the greek?
-\let\greeknumerals\gobbleoneargument
-\let\Greeknumerals\gobbleoneargument
+% \let\greeknumerals\gobbleoneargument
+% \let\Greeknumerals\gobbleoneargument
%D \macros
%D {oldstylenumerals,oldstyleromannumerals}
@@ -202,17 +202,8 @@
%D
%D Anyhow, the conversion looks like:
-\def\domonthtag#1%
- {\ifcase#1%
- \or \v!january \or \v!february \or \v!march \or \v!april
- \or \v!may \or \v!june \or \v!july \or \v!august
- \or \v!september \or \v!october \or \v!november \or \v!december
- \else
- \v!unknown
- \fi}
-
-\def\doconvertmonthlong #1{\labeltext{\domonthtag{#1}}}
-\def\doconvertmonthshort#1{\labeltext{\domonthtag{#1}:\s!mnem}}
+\def\doconvertmonthlong #1{\ctxcommand{month(#1)}}
+\def\doconvertmonthshort#1{\ctxcommand{monthmnem(#1)}}
\let\doconvertmonth\doconvertmonthlong
@@ -225,9 +216,9 @@
\def\monthshort{\doconvertmonthshort}
\def\month {\doconvertmonth}
-\def\MONTH #1{{\let\labeltext\LABELTEXT\month {#1}}}
-\def\MONTHLONG #1{{\let\labeltext\LABELTEXT\monthlong {#1}}}
-\def\MONTHSHORT#1{{\let\labeltext\LABELTEXT\monthshort{#1}}}
+\def\MONTH #1{{\WORD{\month {#1}}}}
+\def\MONTHLONG #1{{\WORD{\monthlong {#1}}}}
+\def\MONTHSHORT#1{{\WORD{\monthshort{#1}}}}
%D We never explicitly needed this, but Tobias Burnus pointed
%D out that it would be handy to convert to the day of the
@@ -245,25 +236,18 @@
%D 2000 into leap years, right? Well, converting to string
%D looks familiar:
-\def\doconvertday#1%
- {\labeltext
- {\ifcase#1
- \or \v!sunday \or \v!monday \or \v!tuesday \or \v!wednesday
- \or \v!thursday \or \v!friday \or \v!saturday \fi}}
+\def\doconvertday#1{\ctxcommand{day(#1)}}
%D \macros
%D {getdayoftheweek, dayoftheweek}
-%D
-%D The conversion algoritm is an old one and a translation from
-%D a procedure written in MODULA~2 back in the 80's. I finaly
-%D found the 4--100-400 rules in some enclopedia. Look at this
-%D messy low level routine that takes the day, month and year
-%D as arguments:
\newcount\normalweekday
-\def\getdayoftheweek#1#2#3{\normalweekday\ctxlua{converters.weekday(\number#1,\number#2,\number#3)}}
-\def\dayoftheweek #1#2#3{\doconvertday{\ctxlua{converters.weekday(\number#1,\number#2,\number#3)}}}
+% \def\getdayoftheweek#1#2#3{\normalweekday\ctxcommand{weekday(\number#1,\number#2,\number#3)}}
+% \def\dayoftheweek #1#2#3{\doconvertday{\ctxcommand{weekday(\number#1,\number#2,\number#3)}}}
+
+\def\getdayoftheweek#1#2#3{\normalweekday\ctxcommand{weekday(\number#1,\number#2,\number#3)}\relax} % number
+\def\dayoftheweek #1#2#3{\ctxcommand{weekdayname(\number#1,\number#2,\number#3)}} % name
%D Using this macro in
%D
@@ -304,7 +288,7 @@
{\doconvertday}
\def\WEEKDAY#1%
- {{\let\labeltext\LABELTEXT\doconvertday{#1}}}
+ {{\WORD{\doconvertday{#1}}}}
%D \macros
%D {weekoftheday}
@@ -337,24 +321,13 @@
%D {\numberofdays}.
\def\doifleapyearelse#1%
- {\ifcase\ctxlua{converters.leapyear(\number#1)}
- \@EA\secondoftwoarguments
- \else
- \@EA\firstoftwoarguments
- \fi}
+ {\ctxcommand{doifleapyearelse(\number#1)}}
\def\getdayspermonth#1#2%
- {\edef\numberofdays{\ctxlua{converters.nofdays(\number#1,\number#2)}}}
+ {\edef\numberofdays{\ctxcommand{nofdays(\number#1,\number#2)}}}
\def\dayspermonth#1#2%
- {\ctxlua{converters.nofdays(\number#1,\number#2)}}
-
-% problem is that we calculate with those numbers
-%
-% \def\time {\numexpr\ctxlua{converters.textime()}\relax}
-% \def\year {\numexpr\ctxlua{converters.year ()}\relax}
-% \def\month{\numexpr\ctxlua{converters.month ()}\relax}
-% \def\day {\numexpr\ctxlua{converters.day ()}\relax}
+ {\ctxcommand{nofdays(\number#1,\number#2)}}
% \dayoftheweek{2006}{9}{15}
% \doifleapyearelse{2000}{OK}{NOT OK}
@@ -423,86 +396,131 @@
%D \getbuffer
%D \stoplines
-\def\kenmerkdatumpatroon{j,mm,dd} % jj,mm,dd changed at januari 1-1-2000
-
-\newsignal\datesignal
-
-\def\dobetweendates
- {\ifdim\lastskip=\datesignal\relax\else
- \unskip\space
- \hskip\datesignal\relax
- \fi}
+% \newtoks \everycurrentdate
+%
+% \newsignal\datesignal
+%
+% \def\dobetweendates
+% {\ifdim\lastskip=\datesignal\relax\else
+% \unskip\space
+% \hskip\datesignal\relax
+% \fi}
+%
+% \def\referraldatepattern{j,mm,dd} % jj,mm,dd changed at januari 1-1-2000
+%
+% \def\dodobetweendates
+% {\let\betweendates\dobetweendates}%
+%
+% \def\dodocurrentdate#1%
+% {\processallactionsinset[#1]
+% [ \v!year=>\betweendates
+% \convertnumber\v!year\normalyear,
+% yy=>\lasttwodigits\normalyear,
+% y=>\convertnumber\v!year\normalyear,
+% Y=>\number\normalyear,
+% \v!month=>\betweendates
+% \month\normalmonth,
+% mm=>\twodigits\normalmonth,
+% m=>\month\normalmonth,
+% M=>\number\normalmonth,
+% \v!day=>\betweendates
+% \convertnumber\v!day\normalday,
+% \v!day+=>\betweendates
+% \convertnumber\v!day\normalday
+% \ordinal\normalday,
+% dd=>\twodigits\normalday,
+% dd+=>\convertnumber\v!day{\twodigits\normalday}%
+% \ordinal\normalday,
+% d=>\convertnumber\v!day\normalday,
+% d+=>\convertnumber\v!day\normalday
+% \ordinal\normalday,
+% d=>\number\normalday,
+% \v!weekday=>\betweendates
+% \convertnumber\v!day{\dayoftheweek\normalday\normalmonth\normalyear},
+% w=>\convertnumber\v!day{\dayoftheweek\normalday\normalmonth\normalyear},
+% W=>\dayoftheweek\normalday\normalmonth\normalyear,
+% \v!referral=>\docomplexcurrentdate\referraldatepattern,
+% \v!space=>\unskip\ \hskip\datesignal,
+% \ =>\unskip\ \hskip\datesignal,
+% \s!default=>,
+% \s!unknown=>\unskip\commalistelement
+% \hskip\datesignal
+% \let\betweendates\dodobetweendates]}
+%
+% \def\docurrentdate[#1]%
+% {\begingroup
+% \the\everycurrentdate
+% \let\betweendates\dodobetweendates
+% \doifsomething{#1}{\edef\currentdatespecification{#1}}%
+% \normalexpanded{\dodocurrentdate{\currentdatespecification}}%
+% \ifdim\lastskip=\datesignal\relax
+% \unskip
+% \fi
+% \endgroup}
+
+%D \starttabulate[|l|l|]
+%D \HL
+%D \NC year \NC (\currentdate[year]) \NC\NR
+%D \NC yy \NC (\currentdate[yy]) \NC\NR
+%D \NC y \NC (\currentdate[y]) \NC\NR
+%D \NC Y \NC (\currentdate[Y]) \NC\NR
+%D \HL
+%D \NC month \NC (\currentdate[month]) \NC\NR
+%D \NC mm \NC (\currentdate[mm]) \NC\NR
+%D \NC m \NC (\currentdate[m]) \NC\NR
+%D \NC M \NC (\currentdate[M]) \NC\NR
+%D \HL
+%D \NC day \NC (\currentdate[day]) \NC\NR
+%D \NC dd \NC (\currentdate[dd]) \NC\NR
+%D \NC d \NC (\currentdate[d]) \NC\NR
+%D \NC D \NC (\currentdate[D]) \NC\NR
+%D \HL
+%D \NC weekday \NC (\currentdate[weekday]) \NC\NR
+%D \NC w \NC (\currentdate[w]) \NC\NR
+%D \NC W \NC (\currentdate[W]) \NC\NR
+%D \HL
+%D \NC referral \NC (\currentdate[referral]) \NC\NR
+%D \HL
+%D \NC day+ \NC (\currentdate[day+]) \NC\NR
+%D \NC dd+ \NC (\currentdate[dd+]) \NC\NR
+%D \NC d+ \NC (\currentdate[d+]) \NC\NR
+%D \NC D+ \NC (\currentdate[D+]) \NC\NR
+%D \HL
+%D \stoptabulate
+%D
+%D \startbuffer
+%D (\currentdate[D,.,M,.,Y])
+%D (\currentdate[day,month,year])
+%D (\currentdate[day,+,month,+,year])
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
\newtoks \everycurrentdate
-\def\complexcurrentdate[#1]%
- {\bgroup
+\unexpanded\def\currentdate
+ {\dosingleempty\docurrentdate}
+
+\def\docurrentdate[#1]%
+ {\begingroup
\the\everycurrentdate
- \def\betweendates{\let\betweendates\dobetweendates}%
- % was \processcommacommandp[#1]\docomplexcurrentdate
- \safeedef\ascii{\empty#1}% keep encoded chars
- \@EA\processcommalist\@EA[\ascii]\docomplexcurrentdate
- \ifdim\lastskip=\datesignal\relax
- \unskip
- \fi
- \egroup}
+ \doifsomething{#1}{\edef\currentdatespecification{#1}}%
+ \ctxcommand{currentdate(\!!bs\currentdatespecification\!!es,"\labellanguage")}%
+ \endgroup}
-\def\docomplexcurrentdate#1%
- {\lowercase{\edef\!!stringa{#1}}% permits usage in \smallcapped
- \expanded{\processaction[\!!stringa]}% [#1]
- [ \v!day=>\betweendates\the\normalday,
- %\v!day+=>\betweendates\ordinaldaynumber\normalday,
- \v!day+=>\betweendates\convertnumber{\v!day+}\normalday,
- \v!month=>\betweendates\month\normalmonth,
- \v!year=>\betweendates\the\normalyear,
- \v!space=>\unskip\ \hskip\datesignal,% optimization -)
- \ =>\unskip\ \hskip\datesignal,% optimization -)
- d=>\convertnumber\v!day\normalday,
- %d+=>\ordinaldaynumber\normalday,
- d+=>\convertnumber{\v!day+}\normalday,
- m=>\convertnumber\v!month\normalmonth,
- j=>\convertnumber\v!year\normalyear,
- y=>\convertnumber\v!year\normalyear,
- w=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear,
- dd=>\ifnum\normalday >9 \else0\fi\the\normalday,
- %dd+=>\ordinaldaynumber{\ifnum\normalday >9 \else0\fi\the\normalday},
- dd+=>\convertnumber{\v!day+}{\ifnum\normalday >9 \else0\fi\the\normalday},
- mm=>\ifnum\normalmonth>9 \else0\fi\the\normalmonth,
- jj=>\expandafter\gobbletwoarguments\the\normalyear,
- yy=>\expandafter\gobbletwoarguments\the\normalyear,
- \v!weekday=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear,
- \v!referral=>\expanded{\complexcurrentdate[\kenmerkdatumpatroon]},
- \s!unknown=>\unskip
- % #1 and not the lowercased \commalistelement, vietnamese has text
- % {} because #1 can have comma, like: {\ ,}
- {#1}%
- \hskip\datesignal
- \def\betweendates{\let\betweendates\dobetweendates}]}
-
-\def\simplecurrentdate
- {\expanded{\complexcurrentdate[\currentdatespecification]}}
-
-\definecomplexorsimple\currentdate
+\unexpanded\def\date
+ {\dodoubleempty\dodate}
\def\dodate[#1][#2]%
- {\bgroup
+ {\begingroup
\iffirstargument
\getparameters[\??da][d=\normalday,m=\normalmonth,y=\normalyear,#1]%
\normalday \@@dad\relax
\normalmonth\@@dam\relax
\normalyear \@@day\relax
- \ifsecondargument
- \currentdate[#2]%
- \else
- \currentdate
- \fi
- \else
- \currentdate
\fi
- \egroup}
-
-\def\date
- {\dodoubleempty\dodate}
+ \docurrentdate[#2]%
+ \endgroup}
%D \macros
%D {currenttime}
@@ -511,10 +529,10 @@
%D a pattern similar to the previous date macro using the
%D keys \type {h}, \type {m} and a separator.
-\def\calculatecurrenttime
- {\edef\currenthour {\ctxlua{converters.hour ()}}%
- \edef\currentminute{\ctxlua{converters.minute()}}%
- \edef\currentsecond{\ctxlua{converters.second()}}}
+\unexpanded\def\calculatecurrenttime
+ {\edef\currenthour {\ctxcommand{hour ()}}%
+ \edef\currentminute{\ctxcommand{minute()}}%
+ \edef\currentsecond{\ctxcommand{second()}}}
\let\currenthour \!!plusone
\let\currentminute\!!plusone
@@ -523,8 +541,7 @@
\def\complexcurrenttime[#1]%
{\calculatecurrenttime
- \processallactionsinset[#1]
- [h=>\currenthour,m=>\currentminute,\s!unknown=>\commalistelement]}
+ \processallactionsinset[#1][h=>\currenthour,m=>\currentminute,\s!unknown=>\commalistelement]}
\def\simplecurrenttime
{\expanded{\complexcurrenttime[\currenttimespecification]}}
@@ -586,83 +603,40 @@
%D \defineconversion [en] [whatever] [\something]
%D \stoptyping
-% \def\dodefineconversion[#1][#2]%
-% {\ConvertConstantAfter\doifinstringelse{,}{#2}
-% {\scratchcounter=0
-% \def\docommand##1%
-% {\advance\scratchcounter 1
-% \setvalue{\??cv#1\the\scratchcounter}{##1}}%
-% \processcommalist[#2]\docommand
-% \setvalue{\??cv#1}##1{\csname\??cv#1##1\endcsname}}
-% {\setvalue{\??cv#1}{#2}}}
-%
-% \unexpanded\def\defineconversion%
-% {\dodoubleargument\dodefineconversion}
-
\unexpanded\def\defineconversion
{\dotripleempty\dodefineconversion}
-\def\dodefineconversion[#1][#2][#3]%
+\def\dodefineconversion[#1][#2][#3]% from now on global (maybe local again some day)
{\ifthirdargument
- \dododefineconversion[#1][#2][#3]%
+ \dododefineconversion{#1#2}{#1:#2}{#3}%
\else
- \dododefineconversion[][#1][#2]%
+ \dododefineconversion{#1}{#1}{#2}%
\fi}
-%D \starttyping
-%D \def\dododefineconversion[#1][#2][#3]%
-%D {\ConvertConstantAfter\doifinstringelse{,}{#3}
-%D {\scratchcounter\zerocount
-%D \def\docommand##1%
-%D {\advance\scratchcounter \plusone
-%D \setvalue{\??cv#1#2\the\scratchcounter}{##1}}%
-%D \processcommalist[#3]\docommand
-%D \setvalue{\??cv#1#2}##1{\executeifdefined{\??cv#1#2##1}\unknown}} % catch out-of-range numbers
-%D {\setvalue{\??cv#1#2}{#3}}}
-%D \stoptyping
-
-%D This approach has the disadvantage that when you run out of
-%D symbols you get unknown results. The following implementation
-%D permits overloading of the converter:
-
-\def\dododefineconversion[#1][#2][#3]%
- {\ConvertConstantAfter\doifinstringelse{,}{#3}
- {\scratchcounter\zerocount
- \def\docommand##1%
- {\advance\scratchcounter \plusone
- \setvalue{\??cv#1#2\the\scratchcounter}{##1}}%
- \processcommalist[#3]\docommand
- \setevalue{\??cv#1#2}##1%
- {\noexpand\docheckedconversion{#1#2}{\the\scratchcounter}{##1}}}
- {\setvalue{\??cv#1#2}{#3}}}
-
-\def\docheckedconversion#1#2#3% class maxnumber number
- {\executeifdefined{\??cv#1#3}\unknown}
-
-%D When Gerben reported problems with footnote numbering per page,
-%D Taco came with the following wrap around solution. So, let's
-%D overload the checked conversion macro:
-
-\def\docheckedconversion#1#2#3% class maxnumber number
- {\executeifdefined{\??cv#1\modulatednumber{#2}{#3}}\unknown}
+\def\dododefineconversion#1#2#3%
+ {\doifinstringelse{,}{\detokenize{#3}}
+ {\ctxcommand{defineconversion("#2",\!!bs\detokenize{#3}\!!es)}%
+ \setgvalue{\??cv#1}{\checkedconversion{#2}}}
+ {\setgvalue{\??cv#1}{#3}}}
-%D Taco's modulo code is implemented in the system module
-%D \type {syst-con}.
+\def\checkedconversion#1#2%
+ {\ctxcommand{checkedconversion("#1",#2)}}
%D If a conversion is just a font switch then we need to make sure
%D that the number is indeed end up as number in the input, so we
%D need to handle the second argument.
\def\convertnumber#1#2%
- {\csname\??cv
- \ifcsname\??cv\currentlanguage#1\endcsname
- \currentlanguage#1%
- \else\ifcsname\??cv#1\endcsname
- #1%
- \else
- \s!default
- \fi\fi
- \endcsname{\number#2}}
+ {\csname
+ \??cv=>% we want a fully expandable (no if interference)
+ \ifcsname\??cv\currentlanguage#1\endcsname1\else
+ \ifcsname\??cv #1\endcsname2\else
+ 3\fi\fi
+ \endcsname{#1}{\number#2}}
+
+\setvalue{\??cv=>1}#1{\csname\??cv\currentlanguage#1\endcsname}
+\setvalue{\??cv=>2}#1{\csname\??cv #1\endcsname}
+\letvalue{\??cv=>3}\checkedconversion
\def\doifconversiondefinedelse#1%
{\ifcsname\??cv\currentlanguage#1\endcsname
@@ -697,14 +671,9 @@
%D difficult to implement. Fortunately dates never exceed the
%D number~31.
-\ifx\high \undefined \let\high \firstofoneargument \fi
-\ifx\notsmallcapped\undefined \let\notsmallcapped\firstofoneargument \fi
-
-\def\highordinalstr#1{\high{\notsmallcapped{#1}}}
-\def\ordinalstr #1{\notsmallcapped{#1}}
-
-\def\ordinaldaynumber#1% \strippedcsname\ordinaldaynumber
- {\expanded{\executeifdefined{\currentlanguage ordinaldaynumber}\noexpand\firstofoneargument{\number#1}}}
+\def\highordinalstr #1{\high{\notsmallcapped{#1}}}
+\def\ordinalstr #1{\notsmallcapped{#1}}
+\def\ordinaldaynumber #1{\ctxcommand{ordinal(#1,"\currentlanguage"}}
%D As longs as symbols are linked to levels or numbers, we can
%D also use the conversion mechanism, but in for instance the
@@ -734,6 +703,7 @@
\defineconversion [AK] [\smallcappedcharacters]
\defineconversion [KA] [\smallcappedcharacters]
+\defineconversion [\v!number] [\numbers]
\defineconversion [\v!numbers] [\numbers]
\defineconversion [\v!Numbers] [\Numbers]
\defineconversion [\v!mediaeval] [\mediaeval]
@@ -762,9 +732,6 @@
\defineconversion [g] [\greeknumerals]
\defineconversion [G] [\Greeknumerals]
-\defineconversion [arabicnumerals] [\arabicnumerals]
-\defineconversion [persiannumerals] [\persiannumerals]
-
\defineconversion [abjadnumerals] [\abjadnumerals]
\defineconversion [abjadnodotnumerals] [\adjadnodotnumerals]
\defineconversion [abjadnaivenumerals] [\adjadnaivenumerals]
@@ -857,4 +824,17 @@
\mathematics{\ast\ast},
\mathematics{\ast\ast\ast}]
+%D Iteration of suggestion by WS on mailinglist 2010.12.22:
+%D
+%D \starttyping
+%D \setupfloatsplitting[conversion=continued]
+%D \stoptyping
+
+\unexpanded\def\continuednumber#1%
+ {\labeltext{\ifcase#1\or\else\v!continued\fi}}
+
+\defineconversion
+ [\v!continued]
+ [\continuednumber]
+
\protect \endinput