m-hemistich.mkiv /size: 3247 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=m-hemistich,
3%D        version=2013.08.26,
4%D          title=\CONTEXT\ Extra Modules,
5%D       subtitle=Hemistiches,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D This is an experimental module for Idris. More is possible but not now.
15
16\unprotect
17
18\installcorenamespace{hemistich}
19
20\installcommandhandler \??hemistich {hemistich} \??hemistich
21
22\setuphemistich
23  [\c!width=\v!local,
24   \c!distance=4\emwidth,
25   \c!separator=\vl\hskip.25em\vl]
26
27\unexpanded\def\hemistiches
28  {\dosingleempty\dohemistiches}
29
30\unexpanded\def\dohemistiches
31  {\dodohemistiches\empty}
32
33\unexpanded\def\dodohemistiches#1[#2]#3#4%
34  {\dontleavehmode
35   \begingroup
36   \doifelseassignment{#2}
37     {\edef\currenthemistich{#1}%
38      \setupcurrenthemistich[#2]}
39     {\def\currenthemistich{#2}}%
40   \doifelse{\hemistichparameter\c!width}\v!local
41     {\scratchwidth\availablehsize}
42     {\scratchwidth\hemistichparameter\c!width\relax}%
43   \spaceskip\zeropoint\s!plus\plusone\s!fill\relax
44   \dostarttagged\t!division\currenthemistich
45   \hbox to \scratchwidth\bgroup
46     \scratchwidth.5\dimexpr\scratchwidth-\hemistichparameter\c!distance\relax
47     \hbox to \scratchwidth\bgroup
48       \dostarttagged\t!construct\c!lefttext
49       \usehemistichstyleandcolor\c!leftstyle\c!leftcolor#3%
50       \dostoptagged
51     \egroup
52     \hss
53     \begingroup
54       \dostarttagged\t!construct\c!separator
55       \usehemistichstyleandcolor\c!separatorstyle\c!separatorcolor
56       \hemistichparameter\c!separator
57       \dostoptagged
58     \endgroup
59     \hss
60     \hbox to \scratchwidth\bgroup
61       \dostarttagged\t!construct\c!righttext
62       \usehemistichstyleandcolor\c!rightstyle\c!rightcolor#4%
63       \dostoptagged
64     \egroup
65   \egroup
66   \dostoptagged
67   \endgroup}
68
69\unexpanded\def\hemistichescaesura#1#2#3%
70  {\dodohemistiches\empty[\c!separator={#2}]{#1}{#3}}
71
72\appendtoks
73    \setvalue{\currenthemistich}{\dohemistiches{\currenthemistich}}%
74\to \everydefinehemistich
75
76\protect
77
78\continueifinputfile{m-hemistich.mkiv}
79
80\setuphemistich
81  [leftcolor=darkred,
82   separatorcolor=darkgreen,
83   rightcolor=darkblue]
84
85\setupwhitespace
86  [big]
87
88\starttext
89
90% \righttoleft
91
92\hemistichescaesura{left side of the brain}{equals}{right side of the brain}
93
94\hemistiches{left side of the brain}{right side of the brain}
95
96\startitemize
97    \startitem
98        \hemistiches{left side of the brain}{right side of the brain}
99        \startitemize
100            \startitem
101                \hemistiches{left side of the brain}{right side of the brain}
102                \startitemize
103                    \startitem
104                        \hemistiches{left side of the brain}{right side of the brain}
105                    \stopitem
106                \stopitemize
107            \stopitem
108        \stopitemize
109        \startitem
110            \hemistiches{left side of the brain}{right side of the brain}
111        \stopitem
112    \stopitem
113\stopitemize
114
115\startitemize
116\item \hemistiches{left side of the brain}{right side of the brain}
117\stopitemize
118
119\stoptext
120
121