summaryrefslogtreecommitdiff
path: root/tex/context/base/mkii/xtag-hyp.mkii
blob: 105f1a1e37370915498c46508d1309a4fb4aa4a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%D \module
%D   [       file=xtag-hyp,
%D        version=2003.11.24,
%D          title=\CONTEXT\ XML MAcros,
%D       subtitle=Hyphenation,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt XML Macros / Hyphenation}

%D This filter is kind of obsolete, since \UTF\ is not
%D limited to \XML.  So, here we only enable \UTF\ support.

\ifnum\texengine=\luatexengine
    \defineXMLenvironment [hyphenations] [language=\currentlanguage,regime=utf,encoding=\defaultencoding]
      {\startnointerference
       \defineXMLargument [hyphenation] \hyphenation
       \language[\XMLop{language}]}
      {\stopnointerference}
\else
    \defineXMLenvironment [hyphenations] [language=\currentlanguage,regime=utf,encoding=\defaultencoding]
      {\startnointerference
       \defineXMLargument [hyphenation] \hyphenation
       \language[\XMLop{language}]%
       \enableregime[\XMLop{regime}]%
       \enableencoding[\XMLop{encoding}]}
      {\stopnointerference}
\fi

\defineXMLsingular [hyphenate]
  {\-}

\defineXMLgrouped [language] [code=\currentlanguage,scope=local]
  {\doifelse{\XMLop{scope}}{global}\mainlanguage\language[\XMLop{code}]}

\defineXMLsingular [language] [code=\currentlanguage]
  {\doifelse{\XMLop{scope}}{global}\mainlanguage\language[\XMLop{code}]}

\defineXMLsingular [compound] [token=-]
  {\expanded{\directdiscretionary{\XMLop{token}}}}

\endinput

% \mainlanguage[nl] \setupbodyfont[pos] \useXMLfilter[utf,hyp]
%
% \starttext
%
% \hyphenatedword{pati\ediaeresis nten}
% \hyphenatedword{pati\ediaeresis ntenorganisatie}
% \hyphenatedword{pati\ediaeresis ntenplatform}
%
% \startXMLdata
%   <hyphenations language='nl' regime='utf'>
%     <hyphenation>pa-tiën-ten</hyphenation>
%     <hyphenation>pa-tiën-ten-or-ga-ni-sa-tie</hyphenation>
%     <hyphenation>pa-tiën-ten-plat-form</hyphenation>
%   </hyphenations>
% \stopXMLdata
%
% \hyphenatedword{pati\ediaeresis nten}
% \hyphenatedword{pati\ediaeresis ntenorganisatie}
% \hyphenatedword{pati\ediaeresis ntenplatform}
%
% \stoptext