diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-12-17 16:15:07 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-12-17 16:15:07 +0100 |
commit | d1faffcd5d92925a6c5e66ebb72b4c8dcfae236f (patch) | |
tree | c1663d54da8573c0541015e5a307a28e22215a8b /tex/context/base/lang-mis.mkiv | |
parent | adc43c3c243ed95215af6fe02d71e393c178da23 (diff) | |
download | context-d1faffcd5d92925a6c5e66ebb72b4c8dcfae236f.tar.gz |
2015-12-17 15:59:00
Diffstat (limited to 'tex/context/base/lang-mis.mkiv')
-rw-r--r-- | tex/context/base/lang-mis.mkiv | 108 |
1 files changed, 78 insertions, 30 deletions
diff --git a/tex/context/base/lang-mis.mkiv b/tex/context/base/lang-mis.mkiv index 2b886b3ce..87b58b303 100644 --- a/tex/context/base/lang-mis.mkiv +++ b/tex/context/base/lang-mis.mkiv @@ -186,6 +186,7 @@ \installcorenamespace{discretionarytext} \installcorenamespace{discretionarymath} \installcorenamespace{discretionaryboth} +\installcorenamespace{discretionarymode} \unexpanded\def\installdiscretionary#1#2% {\setevalue{\??discretionarymath\detokenize{#1}}{\detokenize{#1}}% ? @@ -194,8 +195,11 @@ \scratchcounter\expandafter`\detokenize{#1}% \expandafter\uedcatcodecommand\expandafter\ctxcatcodes\expandafter\scratchcounter\csname\??discretionaryboth\detokenize{#1}\endcsname} -\unexpanded\def\handlemathmodediscretionary#1{\executeifdefined{\??discretionarymath\detokenize{#1}}\donothing} -\unexpanded\def\handletextmodediscretionary#1{\executeifdefined{\??discretionarytext\detokenize{#1}}\donothing} +%unexpanded\def\handlemathmodediscretionary#1{\executeifdefined{\??discretionarymath\detokenize{#1}}\donothing} +%unexpanded\def\handletextmodediscretionary#1{\executeifdefined{\??discretionarytext\detokenize{#1}}\donothing} + +\unexpanded\def\handlemathmodediscretionary#1{\\ifcsname\??discretionarymath\detokenize{#1}\endcsname\lastnamedcs} +\unexpanded\def\handletextmodediscretionary#1{\\ifcsname\??discretionarytext\detokenize{#1}\endcsname\lastnamedcs} \unexpanded\def\installdiscretionaries#1#2{\writestatus\m!system{use \string \installdiscretionary}} % obsolete @@ -206,17 +210,18 @@ \def\lang_discretionaries_command {% if direct if, we need \relax for lookahead in math mode - \csname + \csname\??discretionarymode \ifcase\discretionarymode - \strippedcsname\lang_discretionaries_process_none + n% \csstring\lang_discretionaries_process_none \else\ifmmode - \strippedcsname\lang_discretionaries_process_math + m% \csstring\lang_discretionaries_process_math \else - \strippedcsname\lang_discretionaries_process_text + t% \csstring\lang_discretionaries_process_text \fi\fi \endcsname} -\def\lang_discretionaries_process_none#1% +% \def\lang_discretionaries_process_none#1% +\setvalue{\??discretionarymode n}#1% {\detokenize{#1}} %D The macro \type{\lang_discretionaries_check_before} takes care of loners like @@ -252,9 +257,11 @@ \ifx :\nextnext \settrue \punctafterdiscretionary \else \ifx ;\nextnext \settrue \punctafterdiscretionary \fi\fi\fi\fi\fi\fi} -\let\lang_discretionaries_process_math\handlemathmodediscretionary +%let\lang_discretionaries_process_math\handlemathmodediscretionary +\letvalue{\??discretionarymode m}\handlemathmodediscretionary -\def\lang_discretionaries_process_text#1% grouped ! +% \def\lang_discretionaries_process_text#1% grouped ! +\setvalue{\??discretionarymode t}#1% {\bgroup \let\nextnextnext\egroup \def\next##1#1% @@ -269,7 +276,8 @@ \ifx\discretionarytoken\empty \ifx#1\nextnext % takes care of ||| and +++ and ...... \ifcsname\??discretionaryaction\string#1\endcsname - \csname\??discretionaryaction\string#1\endcsname + %\csname\??discretionaryaction\string#1\endcsname + \lastnamedcs \else\ifconditional\spaceafterdiscretionary \prewordbreak\hbox{\string#1}\relax \else\ifconditional\punctafterdiscretionary @@ -284,7 +292,8 @@ % \prewordbreak\hbox{\textmodediscretionary\nextnext}\allowbreak\postwordbreak % but an hbox blocks a possible \discretionary \ifcsname\??discretionaryaction\endcsname - \csname\??discretionaryaction\endcsname + %\csname\??discretionaryaction\endcsname + \lastnamedcs \else\ifconditional\spaceafterdiscretionary \prewordbreak\textmodediscretionary\relax \else\ifconditional\punctafterdiscretionary @@ -295,7 +304,8 @@ % \prewordbreak\textmodediscretionary\nextnext\allowbreak\postwordbreak \fi \else\ifcsname\??discretionaryaction\discretionarytoken\endcsname - \csname\??discretionaryaction\discretionarytoken\endcsname + %\csname\??discretionaryaction\discretionarytoken\endcsname + \lastnamedcs \else \lang_discretionaries_check_before \ifconditional\spaceafterdiscretionary @@ -315,29 +325,36 @@ %D use the more direct approach: \unexpanded\def\directdiscretionary - {\csname + {\csname\??discretionarymode \ifcase\discretionarymode - \strippedcsname\lang_discretionaries_process_none + n% \csstring\lang_discretionaries_process_none \else - \strippedcsname\lang_discretionaries_process_direct + d% \csstring\lang_discretionaries_process_direct \fi \endcsname} \unexpanded\def\indirectdiscretionary - {\csname + {\csname\??discretionarymode \ifcase\discretionarymode - \strippedcsname\lang_discretionaries_process_none + n% \csstring\lang_discretionaries_process_none \else - \strippedcsname\lang_discretionaries_process_indirect + i% \csstring\lang_discretionaries_process_indirect \fi \endcsname} -\unexpanded\def\lang_discretionaries_process_direct#1% +% \unexpanded\def\lang_discretionaries_process_direct#1% +\setuvalue{\??discretionarymode d}#1% {\edef\discretionarytoken{\detokenize{#1}}% \let\textmodediscretionary\compoundhyphen - \executeifdefined{\??discretionaryaction\discretionarytoken}{\indirectdiscretionary{#1}}} + %\executeifdefined{\??discretionaryaction\discretionarytoken}{\indirectdiscretionary{#1}}} + \ifcsname\??discretionaryaction\discretionarytoken\endcsname + \expandafter\lastnamedcs + \else + \expandafter\indirectdiscretionary + \fi{#1}} -\unexpanded\unexpanded\def\lang_discretionaries_process_indirect#1% +% \unexpanded\unexpanded\def\lang_discretionaries_process_indirect#1% +\setuvalue{\??discretionarymode i}#1% {\prewordbreak\discretionary{\hbox{#1}}{}{\hbox{#1}}\allowbreak\postwordbreak} \unexpanded\def\definetextmodediscretionary #1 @@ -592,34 +609,65 @@ %D %D In later modules we will see how these commands are used. +% \def\lang_compounds_handle_character_one#1#2% +% {\if\string#1\string#2% was: \ifx#1#2% +% \def\next{\csname\??compoundnormal\string#1\endcsname}% +% \else\ifcsname\??compoundsingle\string#1\string#2\endcsname +% \def\next{\csname\??compoundsingle\string#1\string#2\endcsname}% +% \else +% \def\next{\csname\??compoundnormal\string#1\endcsname#2}% +% \fi\fi +% \next} +% +% \def\lang_compounds_handle_character_two#1#2#3% +% {\if\string#1\string#2% +% \def\next{\csname\??compoundnormal\string#1\endcsname#3}% +% \else\ifcsname\??compoundmultiple\string#1\string#2\string#3\endcsname +% \def\next{\csname\??compoundmultiple\string#1\string#2\string#3\endcsname}% +% \else\ifcsname\??compoundsingle\string#1\string#2\endcsname +% \def\next{\csname\??compoundsingle\string#1\string#2\endcsname#3}% +% \else +% \def\next{\csname\??compoundnormal\string#1\endcsname#2#3}% +% \fi\fi\fi +% \next} + \def\lang_compounds_handle_character_one#1#2% {\if\string#1\string#2% was: \ifx#1#2% - \def\next{\csname\??compoundnormal\string#1\endcsname}% + %\expandafter\let\expandafter\next\csname\??compoundnormal\string#1\endcsname + \csname\??compoundnormal\string#1\expandafter\endcsname \else\ifcsname\??compoundsingle\string#1\string#2\endcsname - \def\next{\csname\??compoundsingle\string#1\string#2\endcsname}% + %\expandafter\let\expandafter\next\lastnamedcs + \expandafter\lastnamedcs \else - \def\next{\csname\??compoundnormal\string#1\endcsname#2}% - \fi\fi - \next} + %\expandafter\let\expandafter\next\lastnamedcs + \expandafter\lastnamedcs + \fi\fi} \def\lang_compounds_handle_character_two#1#2#3% {\if\string#1\string#2% \def\next{\csname\??compoundnormal\string#1\endcsname#3}% \else\ifcsname\??compoundmultiple\string#1\string#2\string#3\endcsname - \def\next{\csname\??compoundmultiple\string#1\string#2\string#3\endcsname}% + \expandafter\let\expandafter\next\lastnamedcs \else\ifcsname\??compoundsingle\string#1\string#2\endcsname - \def\next{\csname\??compoundsingle\string#1\string#2\endcsname#3}% + \expandafter\let\expandafter\next\lastnamedcs \else - \def\next{\csname\??compoundnormal\string#1\endcsname#2#3}% + \expandafter\let\expandafter\next\lastnamedcs \fi\fi\fi \next} %D For very obscure applications (see for an application \type {lang-sla.tex}) we %D provide: +% \def\simplifiedcompoundcharacter#1#2% +% {\ifcsname\??compoundsingle\string#1\string#2\endcsname +% \doubleexpandafter\firstofoneargument\csname\??compoundsingle\string#1\string#2\endcsname +% \else +% #2% +% \fi} + \def\simplifiedcompoundcharacter#1#2% {\ifcsname\??compoundsingle\string#1\string#2\endcsname - \doubleexpandafter\firstofoneargument\csname\??compoundsingle\string#1\string#2\endcsname + \doubleexpandafter\firstofoneargument\lastnamedcs \else #2% \fi} |