|
|
1
|
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
|
|
2
|
+<style> |
|
|
3
|
+body { counter-reset: section; |
|
|
4
|
+ font-size: 12px; } |
|
|
5
|
+p { align: justify; width: 600px; } |
|
|
6
|
+h2 { counter-reset: subsection; } |
|
|
7
|
+h2::before { counter-increment: section; |
|
|
8
|
+ content: counter(section) ". "; } |
|
|
9
|
+h3 { counter-reset: subsubsection; } |
|
|
10
|
+h3::before { counter-increment: subsection; |
|
|
11
|
+ content: counter(section) "." counter(subsection) " "; } |
|
|
12
|
+h4::before { counter-increment: subsubsection; |
|
|
13
|
+ content: counter(section) "." counter(subsection) "." counter(subsubsection) " "; } |
|
|
14
|
+.dropdown { position: relative; |
|
|
15
|
+ display: inline-block; } |
|
|
16
|
+.drp-content { display: none; |
|
|
17
|
+ position: fixed; |
|
|
18
|
+ bottom: 10px; |
|
|
19
|
+ right: 10px; |
|
|
20
|
+ background-color: #ffcc00; |
|
|
21
|
+ max-width: 500px; |
|
|
22
|
+ box-shadow: 0px 16px 16px 0px rgba(0,0,0,0.6); |
|
|
23
|
+ padding: 0px 6px; |
|
|
24
|
+ z-index: 0; } |
|
|
25
|
+.dropdown:hover .drp-content { display: block; |
|
|
26
|
+ z-index: 2; } |
|
|
27
|
+</style> |
|
|
28
|
+</head><body><center><table style="width: 600px; font-size:12px;"><tr><td><div style="text-align: justify; text-justify: inter-word; width: 600px;"> |
|
|
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
|
+ |
|
|
70
|
+ |
|
|
71
|
+ |
|
|
72
|
+ |
|
|
73
|
+ |
|
|
74
|
+ |
|
|
75
|
+ |
|
|
76
|
+ |
|
|
77
|
+ |
|
|
78
|
+ |
|
|
79
|
+ |
|
|
80
|
+ |
|
|
81
|
+ |
|
|
82
|
+ |
|
|
83
|
+ |
|
|
84
|
+ |
|
|
85
|
+ |
|
|
86
|
+ |
|
|
87
|
+ |
|
|
88
|
+ |
|
|
89
|
+ |
|
|
90
|
+ |
|
|
91
|
+ |
|
|
92
|
+ |
|
|
93
|
+ |
|
|
94
|
+ |
|
|
95
|
+ |
|
|
96
|
+ |
|
|
97
|
+ |
|
|
98
|
+ |
|
|
99
|
+ |
|
|
100
|
+ |
|
|
101
|
+ |
|
|
102
|
+ |
|
|
103
|
+ |
|
|
104
|
+ |
|
|
105
|
+ |
|
|
106
|
+ |
|
|
107
|
+ |
|
|
108
|
+ |
|
|
109
|
+ |
|
|
110
|
+ |
|
|
111
|
+ |
|
|
112
|
+ |
|
|
113
|
+ |
|
|
114
|
+ |
|
|
115
|
+ |
|
|
116
|
+ |
|
|
117
|
+ |
|
|
118
|
+ |
|
|
119
|
+ |
|
|
120
|
+ |
|
|
121
|
+ |
|
|
122
|
+ |
|
|
123
|
+ |
|
|
124
|
+ |
|
|
125
|
+ |
|
|
126
|
+ |
|
|
127
|
+ |
|
|
128
|
+ |
|
|
129
|
+ |
|
|
130
|
+ |
|
|
131
|
+ |
|
|
132
|
+ |
|
|
133
|
+ |
|
|
134
|
+ |
|
|
135
|
+ |
|
|
136
|
+ |
|
|
137
|
+ |
|
|
138
|
+ |
|
|
139
|
+ |
|
|
140
|
+ |
|
|
141
|
+ |
|
|
142
|
+ |
|
|
143
|
+ |
|
|
144
|
+ |
|
|
145
|
+ |
|
|
146
|
+ |
|
|
147
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><big><big><strong>The <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> (version 4) Tutorial</strong></big></big></td></tr></table></center> |
|
|
148
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><big><big><strong>and Reference</strong></big></big></td></tr></table></center> |
|
|
149
|
+<br><br><br> |
|
|
150
|
+ |
|
|
151
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> (the <em>Minimalist Anubis Markup Language</em>) is an easy to use tool for writing texts. It provides |
|
|
152
|
+commands for using different <strong>font</strong> <em>styles</em>, <big>font <big>sizes</big></big>, <div style="display: inline; color: rgb(255,000,000)">colors</div>, for making lists, tables, |
|
|
153
|
+sectionning units, inserting images |
|
|
154
|
+and |
|
|
155
|
+hypertext links, automatically making a table of contents, |
|
|
156
|
+and most sorts of things which are useful for writting texts which are agreable to read. |
|
|
157
|
+It is also able to automatically produce syntactic colorations. The <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> |
|
|
158
|
+compiler produces HTML and PDF output files from a <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> source text. |
|
|
159
|
+This documentation itself was written in <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong>.<br><br> |
|
|
160
|
+ |
|
|
161
|
+Despite its computing capabilities, <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> is <em>not a programming language</em>. It is a <em>text formating language</em>. |
|
|
162
|
+Programming with <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> is easy provided you write only very short pieces of programs. Making big programs in <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> |
|
|
163
|
+would generate absolutely unreadable source texts (like what happens with <img src="png/foAbejNaCwiT0Jzk31KqV0gRWsOY.png" width="25" height="14" style="vertical-align: -3px">). We have managed to present |
|
|
164
|
+many (short) examples of <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> programming in this tutorial, which helps to quickly understand the explanations.<br><br> |
|
|
165
|
+ |
|
|
166
|
+The very first version of <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> was designed for allowing users on a forum to decorate their messages, and was |
|
|
167
|
+very rudimentary. This is |
|
|
168
|
+why <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> was called <em>minimalist</em>. This version 4 is now quite far from being <em>minimalist</em>, but the name <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> |
|
|
169
|
+remains (partly because it's funny when pronounced in French). |
|
|
170
|
+ |
|
|
171
|
+<br><br> |
|
|
172
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><strong>Table of Contents</strong></td></tr></table></center><br> |
|
|
173
|
+<a rel="tag" href="#howto"><br><strong>1. How to use <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong></strong><br></a><a rel="tag" href="#ascmdlinetool"><div align="left" style="display: inline-block; width: 20px;"></div>1.1. As a command line tool<br></a><a rel="tag" href="#fromyoursource"><div align="left" style="display: inline-block; width: 20px;"></div>1.2. From within your Anubis source code<br></a><a rel="tag" href="#aswebuser"><div align="left" style="display: inline-block; width: 20px;"></div>1.3. As a web user<br></a><a rel="tag" href="#syntax"><br><strong>2. The <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> syntax</strong><br></a><a rel="tag" href="#beginend"><div align="left" style="display: inline-block; width: 20px;"></div>2.1. <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span> and special characters<br></a><a rel="tag" href="#syntaxmark"><div align="left" style="display: inline-block; width: 20px;"></div>2.2. Marks<br></a><a rel="tag" href="#linecomments"><div align="left" style="display: inline-block; width: 20px;"></div>2.3. Line comments<br></a><a rel="tag" href="#balanced"><div align="left" style="display: inline-block; width: 20px;"></div>2.4. Parentheses must be balanced<br></a><a rel="tag" href="#marknamedelim"><div align="left" style="display: inline-block; width: 20px;"></div>2.5. How mark names are delimited<br></a><a rel="tag" href="#definingmarks"><div align="left" style="display: inline-block; width: 20px;"></div>2.6. Defining new marks with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span><br></a><a rel="tag" href="#style"><br><strong>3. Be stylish</strong><br></a><a rel="tag" href="#basismaml"><div align="left" style="display: inline-block; width: 20px;"></div>3.1. The file <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div><br></a><a rel="tag" href="#styleexample"><div align="left" style="display: inline-block; width: 20px;"></div>3.2. An example<br></a><a rel="tag" href="#inputstyle"><div align="left" style="display: inline-block; width: 20px;"></div>3.3. Inputting a style file<br></a><a rel="tag" href="#colorize"><br><strong>4. Automatic colorization</strong><br></a><a rel="tag" href="#createcolorizer"><div align="left" style="display: inline-block; width: 20px;"></div>4.1. Creating a colorizer<br></a><a rel="tag" href="#mycolorizer"><div align="left" style="display: inline-block; width: 20px;"></div>4.2. A colorizer example<br></a><a rel="tag" href="#colorizerprecedence"><div align="left" style="display: inline-block; width: 20px;"></div>4.3. Primitive marks and colorizers<br></a><a rel="tag" href="#severalcolorizers"><div align="left" style="display: inline-block; width: 20px;"></div>4.4. Using several colorizers together<br></a><a rel="tag" href="#colorizercall"><div align="left" style="display: inline-block; width: 20px;"></div>4.5. Calling a colorizer from within a colorizer<br></a><a rel="tag" href="#colorcallexample"><div align="left" style="display: inline-block; width: 20px;"></div>4.6. A colorizer call example<br></a><a rel="tag" href="#noncolor"><div align="left" style="display: inline-block; width: 20px;"></div>4.7. A non colorizing example.<br></a><a rel="tag" href="#tools"><br><strong>5. Other tools</strong><br></a><a rel="tag" href="#arithmetics"><div align="left" style="display: inline-block; width: 20px;"></div>5.1. Elementary arithmetics<br></a><a rel="tag" href="#booleans"><div align="left" style="display: inline-block; width: 20px;"></div>5.2. Booleans and control<br></a><a rel="tag" href="#counters"><div align="left" style="display: inline-block; width: 20px;"></div>5.3. Counters<br></a><a rel="tag" href="#lists"><div align="left" style="display: inline-block; width: 20px;"></div>5.4. Lists<br></a><a rel="tag" href="#tips"><br><strong>6. Tips and tricks</strong><br></a><a rel="tag" href="#commonerrors"><div align="left" style="display: inline-block; width: 20px;"></div>6.1. Common errors<br></a><a rel="tag" href="#toolsbasis"><br><strong>7. Tools available in <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div></strong><br></a><a rel="tag" href="#colors"><div align="left" style="display: inline-block; width: 20px;"></div>7.1. Colors<br></a><a rel="tag" href="#stylearticle"><div align="left" style="display: inline-block; width: 20px;"></div>7.2. The style <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">article</span><br></a><a rel="tag" href="#_"></a><a rel="tag" href="#_"></a><a rel="tag" href="#book"><div align="left" style="display: inline-block; width: 20px;"></div>7.3. The style <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">book</span><br></a><a rel="tag" href="#catalog"><br><strong>8. The catalog of <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks</strong><br></a> |
|
|
174
|
+ |
|
|
175
|
+ |
|
|
176
|
+ |
|
|
177
|
+<a id="howto"></a><br><big><big><strong>1. How to use <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong></strong></big></big><br><br> |
|
|
178
|
+ |
|
|
179
|
+<a id="ascmdlinetool"></a><br><big><strong>1.1. As a command line tool</strong></big><br><br> |
|
|
180
|
+ |
|
|
181
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> can be used as a command line tool. This tool can work to its full power |
|
|
182
|
+only if <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">pdflatex</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">dvipng</span> are installed on |
|
|
183
|
+your system. If they are not, you can still use <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong>, but the mark <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$latex</div></strong></span> will not work, and you will not be able |
|
|
184
|
+to produce a PDF output. See the Anubis library documentation for more precise explanations. |
|
|
185
|
+<br> |
|
|
186
|
+<br> |
|
|
187
|
+Assuming that the file <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">my_file.maml</span> contains some <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> source text, |
|
|
188
|
+you just have to issue the command: |
|
|
189
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br>anbexec maml my_file.maml<br><br></pre> |
|
|
190
|
+and the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler will produce a file named <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">my_file.maml.html</span> that you can view with your favorite browser. |
|
|
191
|
+<br> |
|
|
192
|
+<br> |
|
|
193
|
+This command line tool has several options that you can discover by typing: |
|
|
194
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br>anbexec maml<br><br></pre> |
|
|
195
|
+For example, the option <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">-pdf</span> produces a PDF output. |
|
|
196
|
+<br><br> |
|
|
197
|
+ |
|
|
198
|
+<a id="fromyoursource"></a><br><big><strong>1.2. From within your Anubis source code</strong></big><br><br> |
|
|
199
|
+ |
|
|
200
|
+You may also want to use the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler from within your Anubis source code. For example, you may want to use <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> |
|
|
201
|
+ on a web site. |
|
|
202
|
+In this case, have a look at the Anubis library documentation. |
|
|
203
|
+Notice that several <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks are <strong><div style="display: inline; color: rgb(220,0,0)">unsafe</div></strong> for a use on the web. We explain in the library documentation |
|
|
204
|
+how to restrict <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> to safe marks.<br><br> |
|
|
205
|
+ |
|
|
206
|
+ |
|
|
207
|
+<a id="aswebuser"></a><br><big><strong>1.3. As a web user</strong></big><br><br> |
|
|
208
|
+ |
|
|
209
|
+Since <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> can be used in a web site (powered for example by the Anubis web server), it is possible to allow web users |
|
|
210
|
+(those persons visiting the web site) to write <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> texts within web pages. In this case, the set of available <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> |
|
|
211
|
+marks is restricted for ensuring the security of the web server.<br><br> |
|
|
212
|
+ |
|
|
213
|
+ |
|
|
214
|
+ |
|
|
215
|
+ |
|
|
216
|
+<a id="syntax"></a><br><big><big><strong>2. The <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> syntax</strong></big></big><br><br> |
|
|
217
|
+ |
|
|
218
|
+<a id="beginend"></a><br><big><strong>2.1. <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span> and special characters</strong></big><br><br> |
|
|
219
|
+ |
|
|
220
|
+When it reads a source text, the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler ignores everything until the first occurrence of <a rel="tag" href="#begin"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span></a>. After |
|
|
221
|
+this <em>mark</em>, the compiler parses and evaluates the text until it finds <a rel="tag" href="#end"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span></a>. Then again, it ignores everything |
|
|
222
|
+until the next <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span>, and so on.<br><br> |
|
|
223
|
+ |
|
|
224
|
+Between <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span>, the compiler considers all characters as neutral (i.e. they represent only |
|
|
225
|
+themselves), except the character <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span>. This character introduces a so-called <em>mark</em>, which can have so-called |
|
|
226
|
+<em>operands</em>. The operands are delimited by pairs of parentheses. |
|
|
227
|
+ |
|
|
228
|
+Within an operand, all characters are considered as pure text, except the following: |
|
|
229
|
+<span><ul> |
|
|
230
|
+ <li> the character <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span>, |
|
|
231
|
+ <li> the left and right parentheses <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">(</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">)</span>. They are used for delimiting blocks of text. |
|
|
232
|
+ <li> the left and right square brackets <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">[</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">]</span>. They are used for delimiting lists, and within such |
|
|
233
|
+ lists, the comma <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">,</span> is used for separating the elements of the list. The comma is otherwise neutral. |
|
|
234
|
+</ul></span> |
|
|
235
|
+ Of course, the possibility exists of inserting these characters as usual neutral characters. It is enough to prefix |
|
|
236
|
+ them by a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span>. Hence, for example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">[</span> marks the beginning of a list, whereas <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$[</div></strong></span> just represents a |
|
|
237
|
+ left square bracket.<br><br> |
|
|
238
|
+ |
|
|
239
|
+ The figure below sumarizes the above rules. |
|
|
240
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br> <em><div style="display: inline; color: rgb(000,100,000)">before $begin everything is ignored</div></em> |
|
|
241
|
+ |
|
|
242
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong> |
|
|
243
|
+ |
|
|
244
|
+ <em><div style="display: inline; color: rgb(000,000,128)">here, outside any operand of mark, only the character $ is special</div></em> |
|
|
245
|
+ |
|
|
246
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$a_mark</div></strong>(... <em><div style="display: inline; color: rgb(110,000,000)">here, <strong>$ ( ) [</strong> and <strong>]</strong> are special</div></em> ...) |
|
|
247
|
+ (... [ <em><div style="display: inline; color: rgb(160,082,045)">and here, the comma also is special</div></em> ] |
|
|
248
|
+ ... <strong><div style="display: inline; color: rgb(255,000,000)">$another_mark</div></strong>( <em><div style="display: inline; color: rgb(110,000,000)">here too, <strong>$ ( ) [</strong> and <strong>]</strong> are special</div></em> ...) ... |
|
|
249
|
+ (... <strong><div style="display: inline; color: rgb(255,000,000)">$nolist</div></strong>(<em><div style="display: inline; color: rgb(160,032,240)">but here, only <strong>$ (</strong> and <strong>)</strong> are special |
|
|
250
|
+ even if we are within a list, but brackets |
|
|
251
|
+ must still be balanced</div></em>) ...) ) |
|
|
252
|
+ |
|
|
253
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong> |
|
|
254
|
+ |
|
|
255
|
+ <em><div style="display: inline; color: rgb(000,100,000)">here again, everything is ignored</div></em> |
|
|
256
|
+ |
|
|
257
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong> |
|
|
258
|
+ |
|
|
259
|
+ <em><div style="display: inline; color: rgb(000,000,128)">and here, it works again as above after the first $begin</div></em> |
|
|
260
|
+ <em><div style="display: inline; color: rgb(000,000,000)">you can alternate $begin and $end any number of times</div></em> |
|
|
261
|
+ |
|
|
262
|
+ <em><div style="display: inline; color: rgb(000,000,000)">etc... (and an $end is required for closing each $begin)</div></em><br><br></pre> |
|
|
263
|
+ |
|
|
264
|
+ |
|
|
265
|
+<a id="syntaxmark"></a><br><big><strong>2.2. Marks</strong></big><br><br> |
|
|
266
|
+ |
|
|
267
|
+This character <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span> indicates |
|
|
268
|
+that what follows is a <em>mark</em>. The name of the mark (a non empty sequence of characters among |
|
|
269
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(000,000,000)">A...Za...z0...9</div></span>) and the underscore <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">_</span> and not beginning by a digit) |
|
|
270
|
+immediatly follows the character <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span>. The operands |
|
|
271
|
+of the mark follow this name, and each one must be delimited by a pair of parentheses. For example, if you |
|
|
272
|
+want to render some text in dark red, you can write this, where <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">rgb</span> is the name of the mark (this mark takes two operands):<br> |
|
|
273
|
+<br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">120</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(This text is rendered in dark red.)</span></td></tr></table></center><br> |
|
|
274
|
+which produces this: |
|
|
275
|
+<br><center><table style="color: inherit; font-size: inherit;"><tr><td><div style="display: inline; color: rgb(120,0,0)">This text is rendered in dark red.</div></td></tr></table></center><br> |
|
|
276
|
+ |
|
|
277
|
+You shall learn below how to write <em>macros</em> in <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> using the mark <a rel="tag" href="#define"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span></a>, |
|
|
278
|
+so that you can actually simplify the writing of the above. For example the name <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> itself |
|
|
279
|
+is produced by the macro <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$MAML</div></strong></span> which is defined as follows: |
|
|
280
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(MAML)(<div style="display: inline; color: rgb(160,082,045)">0</div>) <div style="display: inline; color: rgb(000,100,000)">$// defining the macro $MAML taking zero operand</div> |
|
|
281
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">180</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(M)<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">120</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(A)<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">80</div>,<div style="display: inline; color: rgb(160,082,045)">80</div>,<div style="display: inline; color: rgb(160,082,045)">80</div>)(M)<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">220</div>)(L)))<br><br></pre> |
|
|
282
|
+ |
|
|
283
|
+<a id="linecomments"></a><br><big><strong>2.3. Line comments</strong></big><br><br> |
|
|
284
|
+ |
|
|
285
|
+Notice that you can put <em>line comments</em> into your <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> source texts as follows:<br><br> |
|
|
286
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(000,100,000)">$// blah blah blah ...</div></span></td></tr></table></center><br> |
|
|
287
|
+The mark <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(000,100,000)">$//</div></span> and what follows until the end of the line are ignored by the compiler (but it keep |
|
|
288
|
+the new line charaters). This kind of comment can be |
|
|
289
|
+put everywhere, including within operands of marks, between the operands of a mark (as shown above) and between |
|
|
290
|
+a mark and its first operand.<br><br> |
|
|
291
|
+ |
|
|
292
|
+<a id="balanced"></a><br><big><strong>2.4. Parentheses must be balanced</strong></big><br><br> |
|
|
293
|
+ |
|
|
294
|
+Each mark accepts a fixed number of operands. Since each operand must be delimited by a pair of parentheses |
|
|
295
|
+(which are not part of the operand itself), the |
|
|
296
|
+parentheses which are part of the operand (if any) must be balanced, otherwise the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> parser will not find the closing |
|
|
297
|
+parenthese. Nevertheless, you can still include unbalanced parentheses in an operand provided that you write them |
|
|
298
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong></span> (left parenthese) and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rpar</div></strong></span> (right parenthese).<br><br> |
|
|
299
|
+ |
|
|
300
|
+ |
|
|
301
|
+<a id="marknamedelim"></a><br><big><strong>2.5. How mark names are delimited</strong></big><br><br> |
|
|
302
|
+ |
|
|
303
|
+Also remark that between any two operands of a mark (and between the mark itself and its first operand), you cannot |
|
|
304
|
+write anything else than <em>white</em> characters (i.e. spaces, line-feeds, carriage-returns and tabulators), and line |
|
|
305
|
+comments. For example, |
|
|
306
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">255</div>)(My text)<br><br></pre> |
|
|
307
|
+is equivalent to |
|
|
308
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong> (<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">255</div>) <div style="display: inline; color: rgb(000,100,000)">$// this make a bright blue</div> |
|
|
309
|
+ (My Text)<br><br></pre> |
|
|
310
|
+But if you write this: <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">255</div>) a (My text)</span>, the compiler will complain that an operand is missing (it |
|
|
311
|
+also indicates the path of the file and the line number where this happens). |
|
|
312
|
+<br> |
|
|
313
|
+<br> |
|
|
314
|
+<em>Remark:</em> The name of a mark is right delimited by the first character which is not an acceptable character |
|
|
315
|
+for such a name. If this character is a space, it is <em>not</em> discarded (unlike what the <img src="png/foAbejNaCwiT0Jzk31KqV0gRWsOY.png" width="25" height="14" style="vertical-align: -3px"> compiler |
|
|
316
|
+does). Hence for example, |
|
|
317
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong> x</span> (with just one space between <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">x</span>) |
|
|
318
|
+produces ( x (with a space between the parenthese and x), |
|
|
319
|
+so that it seems that there is no way to obtain (x (with nothing between the parenthese and x). |
|
|
320
|
+Actually, there is a simple trick to |
|
|
321
|
+obtain the later. Indeed, it is enough to define an <em>identity</em> macro as follows: |
|
|
322
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(id)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)<br><br></pre> |
|
|
323
|
+and to write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$id</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong>)x</span>.<br><br> |
|
|
324
|
+ |
|
|
325
|
+ |
|
|
326
|
+ |
|
|
327
|
+ |
|
|
328
|
+<a id="definingmarks"></a><br><big><strong>2.6. Defining new marks with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span></strong></big><br><br> |
|
|
329
|
+ |
|
|
330
|
+We already saw examples of use of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span> above. It's now time to give precisions about this possibility to |
|
|
331
|
+enrich the language with new marks, which is one of the most powerful tools we have at hand.<br><br> |
|
|
332
|
+ |
|
|
333
|
+The syntax of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span> is as follows:<br> |
|
|
334
|
+<br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><arity></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div>)</span></td></tr></table></center><br> |
|
|
335
|
+where <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> is the name you want to give to your new mark, <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><arity></span></strong></div> its <em>arity</em>, i.e. the number of |
|
|
336
|
+operands it takes, and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div> the value of the mark, which of course depends on the values of it's future operands, which |
|
|
337
|
+is the reason why <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div> contains so-called <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> <em>variables</em> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(255,000,255)">$1</div></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(255,000,255)">$2</div></span>, etc...<br><br> |
|
|
338
|
+ |
|
|
339
|
+Notice that if a macro with the same name <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> is already defined, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span> does not destroy this |
|
|
340
|
+previous definition of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>. It pushes the new definition on a stack of definitions associated to this name. As a |
|
|
341
|
+consequence, when you use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$undefine</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span>, the most recent definition of name is poped off this stack (and |
|
|
342
|
+forgotten) and the previous one prevails again. See <a rel="tag" href="#undefine"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$undefine</div></strong></span></a> for some examples.<br><br> |
|
|
343
|
+ |
|
|
344
|
+When the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler encounters a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><arity></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div>)</span>, it doesn't evaluate |
|
|
345
|
+(i.e. it doesn't <em>compute</em>) <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> nor <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><arity></span></strong></div>. Consequently, these two operands must be written in their |
|
|
346
|
+definitive form.<br><br> |
|
|
347
|
+ |
|
|
348
|
+The third operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div> is only <em>partly evaluated</em> in the sens that macros are expanded within <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div>, |
|
|
349
|
+but primitive marks are not executed (which is in any case mandatory since operands are not yet known). |
|
|
350
|
+This policy has two important consequences: |
|
|
351
|
+<span><ul> |
|
|
352
|
+ <li> if <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div> contains a call to <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>, this call doesn't refer to the macro currently being defined, |
|
|
353
|
+ but to its previous definition (if any). As a byproduct, this also forbids recursive definitions of macros, so |
|
|
354
|
+ protecting the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler against infinite loops.<br><br> |
|
|
355
|
+ <li> <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div> cannot refer to a macro which is not yet defined (there are no forward references in <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong>), so |
|
|
356
|
+ that the macro always keeps the meaning it has when it is defined, except that the values provided by primitive marks |
|
|
357
|
+ will be computed only when the macro is used. |
|
|
358
|
+</ul></span> |
|
|
359
|
+Nevertheless, you may want, especially if you are defining a customizable style of document for example, to define |
|
|
360
|
+macros making use of other macros which can be redefined by the user of your style file. The solution is first of all |
|
|
361
|
+to define these other macros conditionally, i.e. as follows: |
|
|
362
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$defined</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>))()(<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(...)(...))<br><br></pre> |
|
|
363
|
+that is that you provide a <em>default</em> definition, but only in case your user did not define <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>. Of course, this |
|
|
364
|
+implies that your user must define <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> <em>before</em> writing <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><your style file></span></strong></div>)</span>.<br><br> |
|
|
365
|
+ |
|
|
366
|
+ |
|
|
367
|
+<a id="style"></a><br><big><big><strong>3. Be stylish</strong></big></big><br><br> |
|
|
368
|
+ |
|
|
369
|
+The primitive <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks are rather basic, and should preferably be used for creating macros. |
|
|
370
|
+In other words, it's better to first define (using the <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span> mark) the concepts you will use in your |
|
|
371
|
+text, rather than writing them from scratch at each occurrence. In some sens, defining these concepts is the same as |
|
|
372
|
+creating your own style. <br><br> |
|
|
373
|
+ |
|
|
374
|
+<a id="basismaml"></a><br><big><strong>3.1. The file <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div></strong></big><br><br> |
|
|
375
|
+ |
|
|
376
|
+Notice that a file <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div> exists in <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">library/doc_tools</span></div> which already contains macros of |
|
|
377
|
+common usage. |
|
|
378
|
+<br><br> |
|
|
379
|
+ |
|
|
380
|
+<a id="styleexample"></a><br><big><strong>3.2. An example</strong></big><br><br> |
|
|
381
|
+ |
|
|
382
|
+It can be the case that some concept of your discourse has to be emphasized in a particular way, and that |
|
|
383
|
+you (arbitrarily) chosed to print it |
|
|
384
|
+in red. You should not use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">255</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(...)</span> in the text. You should better first give a name (say <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">emph</span>) to |
|
|
385
|
+your concept, and define it near the beginning of the text: |
|
|
386
|
+<br><br> |
|
|
387
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(emph)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">255</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>))</span> |
|
|
388
|
+<br><br> |
|
|
389
|
+and write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$emph</div></strong>(...)</span> in the text instead of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">255</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(...)</span>. |
|
|
390
|
+<br><br> |
|
|
391
|
+This will structure your text in a useful semantic way, instead of a non significant way, making it easier |
|
|
392
|
+to later update. |
|
|
393
|
+It also has the advantage that you can later easily change the layout of the text by modifying |
|
|
394
|
+only the values in these <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span>. |
|
|
395
|
+<br><br> |
|
|
396
|
+<a id="inputstyle"></a><br><big><strong>3.3. Inputting a style file</strong></big><br><br> |
|
|
397
|
+ |
|
|
398
|
+The <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong></span> mark let you <em>input</em> a <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> source at any point of another <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> source. Hence, you should |
|
|
399
|
+define your style in a file (say <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">mystyle.maml</span>) and put an <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong>(mystyle.maml)</span> after the first <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span> |
|
|
400
|
+of your source file. Notice that the input file also needs to contain a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span> and an <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span>.<br><br> |
|
|
401
|
+ |
|
|
402
|
+ |
|
|
403
|
+ |
|
|
404
|
+ |
|
|
405
|
+<a id="colorize"></a><br><big><big><strong>4. Automatic colorization</strong></big></big><br><br> |
|
|
406
|
+ |
|
|
407
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> has a simple system for automatic colorization of texts. Within a <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> source text, |
|
|
408
|
+you can define one or several colorizers, and later apply them at will. Actually, by <em>colorization</em> we mean |
|
|
409
|
+something quite general, i.e. not dealing only with colors.<br><br> |
|
|
410
|
+ |
|
|
411
|
+<a id="createcolorizer"></a><br><big><strong>4.1. Creating a colorizer</strong></big><br><br> |
|
|
412
|
+ |
|
|
413
|
+In order to create a colorizer, you must: |
|
|
414
|
+<span><ul> |
|
|
415
|
+ <li> define one or several <em>color rules</em>, |
|
|
416
|
+ <li> when done, create the <em>colorizer</em>. |
|
|
417
|
+</ul></span> |
|
|
418
|
+A color rule has the form:<br> |
|
|
419
|
+<br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><regular expression></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> expression></span></strong></div>)</span></td></tr></table></center><br> |
|
|
420
|
+The <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer name></span></strong></div> of the colorizer must be an ordinary symbol. The <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><regular expression></span></strong></div> must follow the syntax defined in |
|
|
421
|
+<div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">library/lexical_analysis/fast_lexer_5.anubis</span></div> (see the Anubis library documentation) and <em>is not evaluated</em>, so |
|
|
422
|
+that it must be written in its definitive form. |
|
|
423
|
+The <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> expression></span></strong></div> can contain the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> <em>variable</em> |
|
|
424
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(255,000,255)">$1</div></span> which is replaced by the token (i.e. the character string recognized by the regular expression) |
|
|
425
|
+to be colorized.<br><br> |
|
|
426
|
+ |
|
|
427
|
+Once the color rules are setup, you can create the colorizer as follows:<br> |
|
|
428
|
+<br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer name></span></strong></div>)</span></td></tr></table></center><br> |
|
|
429
|
+Then, you can colorize a text:<br> |
|
|
430
|
+<br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></td></tr></table></center><br> |
|
|
431
|
+ |
|
|
432
|
+<a id="mycolorizer"></a><br><big><strong>4.2. A colorizer example</strong></big><br><br> |
|
|
433
|
+ |
|
|
434
|
+As an example, consider the following definition of a colorizer, which is used in this tutorial for colorizing |
|
|
435
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> code: |
|
|
436
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br> <div style="display: inline; color: rgb(000,100,000)">$// line comments</div> |
|
|
437
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(maml)(#$#/#/.*)(<strong><div style="display: inline; color: rgb(255,000,000)">$darkgreen</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
438
|
+ <div style="display: inline; color: rgb(000,100,000)">$// mark names (inclusing inhibited characters)</div> |
|
|
439
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(maml)(<div style="display: inline; color: rgb(000,000,000)">(#$[#,#[#]#(#)])|(#$[a-zA-Z#_][0-9a-zA-Z#_]*)|(#$#$)</div>) |
|
|
440
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>))) |
|
|
441
|
+ <div style="display: inline; color: rgb(000,100,000)">$// MAML variables</div> |
|
|
442
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(maml)(<div style="display: inline; color: rgb(000,000,000)">#$[0-9]+</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$magenta</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
443
|
+ <div style="display: inline; color: rgb(000,100,000)">$// integers</div> |
|
|
444
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(maml)(<div style="display: inline; color: rgb(000,000,000)">[0-9]+</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$sienna</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
445
|
+ <div style="display: inline; color: rgb(000,100,000)">$// creating the colorizer</div> |
|
|
446
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(maml)<br><br></pre> |
|
|
447
|
+There are plenty of examples of use of this colorizer in this tutorial (including the above definition of the |
|
|
448
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">maml</span> colorizer !), so that you can easily check that the result is coherent with the definition.<br><br> |
|
|
449
|
+ |
|
|
450
|
+Notice that we used <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong></span> in the above definition, which is not a color per se. Actually any mark can be used, so |
|
|
451
|
+that colorizers can also be used for a purpose having nothing to do with colors.<br><br> |
|
|
452
|
+ |
|
|
453
|
+<a id="colorizerprecedence"></a><br><big><strong>4.3. Primitive marks and colorizers</strong></big><br><br> |
|
|
454
|
+ |
|
|
455
|
+You also need to know what happens if the text to be colorized contains <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks. |
|
|
456
|
+All macros are expanded before colorization applies, so that macros have no incidence on colorization, but they can be |
|
|
457
|
+used within a text to be colorized. <br><br> |
|
|
458
|
+ |
|
|
459
|
+Things are different for primitive marks. Indeed, how do you interpret for example |
|
|
460
|
+<br><br> |
|
|
461
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(maml)(<div style="display: inline; color: rgb(000,000,000)">This is $rgb(120,0,0)(an example) text.</div>)</span></td></tr></table></center> |
|
|
462
|
+<br> |
|
|
463
|
+It should be clear that <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rgb</span> in this example should |
|
|
464
|
+have precedence over <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong></span>, otherwise it would be useless. So, the behavior of <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> is that it doesn't |
|
|
465
|
+apply a colorizer within the operands of primitive marks (it would be nevertheless meaningless in the case of the operand |
|
|
466
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">120,0,0</span> of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rgb</span>).<br><br> |
|
|
467
|
+ |
|
|
468
|
+As a consequence, the above example gives |
|
|
469
|
+This is <div style="display: inline; color: rgb(120,0,0)">an example</div> text., |
|
|
470
|
+not This is an example text.<br><br> |
|
|
471
|
+ |
|
|
472
|
+Nevertheless, you can still colorize within an operand within a text to be colorized. For example, |
|
|
473
|
+<br><br> |
|
|
474
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tt</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(maml)(<div style="display: inline; color: rgb(000,000,000)">$$bold($darkgreen($$red(text)))</div>))</span></td></tr></table></center> |
|
|
475
|
+<br> |
|
|
476
|
+produces <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<div style="display: inline; color: rgb(000,100,000)">$red(text)</div>)</span>, whereas |
|
|
477
|
+<br><br> |
|
|
478
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tt</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(maml)(<div style="display: inline; color: rgb(000,000,000)">$$bold($darkgreen($colorize(maml)($$red(text))))</div>))</span></td></tr></table></center> |
|
|
479
|
+<br> |
|
|
480
|
+produces <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<div style="display: inline; color: rgb(000,100,000)"><strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(text)</div>)</span>.<br><br> |
|
|
481
|
+ |
|
|
482
|
+<a id="severalcolorizers"></a><br><big><strong>4.4. Using several colorizers together</strong></big><br><br> |
|
|
483
|
+ |
|
|
484
|
+You can use several colorizers together. Below is another colorizer: |
|
|
485
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(funny)([a-e])(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">10</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">130</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$sup</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>))) |
|
|
486
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(funny)([e-k])(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">150</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$italic</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>))) |
|
|
487
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(funny)([l-p])(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">100</div>,<div style="display: inline; color: rgb(160,082,045)">100</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)))) |
|
|
488
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(funny)([p-z])(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">100</div>,<div style="display: inline; color: rgb(160,082,045)">100</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$sub</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)))) |
|
|
489
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(funny)<br><br></pre> |
|
|
490
|
+ |
|
|
491
|
+ |
|
|
492
|
+ |
|
|
493
|
+ |
|
|
494
|
+ |
|
|
495
|
+If you write: |
|
|
496
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$tt</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(maml) |
|
|
497
|
+ (<div style="display: inline; color: rgb(000,000,000)">$$bold(Some text $colorize(funny)(with a piece of funny text) in it.)</div>))<br><br></pre> |
|
|
498
|
+you get <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(Some text <div style="display: inline; color: rgb(0,100,100)"><sub><big>w</big></sub></div><div style="display: inline; color: rgb(150,0,0)"><em>i</em></div><div style="display: inline; color: rgb(0,100,100)"><sub><big>t</big></sub></div><div style="display: inline; color: rgb(150,0,0)"><em>h</em></div> <div style="display: inline; color: rgb(10,0,130)"><sup>a</sup></div> <div style="display: inline; color: rgb(100,100,0)"><big><big>p</big></big></div><div style="display: inline; color: rgb(150,0,0)"><em>i</em></div><div style="display: inline; color: rgb(10,0,130)"><sup>e</sup></div><div style="display: inline; color: rgb(10,0,130)"><sup>c</sup></div><div style="display: inline; color: rgb(10,0,130)"><sup>e</sup></div> <div style="display: inline; color: rgb(100,100,0)"><big><big>o</big></big></div><div style="display: inline; color: rgb(150,0,0)"><em>f</em></div> <div style="display: inline; color: rgb(150,0,0)"><em>f</em></div><div style="display: inline; color: rgb(0,100,100)"><sub><big>u</big></sub></div><div style="display: inline; color: rgb(100,100,0)"><big><big>n</big></big></div><div style="display: inline; color: rgb(100,100,0)"><big><big>n</big></big></div><div style="display: inline; color: rgb(0,100,100)"><sub><big>y</big></sub></div> <div style="display: inline; color: rgb(0,100,100)"><sub><big>t</big></sub></div><div style="display: inline; color: rgb(10,0,130)"><sup>e</sup></div><div style="display: inline; color: rgb(0,100,100)"><sub><big>x</big></sub></div><div style="display: inline; color: rgb(0,100,100)"><sub><big>t</big></sub></div> in it.)</span><br><br> |
|
|
499
|
+ |
|
|
500
|
+ |
|
|
501
|
+<a id="colorizercall"></a><br><big><strong>4.5. Calling a colorizer from within a colorizer</strong></big><br><br> |
|
|
502
|
+ |
|
|
503
|
+Using several colorizers together can also help to solve particular colorizing problems, because the above is not the |
|
|
504
|
+whole story about <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> colorizers. Indeed, we have another primitive mark: |
|
|
505
|
+<br><br> |
|
|
506
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><mode></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer1></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><call></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer2></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><return></span></strong></div>)</span></td></tr></table></center> |
|
|
507
|
+<br> |
|
|
508
|
+which allows to <em>call</em> a colorizer (here <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer2></span></strong></div></span>) from within another colorizer (here <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer1></span></strong></div></span>). |
|
|
509
|
+The operands <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><call></span></strong></div></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><return></span></strong></div></span>, which can be any <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> expressions expanding into regular expressions, are used |
|
|
510
|
+as <em>call</em> and <em>return</em> instructions. In other words, when <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer1></span></strong></div></span> encounters something matching the |
|
|
511
|
+regular expression <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><call></span></strong></div></span> it calls <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer2></span></strong></div></span> which will return when it founds something matching the |
|
|
512
|
+regular expression <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><return></span></strong></div></span>.<br><br> |
|
|
513
|
+ |
|
|
514
|
+The pieces of text matching <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><call></span></strong></div></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><return></span></strong></div></span> are colorized by <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer1></span></strong></div></span> or by |
|
|
515
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer2></span></strong></div></span>, depending on the value of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><mode></span></strong></div>. There are four modes: |
|
|
516
|
+<span><ul> |
|
|
517
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">ee</span> (<em>exclude-exclude</em>): both <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><call></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><return></span></strong></div> are colorized by <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer1></span></strong></div>, |
|
|
518
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">ei</span> (<em>exclude-include</em>): <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><call></span></strong></div> is colorized <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer1></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><return></span></strong></div> by <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer2></span></strong></div>, |
|
|
519
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">ie</span> (<em>include-exclude</em>): <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><call></span></strong></div> is colorized <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer2></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><return></span></strong></div> by <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer1></span></strong></div>, |
|
|
520
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">ii</span> (<em>include-include</em>): both <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><call></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><return></span></strong></div> are colorized by <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><colorizer2></span></strong></div>. |
|
|
521
|
+</ul></span> |
|
|
522
|
+ |
|
|
523
|
+ |
|
|
524
|
+<a id="colorcallexample"></a><br><big><strong>4.6. A colorizer call example</strong></big><br><br> |
|
|
525
|
+ |
|
|
526
|
+Consider the case of an Anubis source text, such as: |
|
|
527
|
+<div style="display: inline; color: rgb(120,40,40)"><pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"> |
|
|
528
|
+ |
|
|
529
|
+ A function for computing the length of a list: |
|
|
530
|
+ |
|
|
531
|
+public define Int |
|
|
532
|
+ length |
|
|
533
|
+ ( |
|
|
534
|
+ List($T) l |
|
|
535
|
+ ) = |
|
|
536
|
+ if l is |
|
|
537
|
+ { |
|
|
538
|
+ [ ] then 0, |
|
|
539
|
+ [h . t] then 1 + length(t) |
|
|
540
|
+ }. |
|
|
541
|
+ |
|
|
542
|
+ Blah blah blah ... |
|
|
543
|
+ |
|
|
544
|
+</pre></div> |
|
|
545
|
+This example contains a <em>paragraph</em> defining a function, which is surrounded by so-called <em>off-paragraph |
|
|
546
|
+comments</em>. In order to colorize this text we need to be able to detect the beginning and the end of Anubis paragraphs. |
|
|
547
|
+This is not possible if we use only color rules as defined by <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong></span>, but it becomes possible if we also use |
|
|
548
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong></span>.<br><br> |
|
|
549
|
+ |
|
|
550
|
+Indeed, we first define two colorizers, say <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">off</span> for off-paragraph comments and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in</span> for paragraphs.<br><br> |
|
|
551
|
+ |
|
|
552
|
+In this example, we deliberately chosed to have a head of case of the form <div style="display: inline; color: rgb(120,40,40)">h . t</div> in the conditional, |
|
|
553
|
+because it also contains an <em>end dot</em> (a dot followed by a space or a linefeed) which must not be confused |
|
|
554
|
+with the end dot closing the paragraph.<br><br> |
|
|
555
|
+ |
|
|
556
|
+In order to colorize the paragraph itself, we need something like: |
|
|
557
|
+<br><br> |
|
|
558
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong>(ii)(off)(#npublic)(in)(#.[# #r#n])</span></td></tr></table></center> |
|
|
559
|
+<br> |
|
|
560
|
+However, if we do that, the colorization of the paragraph will end at the end dot which is within the square brackets. |
|
|
561
|
+In order to avoid this, we must add another call: |
|
|
562
|
+<br><br> |
|
|
563
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong>(ii)(in)(#[)(in)(#])</span></td></tr></table></center> |
|
|
564
|
+<br> |
|
|
565
|
+(the sharp character, i.e. the escape character for regular expressions, |
|
|
566
|
+in front of the square brackets is necessary since square brackets are special characters |
|
|
567
|
+in regular expressions). |
|
|
568
|
+That way, the colorizer <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in</span> will call itself when it reads an opening square bracket and return (to itself) when it reads the |
|
|
569
|
+corresponding closing square bracket.<br><br> |
|
|
570
|
+ |
|
|
571
|
+However, with these two call rules, the colorization is still not correct because when the opening bracket of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">[h . |
|
|
572
|
+t]</span> is seen the colorizer <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in</span> calls itself, and the second instance of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in</span> returns on the end dot so that the |
|
|
573
|
+first instance of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in</span> returns on the closing bracket, and the <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">off</span> colorizer is active again at this |
|
|
574
|
+closing bracket. The solution is to define two distinct <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in</span> colorizers, as shown below.<br> |
|
|
575
|
+ |
|
|
576
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(off)(.)(<strong><div style="display: inline; color: rgb(255,000,000)">$darkgreen</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
577
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(in<div style="display: inline; color: rgb(160,082,045)">1</div>)(.)(<strong><div style="display: inline; color: rgb(255,000,000)">$darkred</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
578
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(in<div style="display: inline; color: rgb(160,082,045)">2</div>)(.)(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">100</div>,<div style="display: inline; color: rgb(160,082,045)">100</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
579
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(in<div style="display: inline; color: rgb(160,082,045)">1</div>)(#npublic[# #r#n]+define)(<strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong>(<div style="display: inline; color: rgb(160,082,045)">220</div>,<div style="display: inline; color: rgb(160,082,045)">220</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">100</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)))) |
|
|
580
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(in<div style="display: inline; color: rgb(160,082,045)">1</div>)(#.[# #r#n])(<strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong>(<div style="display: inline; color: rgb(160,082,045)">220</div>,<div style="display: inline; color: rgb(160,082,045)">220</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">100</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)))) |
|
|
581
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong>(ii)(off)(#npublic[# #r#n]+define)(in<div style="display: inline; color: rgb(160,082,045)">1</div>)(#.[# #r#n]) |
|
|
582
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong>(ii)(in<div style="display: inline; color: rgb(160,082,045)">1</div>)(#[)(in<div style="display: inline; color: rgb(160,082,045)">2</div>)(#]) |
|
|
583
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong>(ii)(in<div style="display: inline; color: rgb(160,082,045)">2</div>)(#[)(in<div style="display: inline; color: rgb(160,082,045)">2</div>)(#]) |
|
|
584
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(in<div style="display: inline; color: rgb(160,082,045)">1</div>) |
|
|
585
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(in<div style="display: inline; color: rgb(160,082,045)">2</div>) |
|
|
586
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(off)<br><br></pre> |
|
|
587
|
+ |
|
|
588
|
+ |
|
|
589
|
+ |
|
|
590
|
+ |
|
|
591
|
+ |
|
|
592
|
+ |
|
|
593
|
+ |
|
|
594
|
+ |
|
|
595
|
+ |
|
|
596
|
+ |
|
|
597
|
+ |
|
|
598
|
+ |
|
|
599
|
+ |
|
|
600
|
+(we put a different color for <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in<div style="display: inline; color: rgb(160,082,045)">1</div></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in<div style="display: inline; color: rgb(160,082,045)">2</div></span> texts for showing where <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in<div style="display: inline; color: rgb(160,082,045)">1</div></span> calls <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in<div style="display: inline; color: rgb(160,082,045)">2</div></span> and where <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">in<div style="display: inline; color: rgb(160,082,045)">2</div></span> |
|
|
601
|
+returns). |
|
|
602
|
+Now, if we write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$_ivory</div></strong>)(<strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(off)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><the above example text></span></strong></div>))</span>, we get: |
|
|
603
|
+ |
|
|
604
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,230,210); width: 600px;"> |
|
|
605
|
+ |
|
|
606
|
+ <div style="display: inline; color: rgb(000,100,000)">A</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">f</div><div style="display: inline; color: rgb(000,100,000)">u</div><div style="display: inline; color: rgb(000,100,000)">n</div><div style="display: inline; color: rgb(000,100,000)">c</div><div style="display: inline; color: rgb(000,100,000)">t</div><div style="display: inline; color: rgb(000,100,000)">i</div><div style="display: inline; color: rgb(000,100,000)">o</div><div style="display: inline; color: rgb(000,100,000)">n</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">f</div><div style="display: inline; color: rgb(000,100,000)">o</div><div style="display: inline; color: rgb(000,100,000)">r</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">c</div><div style="display: inline; color: rgb(000,100,000)">o</div><div style="display: inline; color: rgb(000,100,000)">m</div><div style="display: inline; color: rgb(000,100,000)">p</div><div style="display: inline; color: rgb(000,100,000)">u</div><div style="display: inline; color: rgb(000,100,000)">t</div><div style="display: inline; color: rgb(000,100,000)">i</div><div style="display: inline; color: rgb(000,100,000)">n</div><div style="display: inline; color: rgb(000,100,000)">g</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">t</div><div style="display: inline; color: rgb(000,100,000)">h</div><div style="display: inline; color: rgb(000,100,000)">e</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">l</div><div style="display: inline; color: rgb(000,100,000)">e</div><div style="display: inline; color: rgb(000,100,000)">n</div><div style="display: inline; color: rgb(000,100,000)">g</div><div style="display: inline; color: rgb(000,100,000)">t</div><div style="display: inline; color: rgb(000,100,000)">h</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">o</div><div style="display: inline; color: rgb(000,100,000)">f</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">a</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">l</div><div style="display: inline; color: rgb(000,100,000)">i</div><div style="display: inline; color: rgb(000,100,000)">s</div><div style="display: inline; color: rgb(000,100,000)">t</div><div style="display: inline; color: rgb(000,100,000)">:</div> |
|
|
607
|
+ <div style="display: inline; background-color: rgb(220,220,0); "><div style="display: inline; color: rgb(0,0,100)"><strong> |
|
|
608
|
+public define</strong></div></div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">I</div><div style="display: inline; color: rgb(110,000,000)">n</div><div style="display: inline; color: rgb(110,000,000)">t</div> |
|
|
609
|
+ <div style="display: inline; color: rgb(110,000,000)">l</div><div style="display: inline; color: rgb(110,000,000)">e</div><div style="display: inline; color: rgb(110,000,000)">n</div><div style="display: inline; color: rgb(110,000,000)">g</div><div style="display: inline; color: rgb(110,000,000)">t</div><div style="display: inline; color: rgb(110,000,000)">h</div> |
|
|
610
|
+ <div style="display: inline; color: rgb(110,000,000)">(</div> |
|
|
611
|
+ <div style="display: inline; color: rgb(110,000,000)">L</div><div style="display: inline; color: rgb(110,000,000)">i</div><div style="display: inline; color: rgb(110,000,000)">s</div><div style="display: inline; color: rgb(110,000,000)">t</div><div style="display: inline; color: rgb(110,000,000)">(</div><div style="display: inline; color: rgb(110,000,000)">$</div><div style="display: inline; color: rgb(110,000,000)">T</div><div style="display: inline; color: rgb(110,000,000)">)</div> <div style="display: inline; color: rgb(110,000,000)">l</div> |
|
|
612
|
+ <div style="display: inline; color: rgb(110,000,000)">)</div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">=</div> |
|
|
613
|
+ <div style="display: inline; color: rgb(110,000,000)">i</div><div style="display: inline; color: rgb(110,000,000)">f</div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">l</div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">i</div><div style="display: inline; color: rgb(110,000,000)">s</div><div style="display: inline; color: rgb(110,000,000)"> </div> |
|
|
614
|
+ <div style="display: inline; color: rgb(110,000,000)">{</div> |
|
|
615
|
+ <div style="display: inline; color: rgb(0,100,100)">[</div><div style="display: inline; color: rgb(0,100,100)"> </div><div style="display: inline; color: rgb(0,100,100)">]</div> <div style="display: inline; color: rgb(110,000,000)">t</div><div style="display: inline; color: rgb(110,000,000)">h</div><div style="display: inline; color: rgb(110,000,000)">e</div><div style="display: inline; color: rgb(110,000,000)">n</div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">0</div><div style="display: inline; color: rgb(110,000,000)">,</div><div style="display: inline; color: rgb(110,000,000)"> </div> |
|
|
616
|
+ <div style="display: inline; color: rgb(0,100,100)">[</div><div style="display: inline; color: rgb(0,100,100)">h</div><div style="display: inline; color: rgb(0,100,100)"> </div><div style="display: inline; color: rgb(0,100,100)">.</div><div style="display: inline; color: rgb(0,100,100)"> </div><div style="display: inline; color: rgb(0,100,100)">t</div><div style="display: inline; color: rgb(0,100,100)">]</div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">t</div><div style="display: inline; color: rgb(110,000,000)">h</div><div style="display: inline; color: rgb(110,000,000)">e</div><div style="display: inline; color: rgb(110,000,000)">n</div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">1</div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">+</div><div style="display: inline; color: rgb(110,000,000)"> </div><div style="display: inline; color: rgb(110,000,000)">l</div><div style="display: inline; color: rgb(110,000,000)">e</div><div style="display: inline; color: rgb(110,000,000)">n</div><div style="display: inline; color: rgb(110,000,000)">g</div><div style="display: inline; color: rgb(110,000,000)">t</div><div style="display: inline; color: rgb(110,000,000)">h</div><div style="display: inline; color: rgb(110,000,000)">(</div><div style="display: inline; color: rgb(110,000,000)">t</div><div style="display: inline; color: rgb(110,000,000)">)</div> |
|
|
617
|
+ <div style="display: inline; color: rgb(110,000,000)">}</div><div style="display: inline; background-color: rgb(220,220,0); "><div style="display: inline; color: rgb(0,0,100)"><strong>. </strong></div></div> |
|
|
618
|
+ |
|
|
619
|
+ <div style="display: inline; color: rgb(000,100,000)">B</div><div style="display: inline; color: rgb(000,100,000)">l</div><div style="display: inline; color: rgb(000,100,000)">a</div><div style="display: inline; color: rgb(000,100,000)">h</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">b</div><div style="display: inline; color: rgb(000,100,000)">l</div><div style="display: inline; color: rgb(000,100,000)">a</div><div style="display: inline; color: rgb(000,100,000)">h</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">b</div><div style="display: inline; color: rgb(000,100,000)">l</div><div style="display: inline; color: rgb(000,100,000)">a</div><div style="display: inline; color: rgb(000,100,000)">h</div><div style="display: inline; color: rgb(000,100,000)"> </div><div style="display: inline; color: rgb(000,100,000)">.</div><div style="display: inline; color: rgb(000,100,000)">.</div><div style="display: inline; color: rgb(000,100,000)">.</div> |
|
|
620
|
+ |
|
|
621
|
+</pre> |
|
|
622
|
+and more generally, this works for any depth of square brackets nesting.<br><br> |
|
|
623
|
+ |
|
|
624
|
+ |
|
|
625
|
+<a id="noncolor"></a><br><big><strong>4.7. A non colorizing example.</strong></big><br><br> |
|
|
626
|
+ |
|
|
627
|
+As said above, colorizers are more general than just a tool for colorizing text. For example, they can be used, |
|
|
628
|
+to some extent, for <em>parsing</em> a text.<br><br> |
|
|
629
|
+ |
|
|
630
|
+Assume that we have a text which is in CSV (comma separated values) format. Such texts are very common since every |
|
|
631
|
+database system is able to export its tables in this format. Below is an example of such a datum. |
|
|
632
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(mycsvtable)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
633
|
+(Ford,Max,<div style="display: inline; color: rgb(160,082,045)">32</div>,New York |
|
|
634
|
+Jackson,Niel,<div style="display: inline; color: rgb(160,082,045)">64</div>,Los Angeles |
|
|
635
|
+Kennedy,Justin,<div style="display: inline; color: rgb(160,082,045)">25</div>,New York |
|
|
636
|
+Obama,Barack,<div style="display: inline; color: rgb(160,082,045)">55</div>,Washington |
|
|
637
|
+Smith,John,<div style="display: inline; color: rgb(160,082,045)">24</div>,Baltimore |
|
|
638
|
+Trump,Donald,<div style="display: inline; color: rgb(160,082,045)">70</div>,New York)<br><br></pre> |
|
|
639
|
+ |
|
|
640
|
+ |
|
|
641
|
+ |
|
|
642
|
+ |
|
|
643
|
+In this piece of text, the lines of the table are separated by linefeeds and the values in a line are separated by |
|
|
644
|
+commas. For simplicity, we assume that the values contain no comma and no linefeed. In a realistic situation, we would |
|
|
645
|
+have to enhance our example for handling (for example) commas which are within a pair of parentheses. This kind of |
|
|
646
|
+enhancement would require some <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong></span>.<br><br> |
|
|
647
|
+ |
|
|
648
|
+We define the following colorizer. |
|
|
649
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong>(col)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
650
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong>(line)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
651
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(display)(#,)(<strong><div style="display: inline; color: rgb(255,000,000)">$addtocounter</div></strong>(col)(<div style="display: inline; color: rgb(160,082,045)">1</div>)) |
|
|
652
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(display)(#n) |
|
|
653
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$addtocounter</div></strong>(line)(<div style="display: inline; color: rgb(160,082,045)">1</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong><strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">40</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(line))<strong><div style="display: inline; color: rgb(255,000,000)">$setcounter</div></strong>(col)(<div style="display: inline; color: rgb(160,082,045)">0</div>)) |
|
|
654
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(display)([^#n#,]*)(<strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$equals</div></strong>(<div style="display: inline; color: rgb(160,082,045)">2</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(col))) |
|
|
655
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">40</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>))) |
|
|
656
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$equals</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(col))) |
|
|
657
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">100</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>))) |
|
|
658
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">100</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)))) |
|
|
659
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(display)<br><br></pre> |
|
|
660
|
+ |
|
|
661
|
+ |
|
|
662
|
+ |
|
|
663
|
+ |
|
|
664
|
+ |
|
|
665
|
+ |
|
|
666
|
+ |
|
|
667
|
+If we write |
|
|
668
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(display)( |
|
|
669
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$mycsvtable</div></strong>)<br><br></pre> |
|
|
670
|
+ |
|
|
671
|
+we obtain: |
|
|
672
|
+<br> |
|
|
673
|
+<br><div align="left" style="display: inline-block; width: 40px;">1</div><div align="left" style="display: inline-block; width: 100px;"><strong>Ford</strong></div><div align="left" style="display: inline-block; width: 100px;">Max</div><div align="left" style="display: inline-block; width: 40px;"><div style="display: inline; color: rgb(255,000,000)">32</div></div><div align="left" style="display: inline-block; width: 100px;">New York</div><br><div align="left" style="display: inline-block; width: 40px;">2</div><div align="left" style="display: inline-block; width: 100px;"><strong>Jackson</strong></div><div align="left" style="display: inline-block; width: 100px;">Niel</div><div align="left" style="display: inline-block; width: 40px;"><div style="display: inline; color: rgb(255,000,000)">64</div></div><div align="left" style="display: inline-block; width: 100px;">Los Angeles</div><br><div align="left" style="display: inline-block; width: 40px;">3</div><div align="left" style="display: inline-block; width: 100px;"><strong>Kennedy</strong></div><div align="left" style="display: inline-block; width: 100px;">Justin</div><div align="left" style="display: inline-block; width: 40px;"><div style="display: inline; color: rgb(255,000,000)">25</div></div><div align="left" style="display: inline-block; width: 100px;">New York</div><br><div align="left" style="display: inline-block; width: 40px;">4</div><div align="left" style="display: inline-block; width: 100px;"><strong>Obama</strong></div><div align="left" style="display: inline-block; width: 100px;">Barack</div><div align="left" style="display: inline-block; width: 40px;"><div style="display: inline; color: rgb(255,000,000)">55</div></div><div align="left" style="display: inline-block; width: 100px;">Washington</div><br><div align="left" style="display: inline-block; width: 40px;">5</div><div align="left" style="display: inline-block; width: 100px;"><strong>Smith</strong></div><div align="left" style="display: inline-block; width: 100px;">John</div><div align="left" style="display: inline-block; width: 40px;"><div style="display: inline; color: rgb(255,000,000)">24</div></div><div align="left" style="display: inline-block; width: 100px;">Baltimore</div><br><div align="left" style="display: inline-block; width: 40px;">6</div><div align="left" style="display: inline-block; width: 100px;"><strong>Trump</strong></div><div align="left" style="display: inline-block; width: 100px;">Donald</div><div align="left" style="display: inline-block; width: 40px;"><div style="display: inline; color: rgb(255,000,000)">70</div></div><div align="left" style="display: inline-block; width: 100px;">New York</div> |
|
|
674
|
+<br><br> |
|
|
675
|
+Notice that thanks to the counter <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">col</span>, we can perform a different treatment on each column. |
|
|
676
|
+Also remark that the first line of |
|
|
677
|
+the table has a number in front of it because we added a linefeed in front of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$mycsvtable</div></strong></span> within the second operand of |
|
|
678
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong></span>. |
|
|
679
|
+<br><br> |
|
|
680
|
+Now, we want to get this same text in the form of a list of lines, where each line is itself a list of values. |
|
|
681
|
+To this end, we define another <em>colorizer</em>. |
|
|
682
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong>(table) |
|
|
683
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong>(line) |
|
|
684
|
+ <div style="display: inline; color: rgb(000,100,000)">$// without the line below, the commas would appear on the page</div> |
|
|
685
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(parsecsv)(#,)() |
|
|
686
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(parsecsv)(#n)(<strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong>(table)(<strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong>(line))<strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong>(line)) |
|
|
687
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(parsecsv)([^#n#,]+)(<strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong>(line)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
688
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(parsecsv) |
|
|
689
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(parsecsv)(<strong><div style="display: inline; color: rgb(255,000,000)">$mycsvtable</div></strong> |
|
|
690
|
+)<br><br></pre> |
|
|
691
|
+ |
|
|
692
|
+ |
|
|
693
|
+ |
|
|
694
|
+ |
|
|
695
|
+ |
|
|
696
|
+ |
|
|
697
|
+ |
|
|
698
|
+ |
|
|
699
|
+ |
|
|
700
|
+Despite the fact that we wrote <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong></span>, this doesn't produce any output because |
|
|
701
|
+the regular expressions cover all cases and the values in the color |
|
|
702
|
+rules contain only marks which produce side effects but no output.<br><br> |
|
|
703
|
+ |
|
|
704
|
+So, we expect that the accumulator <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">table</span> contains our list of lists. |
|
|
705
|
+To check that, we define: |
|
|
706
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(putbox)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$_azure</div></strong>)(<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">75</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) ) |
|
|
707
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(putpar)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(putbox)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong>)<br><br></pre> |
|
|
708
|
+ |
|
|
709
|
+ |
|
|
710
|
+ |
|
|
711
|
+ |
|
|
712
|
+and write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(putpar)(<strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong>(table))</span>, which produces |
|
|
713
|
+<br><br> |
|
|
714
|
+<div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Ford</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Max</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">32</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">New York</div></div> <br><div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Jackson</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Niel</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">64</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Los Angeles</div></div> <br><div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Kennedy</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Justin</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">25</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">New York</div></div> <br><div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Obama</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Barack</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">55</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Washington</div></div> <br><div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Smith</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">John</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">24</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Baltimore</div></div> <br><div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Trump</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Donald</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">70</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">New York</div></div> <br> |
|
|
715
|
+<br> |
|
|
716
|
+and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(putpar)(<strong><div style="display: inline; color: rgb(255,000,000)">$transpose</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong>(table)))</span>, which produces |
|
|
717
|
+<br><br> |
|
|
718
|
+<div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Ford</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Jackson</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Kennedy</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Obama</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Smith</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Trump</div></div> <br><div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Max</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Niel</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Justin</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Barack</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">John</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Donald</div></div> <br><div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">32</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">64</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">25</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">55</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">24</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">70</div></div> <br><div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">New York</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Los Angeles</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">New York</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Washington</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">Baltimore</div></div> <div style="display: inline; background-color: rgb(190,210,210); "><div align="left" style="display: inline-block; width: 75px;">New York</div></div> <br> |
|
|
719
|
+<br> |
|
|
720
|
+This last manipulation makes even more obvious the fact that we actually got our table in the form of |
|
|
721
|
+a list of lists. |
|
|
722
|
+ |
|
|
723
|
+ |
|
|
724
|
+ |
|
|
725
|
+<br><br> |
|
|
726
|
+<a id="tools"></a><br><big><big><strong>5. Other tools</strong></big></big><br><br> |
|
|
727
|
+ |
|
|
728
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> is <em>not a programming language</em>. It is a <em>document formatting language</em>. Nevertheless, it provides some |
|
|
729
|
+programming capabilities, but only those which are (to our opinion) required for the needs of the layout of the |
|
|
730
|
+document. Of course, this set of tools could be enlarged in the future.<br><br> |
|
|
731
|
+ |
|
|
732
|
+<a id="arithmetics"></a><br><big><strong>5.1. Elementary arithmetics</strong></big><br><br> |
|
|
733
|
+ |
|
|
734
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> is able to perform some elementary arithmetic operations on numbers (which are all relative integers). These |
|
|
735
|
+operations are: |
|
|
736
|
+<span><ul> |
|
|
737
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$add</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div>)</span></div> addition of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div> |
|
|
738
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$minus</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div>)</span></div> substraction of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div> from <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div> |
|
|
739
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$opp</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div>)</span></div> opposite of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div> |
|
|
740
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$mul</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div>)</span></div> multiplication of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div> by <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div> |
|
|
741
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$quotient</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div>)</span></div> quotient of the euclidian division of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div> by <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div> |
|
|
742
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$remainder</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div>)</span></div> remainder of the euclidian division of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><m></span></strong></div> by <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div> |
|
|
743
|
+</ul></span> |
|
|
744
|
+In case of a division by zero, an error message is generated.<br><br> |
|
|
745
|
+ |
|
|
746
|
+ |
|
|
747
|
+<a id="booleans"></a><br><big><strong>5.2. Booleans and control</strong></big><br><br> |
|
|
748
|
+ |
|
|
749
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> provides some rudimentary tools for better controling the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler. <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> recognizes the marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$true</div></strong></span> and |
|
|
750
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$false</div></strong></span> as <em>truth values</em> (aka. <em>booleans</em>). Other marks also produce booleans, such as |
|
|
751
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$equals</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><expr 1></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><expr 2></span></strong></div>)</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$defined</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><macro name></span></strong></div>)</span>.<br><br> |
|
|
752
|
+ |
|
|
753
|
+These truth values can be used as <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><test></span></strong></div> in:<br><br> |
|
|
754
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><test></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if true></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if false></span></strong></div>)</span></td></tr></table></center><br> |
|
|
755
|
+The value of the above mark is <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if true></span></strong></div> if <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><test></span></strong></div> is true and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if false></span></strong></div> otherwise, and of course |
|
|
756
|
+only one of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if true></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if false></span></strong></div> is evaluated.<br><br> |
|
|
757
|
+ |
|
|
758
|
+Notice that some logical operators can be defined: |
|
|
759
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(and) (<div style="display: inline; color: rgb(160,082,045)">2</div>) (<strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)(<div style="display: inline; color: rgb(255,000,255)">$2</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$false</div></strong>)) |
|
|
760
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(or) (<div style="display: inline; color: rgb(160,082,045)">2</div>) (<strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$true</div></strong>)(<div style="display: inline; color: rgb(255,000,255)">$2</div>)) |
|
|
761
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(neg) (<div style="display: inline; color: rgb(160,082,045)">1</div>) (<strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$false</div></strong>)(<strong><div style="display: inline; color: rgb(255,000,000)">$true</div></strong>)) |
|
|
762
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(implies) (<div style="display: inline; color: rgb(160,082,045)">2</div>) (<strong><div style="display: inline; color: rgb(255,000,000)">$or</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$neg</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>))(<div style="display: inline; color: rgb(255,000,255)">$2</div>))<br><br></pre> |
|
|
763
|
+ |
|
|
764
|
+ |
|
|
765
|
+ |
|
|
766
|
+<a id="counters"></a><br><big><strong>5.3. Counters</strong></big><br><br> |
|
|
767
|
+ |
|
|
768
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> has a notion of <em>counter</em>. You can create a counter with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><init></span></strong></div>)</span>, where |
|
|
769
|
+<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> is the name of the new counter, and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><init></span></strong></div> its initial value (which must be a positive, zero or |
|
|
770
|
+negative integer).<br><br> |
|
|
771
|
+ |
|
|
772
|
+You can get the value of a counter with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span> (giving a character string representing |
|
|
773
|
+the value in decimal notation, possibly prefixed by a minus sign). |
|
|
774
|
+You can modify the value of a counter with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$setcounter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div>)</span> and |
|
|
775
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$addtocounter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div>)</span>.<br><br> |
|
|
776
|
+ |
|
|
777
|
+You can destroy a counter with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$popcounter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span>.<br><br> |
|
|
778
|
+ |
|
|
779
|
+Actually, for each counter name, <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> manages a stack of counters. Consequently, if you create a new counter with the |
|
|
780
|
+same name as an already existing counter, the first counter is not destroyed and |
|
|
781
|
+becomes visible again when the second counter is destroyed.<br><br> |
|
|
782
|
+ |
|
|
783
|
+As an exemple, consider the following: |
|
|
784
|
+ |
|
|
785
|
+ |
|
|
786
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong>(n)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
787
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(ga)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$addtocounter</div></strong>(n)(<div style="display: inline; color: rgb(160,082,045)">1</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(n))<br><br></pre> |
|
|
788
|
+ |
|
|
789
|
+ |
|
|
790
|
+ |
|
|
791
|
+If we write: <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong> <strong><div style="display: inline; color: rgb(255,000,000)">$ga</div></strong></span>, we get:<br><br> |
|
|
792
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td>1 2 3 4 5 6 7 8 9 10 11 12 13</td></tr></table></center> |
|
|
793
|
+Continuing that way, we can write: |
|
|
794
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong>(n)(<div style="display: inline; color: rgb(160,082,045)">25</div>) |
|
|
795
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(n) |
|
|
796
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$popcounter</div></strong>(n) |
|
|
797
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(n)<br><br></pre> |
|
|
798
|
+and we get: |
|
|
799
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td> |
|
|
800
|
+ |
|
|
801
|
+25 |
|
|
802
|
+ |
|
|
803
|
+13</td></tr></table></center> |
|
|
804
|
+(as expected).<br><br> |
|
|
805
|
+ |
|
|
806
|
+ |
|
|
807
|
+<a id="lists"></a><br><big><strong>5.4. Lists</strong></big><br><br> |
|
|
808
|
+ |
|
|
809
|
+<strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> has a notion of <em>list</em>. In order to create a list (say with three elements <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">a</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">b</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">c</span>), |
|
|
810
|
+you can write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">[a,b,c]</span>. If you write this outside any <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> operand, you get this: |
|
|
811
|
+<br><br> |
|
|
812
|
+[a,b,c] |
|
|
813
|
+<br><br> |
|
|
814
|
+In other words, the square brackets and the comma are just seen as ordinary (neutral) characters (and there is no list |
|
|
815
|
+at all in this case). On the contrary, if you write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>([a,b,c])</span>, you get this: |
|
|
816
|
+<br><br> |
|
|
817
|
+<div style="display: inline; color: rgb(255,000,000)">abc</div> |
|
|
818
|
+<br><br> |
|
|
819
|
+This is first of all because the square brackets and the comma are recognized as special characters within an operand |
|
|
820
|
+(so that we now have an actual list), and because the rendering of a list consists in rendering its element one after the |
|
|
821
|
+other without any separator between them. Nevertheless, if we want to render the above list in red with the brackets |
|
|
822
|
+and the commas, it is enough to write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$[</div></strong>a<strong><div style="display: inline; color: rgb(255,000,000)">$,</div></strong>b<strong><div style="display: inline; color: rgb(255,000,000)">$,</div></strong>c<strong><div style="display: inline; color: rgb(255,000,000)">$]</div></strong>)</span>: |
|
|
823
|
+<br><br> |
|
|
824
|
+<div style="display: inline; color: rgb(255,000,000)">[a,b,c]</div> |
|
|
825
|
+<br><br> |
|
|
826
|
+ |
|
|
827
|
+The square brackets and the comma, everywhere they are recognized as special characters <em>eat</em> the spaces on both |
|
|
828
|
+sides. This means that it is equivalent to write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>([a,b,c])</span> and to write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>( [ a, b , c |
|
|
829
|
+] )</span>. However, be careful because an expression such as <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>([a,b,c])</span> is <em>not</em> a list and triggers |
|
|
830
|
+an error if written at a place where a list is required.<br><br> |
|
|
831
|
+ |
|
|
832
|
+List are useful because they can be manipulated by several primitive marks, such as: |
|
|
833
|
+<span><ul> |
|
|
834
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><a rel="tag" href="#reverse">$reverse</a>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span> |
|
|
835
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><a rel="tag" href="#sort">$sort</a>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span> |
|
|
836
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><a rel="tag" href="#length">$length</a>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span> |
|
|
837
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><a rel="tag" href="#sublist">$sublist</a>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><start></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><end></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span> |
|
|
838
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><a rel="tag" href="#apply">$apply</a>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><mark name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span> |
|
|
839
|
+ <li> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><a rel="tag" href="#transpose">$transpose</a>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list of lists></span></strong></div>)</span> |
|
|
840
|
+</ul></span> |
|
|
841
|
+How these primitives marks operate is explained in the <a rel="tag" href="#catalog">catalog</a>.<br><br> |
|
|
842
|
+ |
|
|
843
|
+There are circumstances where we want the square brackets and the comma to be considered as ordinary (neutral) |
|
|
844
|
+characters. For example, it should be the case for the second operand of |
|
|
845
|
+<a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><color></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><computer code></span></strong></div>)</span></a>, and also in some operands of some other primitives. |
|
|
846
|
+To simplify the matter and to offer the maximal number of possibilities, primitives such as <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong></span> don't care |
|
|
847
|
+about that. This is why we propose the primitive <a rel="tag" href="#nolist"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$nolist</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></a> which inhibits the |
|
|
848
|
+recognition of the squares brackets and the comma within <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>. Hence, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong></span> should be used as follows: |
|
|
849
|
+<br><br> |
|
|
850
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><color></span></strong></div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$nolist</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><computer code></span></strong></div>))</span></td></tr></table></center> |
|
|
851
|
+<br> |
|
|
852
|
+and you can define a macro for handling this.<br><br> |
|
|
853
|
+ |
|
|
854
|
+As an example, consider the following list of words: |
|
|
855
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(cities)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
856
|
+ ([New York,Paris,Berlin,Moscow,Casablanca,Cairo,Athens,Rio de Janeiro])<br><br></pre> |
|
|
857
|
+ |
|
|
858
|
+ |
|
|
859
|
+We can write: |
|
|
860
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong>(n)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
861
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(number)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$addtocounter</div></strong>(n)(<div style="display: inline; color: rgb(160,082,045)">1</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">20</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(n).)<div style="display: inline; color: rgb(255,000,255)">$1</div><strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong>) |
|
|
862
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(a)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$alphabetic</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
863
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$center</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(number)(<strong><div style="display: inline; color: rgb(255,000,000)">$sort</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(a)(<strong><div style="display: inline; color: rgb(255,000,000)">$cities</div></strong>))))<br><br></pre> |
|
|
864
|
+which gives this: |
|
|
865
|
+ |
|
|
866
|
+ |
|
|
867
|
+ |
|
|
868
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><div align="left" style="display: inline-block; width: 20px;">1.</div>Athens<br><div align="left" style="display: inline-block; width: 20px;">2.</div>Berlin<br><div align="left" style="display: inline-block; width: 20px;">3.</div>Cairo<br><div align="left" style="display: inline-block; width: 20px;">4.</div>Casablanca<br><div align="left" style="display: inline-block; width: 20px;">5.</div>Moscow<br><div align="left" style="display: inline-block; width: 20px;">6.</div>New York<br><div align="left" style="display: inline-block; width: 20px;">7.</div>Paris<br><div align="left" style="display: inline-block; width: 20px;">8.</div>Rio de Janeiro<br></td></tr></table></center> |
|
|
869
|
+ |
|
|
870
|
+<br><br> |
|
|
871
|
+ |
|
|
872
|
+ |
|
|
873
|
+<a id="tips"></a><br><big><big><strong>6. Tips and tricks</strong></big></big><br><br> |
|
|
874
|
+ |
|
|
875
|
+If your text needs to display some computer code, it can be the case (depending on the programming language) |
|
|
876
|
+that this code uses dollar characters. This is the case of Anubis for example, since dollars are used by |
|
|
877
|
+type parameters. These dollars can make a problem since the dollar is also the escape character of <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong>.<br><br> |
|
|
878
|
+ |
|
|
879
|
+You can of course double the dollars in the computer text examples, but there are situations where we don't want to |
|
|
880
|
+do this, or just cannot do this. This is the case for example in the Anubis library, since some files are at the |
|
|
881
|
+same time <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> files (compilable by <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong>), and Anubis file (compilable by <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">anubis</span>). In this case, we cannot |
|
|
882
|
+change anything to the text, and in particular, we cannot double the dollars. <br><br> |
|
|
883
|
+ |
|
|
884
|
+A solution, assuming for example that there are two type parameters <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$T</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$U</div></strong></span> in the Anubis text, is to |
|
|
885
|
+define two macros: |
|
|
886
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(T)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$$</div></strong>T) |
|
|
887
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(U)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$$</div></strong>U)<br><br></pre> |
|
|
888
|
+so that the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler will not be disturbed by these type parameters, which is rendered correctly. |
|
|
889
|
+Since this doesn't change anything in the |
|
|
890
|
+Anubis text itself (the above <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span> should be outside any Anubis paragraph), this doesn't change anything from the point |
|
|
891
|
+of view of the Anubis compiler. This trick can of course be applied to other programming languages.<br><br> |
|
|
892
|
+ |
|
|
893
|
+ |
|
|
894
|
+<a id="commonerrors"></a><br><big><strong>6.1. Common errors</strong></big><br><br> |
|
|
895
|
+ |
|
|
896
|
+Below are most of the errors the author made himself during the writting of this tutorial. |
|
|
897
|
+<span><ul> |
|
|
898
|
+ |
|
|
899
|
+ <li> Thinking that <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$_red</div></strong>)(<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">100</div>)())</span> produces a red rectangle of the given width |
|
|
900
|
+ (with no text at all into it). |
|
|
901
|
+ This actually produces a white rectangle. In order |
|
|
902
|
+ to get this red rectangle, you need to write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$_red</div></strong>)(<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">100</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$sp</div></strong>))</span> (recall that <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sp</div></strong></span> is |
|
|
903
|
+ the so-called <em>non breakable space</em>).<br><br> |
|
|
904
|
+ |
|
|
905
|
+ <li> Using <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$blahblah</div></strong></span> instead of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$$</div></strong>blahblah</span>, i.e. forgetting to double the dollar when we want to render a dollar |
|
|
906
|
+ character (or the contrary).<br><br> |
|
|
907
|
+ |
|
|
908
|
+ <li> Writing <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">#$//.*</span> instead of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">#$#/#/.*</span> as a regular expression in order to colorize <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> line comments. |
|
|
909
|
+ Of course, the first form <em>is seen</em> as the beginning of a line comment, and the final result is quite surprising. |
|
|
910
|
+</ul></span> |
|
|
911
|
+ |
|
|
912
|
+ |
|
|
913
|
+<a id="toolsbasis"></a><br><big><big><strong>7. Tools available in <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div></strong></big></big><br><br> |
|
|
914
|
+ |
|
|
915
|
+This <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> file provides some tools of common usage. In order to use these tools, you must write |
|
|
916
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong>(basis.maml)</span></td></tr></table></center><br> |
|
|
917
|
+after the first <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span>, but some tools require that you define a macro before this <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong></span>.<br><br> |
|
|
918
|
+ |
|
|
919
|
+Some of the macros defined in this file can be redefined easily from within your source text. If this is not enough for |
|
|
920
|
+your needs, you still have the possibility to use a customized copy of <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div>.<br><br> |
|
|
921
|
+ |
|
|
922
|
+ |
|
|
923
|
+<a id="colors"></a><br><big><strong>7.1. Colors</strong></big><br><br> |
|
|
924
|
+ |
|
|
925
|
+The file <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div> provides a small selection of colors in the form of macros taking zero operand. These macros are to be used |
|
|
926
|
+within the first operand of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong></span>, i.e. at a place where a color value in the |
|
|
927
|
+form <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">r,g,b</span> is expected.<br><br> |
|
|
928
|
+ |
|
|
929
|
+ |
|
|
930
|
+ |
|
|
931
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_azure</div><div style="display: inline; background-color: rgb(190,210,210); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
932
|
+ |
|
|
933
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_black</div><div style="display: inline; background-color: rgb(000,000,000); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
934
|
+ |
|
|
935
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_blue</div><div style="display: inline; background-color: rgb(000,000,255); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
936
|
+<br> |
|
|
937
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_caramel</div><div style="display: inline; background-color: rgb(210,105,030); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
938
|
+ |
|
|
939
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_chocolate</div><div style="display: inline; background-color: rgb(105,055,020); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
940
|
+ |
|
|
941
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_cyan</div><div style="display: inline; background-color: rgb(000,255,255); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
942
|
+<br> |
|
|
943
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_darkgreen</div><div style="display: inline; background-color: rgb(000,100,000); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
944
|
+ |
|
|
945
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_gold</div><div style="display: inline; background-color: rgb(255,195,000); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
946
|
+ |
|
|
947
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_green</div><div style="display: inline; background-color: rgb(000,255,000); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
948
|
+<br> |
|
|
949
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_grey</div><div style="display: inline; background-color: rgb(190,190,190); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
950
|
+ |
|
|
951
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_ivory</div><div style="display: inline; background-color: rgb(230,230,210); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
952
|
+ |
|
|
953
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_lavender</div><div style="display: inline; background-color: rgb(200,200,220); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
954
|
+<br> |
|
|
955
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_magenta</div><div style="display: inline; background-color: rgb(255,000,255); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
956
|
+ |
|
|
957
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_navy</div><div style="display: inline; background-color: rgb(000,000,128); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
958
|
+ |
|
|
959
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_orange</div><div style="display: inline; background-color: rgb(255,165,000); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
960
|
+<br> |
|
|
961
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_pink</div><div style="display: inline; background-color: rgb(255,182,193); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
962
|
+ |
|
|
963
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_purple</div><div style="display: inline; background-color: rgb(160,032,240); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
964
|
+ |
|
|
965
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_red</div><div style="display: inline; background-color: rgb(255,000,000); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
966
|
+<br> |
|
|
967
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_darkred</div><div style="display: inline; background-color: rgb(110,000,000); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
968
|
+ |
|
|
969
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_salmon</div><div style="display: inline; background-color: rgb(233,150,122); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
970
|
+ |
|
|
971
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_sienna</div><div style="display: inline; background-color: rgb(160,082,045); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
972
|
+<br> |
|
|
973
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_turquoise</div><div style="display: inline; background-color: rgb(064,224,208); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
974
|
+ |
|
|
975
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_white</div><div style="display: inline; background-color: rgb(255,255,255); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
976
|
+ |
|
|
977
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 100px;">$_yellow</div><div style="display: inline; background-color: rgb(255,255,000); "> </div><div align="left" style="display: inline-block; width: 20px;"></div> |
|
|
978
|
+<br> |
|
|
979
|
+ |
|
|
980
|
+ |
|
|
981
|
+<br><br> |
|
|
982
|
+The file also provide macros with the same name, but without the leading underscore, |
|
|
983
|
+taking one operand for directly colorizing texts. For example <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(...)</span> is |
|
|
984
|
+equivalent to <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$_red</div></strong>)(...)</span>.<br><br> |
|
|
985
|
+ |
|
|
986
|
+<a id="stylearticle"></a><br><big><strong>7.2. The style <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">article</span></strong></big><br><br> |
|
|
987
|
+ |
|
|
988
|
+This <em>style</em> provides definitions for the marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$section</div></strong></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$subsection</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$subsubsection</div></strong></span> (which |
|
|
989
|
+are not primitive marks), and also defines a mark <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tableofcontents</div></strong></span>.<br><br> |
|
|
990
|
+ |
|
|
991
|
+<a id="_"></a><br><strong>7.2.1. How to use it</strong><br> |
|
|
992
|
+ |
|
|
993
|
+In order to use this style, you must write:<br><br> |
|
|
994
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(article)(<div style="display: inline; color: rgb(160,082,045)">0</div>)()</span></td></tr></table></center><br> |
|
|
995
|
+<em>before</em> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong>(basis.maml)</span>, because the style is conditionned by a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$defined</div></strong>(article))...</span> |
|
|
996
|
+within <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div>.<br><br> |
|
|
997
|
+ |
|
|
998
|
+The marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$section</div></strong></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$subsection</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$subsubsection</div></strong></span> take two operands. The first one must be a |
|
|
999
|
+symbol |
|
|
1000
|
+which is the symbolic name you want to give to the section (it is used |
|
|
1001
|
+for generating internal links, but you can also refer to the section with a <a rel="tag" href="#ref"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ref</div></strong>(...)(...)</span></a>). |
|
|
1002
|
+The second one is the title of the section.<br><br> |
|
|
1003
|
+ |
|
|
1004
|
+The mark |
|
|
1005
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tableofcontents</div></strong></span> produces a table of contents and can be written anywhere because it contains a |
|
|
1006
|
+<a rel="tag" href="#postpone"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$postpone</div></strong></span></a>, |
|
|
1007
|
+so that it provides a complete table of contents regardless of its position in your source text.<br><br> |
|
|
1008
|
+ |
|
|
1009
|
+<a id="_"></a><br><strong>7.2.2. Customizing <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">article</span></strong><br> |
|
|
1010
|
+ |
|
|
1011
|
+The lines of the table of contents are displayed by the marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tocsec</div></strong></span>, |
|
|
1012
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tocsubsec</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tocsubsubsec</div></strong></span>. If you are not satisfied with the layout provided by these marks, you can |
|
|
1013
|
+define your own versions, provided that you write your definitions <em>before</em> <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong>(basis.maml)</span>. These marks take only one |
|
|
1014
|
+operand which is the line to be displayed. For example, you can define:<br> |
|
|
1015
|
+<br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(tocsec)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong><strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong>)</span></td></tr></table></center><br> |
|
|
1016
|
+This will replace the default definition provided by <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div>. This may be useful for example to redefine |
|
|
1017
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tocsubsubsec</div></strong></span> if you have |
|
|
1018
|
+subsubsections in your text and don't want them to appear in the table of contents.<br><br> |
|
|
1019
|
+ |
|
|
1020
|
+The same is true for the marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$seclayout</div></strong></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$subseclayout</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$subsubseclayout</div></strong></span>, which define the |
|
|
1021
|
+layout of the section titles themselves. These marks take one operand which is the title itself.<br><br> |
|
|
1022
|
+ |
|
|
1023
|
+<a id="book"></a><br><big><strong>7.3. The style <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">book</span></strong></big><br><br> |
|
|
1024
|
+ |
|
|
1025
|
+This style is the same as article, except that it also has a notion of chapter. Hence, it also defines the mark |
|
|
1026
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$chapter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><symbolic name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><title></span></strong></div>)</span>, and you can redefine the marks |
|
|
1027
|
+<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tocchap</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><title></span></strong></div>)</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$chaplayout</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><title></span></strong></div>)</span>.<br><br> |
|
|
1028
|
+ |
|
|
1029
|
+ |
|
|
1030
|
+ |
|
|
1031
|
+ |
|
|
1032
|
+<a id="catalog"></a><br><big><big><strong>8. The catalog of <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks</strong></big></big><br><br> |
|
|
1033
|
+ |
|
|
1034
|
+Below is a description of the 60 primitive <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks.<br><br> |
|
|
1035
|
+<div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#accumulator"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#addtocounter"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$addtocounter</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#append"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#apply"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#begin"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#big"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#bold"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#box"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#center"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$center</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#colorize"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#colorizer"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#colorizercall"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#colorrule"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#content"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#countervalue"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#define"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#defined"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$defined</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#end"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#equals"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$equals</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#false"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$false</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#if"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#ifhtml"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ifhtml</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#ifpdf"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ifpdf</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#image"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$image</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#input"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#italic"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$italic</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#item"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#label"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$label</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#latex"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$latex</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#length"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$length</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#list"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$list</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#lpar"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#mailto"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$mailto</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#nolist"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$nolist</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#note"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$note</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#nth"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$nth</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#output"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$output</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#par"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#popcounter"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$popcounter</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#postpone"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$postpone</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#pushcounter"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#ref"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ref</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#reverse"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$reverse</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#rgb"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#rpar"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rpar</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#setcounter"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$setcounter</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#sort"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sort</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#sp"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sp</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#sub"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sub</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#sublist"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sublist</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#sup"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sup</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#tbgc"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#thisfilepath"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$thisfilepath</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#tlink"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tlink</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#transpose"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$transpose</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#true"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$true</div></strong></span></a></div><br><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#tt"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tt</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#undefine"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$undefine</div></strong></span></a></div><div align="left" style="display: inline-block; width: 20px;"></div><div align="left" style="display: inline-block; width: 120px;"><a rel="tag" href="#verbatim"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong></span></a></div> |
|
|
1036
|
+ |
|
|
1037
|
+ |
|
|
1038
|
+ <a id="accumulator"></a><br><br><strong>8.1. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span></div></strong><br><br> |
|
|
1039
|
+ This mark creates a <em>variable</em> named <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> called an <em>accumulator</em>. |
|
|
1040
|
+ The content of an accumulator is always a list, and this list is empty when the accumulator is created. With the mark |
|
|
1041
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong></span>, you can add content to the accumulator. Each use of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong></span> adds an element to end of the list |
|
|
1042
|
+ contained in the accumulator. At any time, you can get the content of the accumulator with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong></span>.<br><br> |
|
|
1043
|
+ |
|
|
1044
|
+ An accumulator cannot be destroyed, but it can be reinitialized. Indeed, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span> empties the |
|
|
1045
|
+ accumulator if it already exists, and puts the empty list in it. Unlike counters and macros, there is no stack associated to an |
|
|
1046
|
+ accumulator name. For example: |
|
|
1047
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong>(acc) |
|
|
1048
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong>(acc)(A) |
|
|
1049
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong>(acc)(B) |
|
|
1050
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong>(acc) |
|
|
1051
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong> |
|
|
1052
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong>(acc) |
|
|
1053
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong>(acc)(C) |
|
|
1054
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong>(acc)<br><br></pre> |
|
|
1055
|
+ produces: |
|
|
1056
|
+ <br><br> |
|
|
1057
|
+ |
|
|
1058
|
+ |
|
|
1059
|
+ |
|
|
1060
|
+ AB |
|
|
1061
|
+ <br> |
|
|
1062
|
+ |
|
|
1063
|
+ |
|
|
1064
|
+ C |
|
|
1065
|
+ <br><br> |
|
|
1066
|
+ Accumulators can be used in conjunction with <a rel="tag" href="#postpone"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$postpone</div></strong></span></a> for constructing |
|
|
1067
|
+ tables of content and indexes. |
|
|
1068
|
+ See also <a rel="tag" href="#append"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong></span></a> and <a rel="tag" href="#content"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong></span></a>. |
|
|
1069
|
+ |
|
|
1070
|
+ <a id="addtocounter"></a><br><br><strong>8.2. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$addtocounter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div>)</span></div></strong><br><br> |
|
|
1071
|
+ This marks adds <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div> to the most recent instance of the counter whose name is <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>. |
|
|
1072
|
+ |
|
|
1073
|
+ <a id="append"></a><br><br><strong>8.3. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> |
|
|
1074
|
+ This mark appends <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> at the end of the content of the <a rel="tag" href="#accumulator">accumulator</a> <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>. More |
|
|
1075
|
+ precisely, since the content of an accumulator is a list, the new content of the accumulator is the list obtained |
|
|
1076
|
+ by adding <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> as the last element of this list. |
|
|
1077
|
+ See also <a rel="tag" href="#accumulator"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong></span></a> and <a rel="tag" href="#content"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong></span></a>. |
|
|
1078
|
+ |
|
|
1079
|
+ <a id="apply"></a><br><br><strong>8.4. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span></div></strong><br><br> |
|
|
1080
|
+ This mark applies the macro whose name is <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> to all elements of the list <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>. This creates a new list |
|
|
1081
|
+ of the same length. If <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div> is not a list, the result is the same as if it was a one element list.<br><br> |
|
|
1082
|
+ |
|
|
1083
|
+ Notice that the first operand is the name of the macro to applied, but <em>without the leading <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span></em>. In other words, this |
|
|
1084
|
+ operand is not the macro to apply but only its name. The corresponding macro must take just one operand. If not, an |
|
|
1085
|
+ error message is generated.<br><br> |
|
|
1086
|
+ |
|
|
1087
|
+ Furthermore, the macro to be applied must take a unique operand, and notice that <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> cannot be the name of |
|
|
1088
|
+ a primitive mark. It <em>must</em> be the name of a macro. Hence, if you want to apply a primitive mark, you must first |
|
|
1089
|
+ define an equivalent macro.<br><br> |
|
|
1090
|
+ |
|
|
1091
|
+ As an example, consider the following: |
|
|
1092
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(mylist)(<div style="display: inline; color: rgb(160,082,045)">0</div>)([a,b,c,d]) |
|
|
1093
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$mylist</div></strong><strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong> |
|
|
1094
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(a)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<<strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)>) |
|
|
1095
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(a)(<strong><div style="display: inline; color: rgb(255,000,000)">$mylist</div></strong>)<br><br></pre> |
|
|
1096
|
+which produces:<br><br> |
|
|
1097
|
+ |
|
|
1098
|
+ |
|
|
1099
|
+abcd<br> |
|
|
1100
|
+ |
|
|
1101
|
+<<div style="display: inline; color: rgb(255,000,000)">a</div>><<div style="display: inline; color: rgb(255,000,000)">b</div>><<div style="display: inline; color: rgb(255,000,000)">c</div>><<div style="display: inline; color: rgb(255,000,000)">d</div>> |
|
|
1102
|
+<br><br> |
|
|
1103
|
+ See also <a rel="tag" href="#box"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong></span></a> for a more sophisticated example. |
|
|
1104
|
+ |
|
|
1105
|
+ |
|
|
1106
|
+ <a id="begin"></a><br><br><strong>8.5. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span></div></strong><br><br> This mark is looked for by <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> before it parses anything (even within a file refered to by |
|
|
1107
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong></span>). When <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span> is found, <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> parses the text until it |
|
|
1108
|
+ encounters the mark <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span>. After this mark, <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> continues ignoring everything until the next <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span>, |
|
|
1109
|
+ etc... <br><br> |
|
|
1110
|
+ |
|
|
1111
|
+ Notice that this mecanism can also be used for inserting a comment: |
|
|
1112
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong> |
|
|
1113
|
+ ... your comment ... |
|
|
1114
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong><br><br></pre> |
|
|
1115
|
+ |
|
|
1116
|
+ <a id="big"></a><br><br><strong>8.6. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> Prints its operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> bigger. This mark can be nested. For example, |
|
|
1117
|
+ <span><ul> |
|
|
1118
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(text)</span></div> produces <big>text</big> |
|
|
1119
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(text))</span></div> produces <big><big>text</big></big> |
|
|
1120
|
+ <li> <div align="left" style="display: inline-block; width: 200px;"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(text)))</span></div> produces <big><big><big>text</big></big></big> |
|
|
1121
|
+ </ul></span> |
|
|
1122
|
+ |
|
|
1123
|
+ |
|
|
1124
|
+ <a id="bold"></a><br><br><strong>8.7. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> The operand is rendered in <strong>bold</strong>. |
|
|
1125
|
+ |
|
|
1126
|
+ <a id="box"></a><br><br><strong>8.8. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><width></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark puts <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> into an invisible box of width <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><width></span></strong></div>. The text is left aligned |
|
|
1127
|
+ within the box. This mark can be used for simulating tabulators. For example, |
|
|
1128
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(tableline)(<div style="display: inline; color: rgb(160,082,045)">4</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">50</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>) <strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">50</div>)(<div style="display: inline; color: rgb(255,000,255)">$2</div>) <strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">30</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$3</div>)) <div style="display: inline; color: rgb(255,000,255)">$4</div> <strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong>) |
|
|
1129
|
+ |
|
|
1130
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$tableline</div></strong>(Smith)(John)(<div style="display: inline; color: rgb(160,082,045)">24</div>)(Baltimore) |
|
|
1131
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$tableline</div></strong>(Ford) (Max) (<div style="display: inline; color: rgb(160,082,045)">32</div>)(New York)<br><br></pre> |
|
|
1132
|
+ produces:<br><br> |
|
|
1133
|
+ |
|
|
1134
|
+ <div align="left" style="display: inline-block; width: 50px;">Smith</div> <div align="left" style="display: inline-block; width: 50px;">John</div> <div align="left" style="display: inline-block; width: 30px;"><div style="display: inline; color: rgb(255,000,000)">24</div></div> Baltimore <br> |
|
|
1135
|
+ <div align="left" style="display: inline-block; width: 50px;">Ford</div> <div align="left" style="display: inline-block; width: 50px;">Max</div> <div align="left" style="display: inline-block; width: 30px;"><div style="display: inline; color: rgb(255,000,000)">32</div></div> New York <br> |
|
|
1136
|
+ <br> |
|
|
1137
|
+ |
|
|
1138
|
+ <a id="colortableexample"></a> |
|
|
1139
|
+ As an example, here is something more sophisticated. We construct a table similar to the table above, |
|
|
1140
|
+ but we want it to be automatically sorted by the last names (first column) and to be in pajama stripes, |
|
|
1141
|
+ in other words, so that odd numbered lines |
|
|
1142
|
+ are shown on a different background color than even numbered lines. It is clear that the background color |
|
|
1143
|
+ cannot be decided before the list is sorted, so that, after the list is sorted, we have to apply a macro |
|
|
1144
|
+ to each element of the list. This is why we need to use the primitive mark <a rel="tag" href="#apply"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong></span></a>. |
|
|
1145
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br> <div style="display: inline; color: rgb(000,100,000)">$// we first create a counter that we use as a flag </div> |
|
|
1146
|
+ <div style="display: inline; color: rgb(000,100,000)">$// (taking the values 0 and 1 only)</div> |
|
|
1147
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong>(flag)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
1148
|
+ <div style="display: inline; color: rgb(000,100,000)">$// we define a color depending on the value of the flag </div> |
|
|
1149
|
+ <div style="display: inline; color: rgb(000,100,000)">$// and flipflopping the flag at each use</div> |
|
|
1150
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(linecolor)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
1151
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$equals</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(flag))) |
|
|
1152
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$setcounter</div></strong>(flag)(<div style="display: inline; color: rgb(160,082,045)">1</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$_lavender</div></strong>) |
|
|
1153
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$setcounter</div></strong>(flag)(<div style="display: inline; color: rgb(160,082,045)">0</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$_ivory</div></strong>)) |
|
|
1154
|
+ <div style="display: inline; color: rgb(000,100,000)">$// define the layout of a line of the table, and put an '$alphabetic' in order</div> |
|
|
1155
|
+ <div style="display: inline; color: rgb(000,100,000)">$// to tell MAML how to sort lines</div> |
|
|
1156
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(tableline)(<div style="display: inline; color: rgb(160,082,045)">4</div>) |
|
|
1157
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">80</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$alphabetic</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>))<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">80</div>)(<div style="display: inline; color: rgb(255,000,255)">$2</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">50</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$3</div>))<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">80</div>)(<div style="display: inline; color: rgb(255,000,255)">$4</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong>) |
|
|
1158
|
+ <div style="display: inline; color: rgb(000,100,000)">$// define a macro for putting a backgroud color behind a line</div> |
|
|
1159
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(putbg)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$linecolor</div></strong>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
1160
|
+ <div style="display: inline; color: rgb(000,100,000)">$// sort the lines and apply this macro to each line</div> |
|
|
1161
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$center</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(putbg)(<strong><div style="display: inline; color: rgb(255,000,000)">$sort</div></strong>( |
|
|
1162
|
+[<strong><div style="display: inline; color: rgb(255,000,000)">$tableline</div></strong>(Smith)(John)(<div style="display: inline; color: rgb(160,082,045)">24</div>)(Baltimore), |
|
|
1163
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$tableline</div></strong>(Ford) (Max) (<div style="display: inline; color: rgb(160,082,045)">32</div>)(New York), |
|
|
1164
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$tableline</div></strong>(Jackson)(Niel)(<div style="display: inline; color: rgb(160,082,045)">64</div>)(Los Angeles), |
|
|
1165
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$tableline</div></strong>(Kennedy) (Justin) (<div style="display: inline; color: rgb(160,082,045)">25</div>)(New York), |
|
|
1166
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$tableline</div></strong>(Trump)(Donald)(<div style="display: inline; color: rgb(160,082,045)">70</div>)(New York), |
|
|
1167
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$tableline</div></strong>(Obama) (Barack)(<div style="display: inline; color: rgb(160,082,045)">55</div>)(Washington)] |
|
|
1168
|
+)))<br><br></pre> |
|
|
1169
|
+ |
|
|
1170
|
+ |
|
|
1171
|
+ |
|
|
1172
|
+ |
|
|
1173
|
+ |
|
|
1174
|
+ |
|
|
1175
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><div style="display: inline; background-color: rgb(200,200,220); "><div align="left" style="display: inline-block; width: 80px;">Ford</div><div align="left" style="display: inline-block; width: 80px;">Max</div><div align="left" style="display: inline-block; width: 50px;"><div style="display: inline; color: rgb(255,000,000)">32</div></div><div align="left" style="display: inline-block; width: 80px;">New York</div><br></div><div style="display: inline; background-color: rgb(230,230,210); "><div align="left" style="display: inline-block; width: 80px;">Jackson</div><div align="left" style="display: inline-block; width: 80px;">Niel</div><div align="left" style="display: inline-block; width: 50px;"><div style="display: inline; color: rgb(255,000,000)">64</div></div><div align="left" style="display: inline-block; width: 80px;">Los Angeles</div><br></div><div style="display: inline; background-color: rgb(200,200,220); "><div align="left" style="display: inline-block; width: 80px;">Kennedy</div><div align="left" style="display: inline-block; width: 80px;">Justin</div><div align="left" style="display: inline-block; width: 50px;"><div style="display: inline; color: rgb(255,000,000)">25</div></div><div align="left" style="display: inline-block; width: 80px;">New York</div><br></div><div style="display: inline; background-color: rgb(230,230,210); "><div align="left" style="display: inline-block; width: 80px;">Obama</div><div align="left" style="display: inline-block; width: 80px;">Barack</div><div align="left" style="display: inline-block; width: 50px;"><div style="display: inline; color: rgb(255,000,000)">55</div></div><div align="left" style="display: inline-block; width: 80px;">Washington</div><br></div><div style="display: inline; background-color: rgb(200,200,220); "><div align="left" style="display: inline-block; width: 80px;">Smith</div><div align="left" style="display: inline-block; width: 80px;">John</div><div align="left" style="display: inline-block; width: 50px;"><div style="display: inline; color: rgb(255,000,000)">24</div></div><div align="left" style="display: inline-block; width: 80px;">Baltimore</div><br></div><div style="display: inline; background-color: rgb(230,230,210); "><div align="left" style="display: inline-block; width: 80px;">Trump</div><div align="left" style="display: inline-block; width: 80px;">Donald</div><div align="left" style="display: inline-block; width: 50px;"><div style="display: inline; color: rgb(255,000,000)">70</div></div><div align="left" style="display: inline-block; width: 80px;">New York</div><br></div></td></tr></table></center> |
|
|
1176
|
+<br><br> |
|
|
1177
|
+The macro <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$pajamatable</div></strong></span> defined in <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div> realises such a table and accepts the data in the form of a |
|
|
1178
|
+list of lists. |
|
|
1179
|
+ |
|
|
1180
|
+ <a id="center"></a><br><br><strong>8.9. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$center</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark horizontally centers the <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> in the page. For example, |
|
|
1181
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$center</div></strong>(centered text)</span> produces:<br> |
|
|
1182
|
+ <br><center><table style="color: inherit; font-size: inherit;"><tr><td>centered text</td></tr></table></center><br> |
|
|
1183
|
+ |
|
|
1184
|
+ <a id="code"></a><br><br><strong>8.10. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><background color></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This marks is for writing computer code. |
|
|
1185
|
+ The <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> operand is formated using a fixed width |
|
|
1186
|
+ (typewriter) font, spaces and newlines are taken into account, so that the result has essentially the same layout as the |
|
|
1187
|
+ original. Nevertheless, <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks are allowed within <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>, but some of them, such as <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$list</div></strong></span>, |
|
|
1188
|
+ can produce incoherent results. For example, |
|
|
1189
|
+ <br> |
|
|
1190
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(T)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$$</div></strong>T) <div style="display: inline; color: rgb(000,100,000)">$// so that MAML is not troubled by $T</div> |
|
|
1191
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$_lavender</div></strong>)(<strong><div style="display: inline; color: rgb(255,000,000)">$nolist</div></strong>(<div style="display: inline; color: rgb(000,000,000)"> |
|
|
1192
|
+define Int |
|
|
1193
|
+ length |
|
|
1194
|
+ ( |
|
|
1195
|
+ List($T) l |
|
|
1196
|
+ ) = |
|
|
1197
|
+ if l is |
|
|
1198
|
+ { |
|
|
1199
|
+ [ ] then 0, // the list is empty |
|
|
1200
|
+ [h . t] then 1+length(t) |
|
|
1201
|
+ }.</div> |
|
|
1202
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$undefine</div></strong>(T)))<br><br></pre> |
|
|
1203
|
+ produces: |
|
|
1204
|
+ |
|
|
1205
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(200,200,220); width: 600px;">define Int |
|
|
1206
|
+ length |
|
|
1207
|
+ ( |
|
|
1208
|
+ List($T) l |
|
|
1209
|
+ ) = |
|
|
1210
|
+ if l is |
|
|
1211
|
+ { |
|
|
1212
|
+ [ ] then 0, // the list is empty |
|
|
1213
|
+ [h . t] then 1+length(t) |
|
|
1214
|
+ }.</pre> |
|
|
1215
|
+ |
|
|
1216
|
+ (You can also use a <a rel="tag" href="#colorize">colorizer</a> for colorizing the code.) |
|
|
1217
|
+ <br><br> |
|
|
1218
|
+ See also <a rel="tag" href="#tt"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tt</div></strong>(...)</span></a> and <a rel="tag" href="#verbatim"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong>(...)</span></a> |
|
|
1219
|
+ |
|
|
1220
|
+ <a id="colorize"></a><br><br><strong>8.11. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> See <a rel="tag" href="#colorize">Automatic colorization</a>. |
|
|
1221
|
+ <a id="colorizer"></a><br><br><strong>8.12. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizer</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span></div></strong><br><br> See <a rel="tag" href="#colorize">Automatic colorization</a>. |
|
|
1222
|
+ <a id="colorizercall"></a><br><br><strong>8.13. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorizercall</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><regexpr></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><regexpr></span></strong></div>)</span></div></strong><br><br> See <a rel="tag" href="#colorize">Automatic colorization</a>. |
|
|
1223
|
+ <a id="colorrule"></a><br><br><strong>8.14. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$colorrule</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><regexpr></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> See <a rel="tag" href="#colorize">Automatic colorization</a>. |
|
|
1224
|
+ |
|
|
1225
|
+ <a id="content"></a><br><br><strong>8.15. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span></div></strong><br><br> |
|
|
1226
|
+ The value of this mark is the content of the <a rel="tag" href="#accumulator">accumulator</a> <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>. Recall that this content |
|
|
1227
|
+ is a list. See also <a rel="tag" href="#accumulator"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong></span></a> and <a rel="tag" href="#append"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong></span></a>. |
|
|
1228
|
+ |
|
|
1229
|
+ <a id="countervalue"></a><br><br><strong>8.16. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span></div></strong><br><br> |
|
|
1230
|
+ This mark produces the value of the counter <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> in decimal notation. See <a rel="tag" href="#counters">Counters</a>. |
|
|
1231
|
+ |
|
|
1232
|
+ <a id="define"></a><br><br><strong>8.17. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><number of operands></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div>)</span></div></strong><br><br> |
|
|
1233
|
+ This mark let you define new marks (i.e. <em>macros</em>). It takes three operands. The first operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> |
|
|
1234
|
+ is the name of the new mark. If it is |
|
|
1235
|
+ already in use, the new definition masks the previous one until you use an <a rel="tag" href="#undefine"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$undefine</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span></a>. |
|
|
1236
|
+ The name must be made only of letters <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">A...Z</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">a...z</span>, decimal digits <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(160,082,045)">0</div>...<div style="display: inline; color: rgb(160,082,045)">9</div></span> and |
|
|
1237
|
+ the underscore character, and must |
|
|
1238
|
+ not begin by a digit. The second operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><number of operands></span></strong></div> is the number of operands your new mark will accept. |
|
|
1239
|
+ It must |
|
|
1240
|
+ be a positive or zero integer. The last operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div> is the value of the mark. This is a <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> text, and it can |
|
|
1241
|
+ contain marks of the form <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(255,000,255)">$1</div></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(255,000,255)">$2</div></span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(255,000,255)">$3</div></span>, ... (called <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> <em>variables</em>) which represent the operands |
|
|
1242
|
+ of the mark, and which will later be replaced by the actual operands when the mark is used in the text.<br><br> |
|
|
1243
|
+ |
|
|
1244
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span> doesn't allow to define recursive macros. Nevertheless, |
|
|
1245
|
+ see <a rel="tag" href="#undefine"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$undefine</div></strong></span></a> where more explanations are given on the behavior of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span>. |
|
|
1246
|
+ |
|
|
1247
|
+ |
|
|
1248
|
+ <a id="defined"></a><br><br><strong>8.18. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$defined</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span></div></strong><br><br> |
|
|
1249
|
+ This mark has a boolean value which is <em>true</em> if a macro is defined with name <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> and <em>false</em> |
|
|
1250
|
+ otherwise. |
|
|
1251
|
+ |
|
|
1252
|
+ <a id="end"></a><br><br><strong>8.19. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span></div></strong><br><br> This mark indicates that the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler should stop parsing until the next <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span> (or the end |
|
|
1253
|
+ of file). See <a rel="tag" href="#begin"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span></a>. |
|
|
1254
|
+ |
|
|
1255
|
+ <a id="equals"></a><br><br><strong>8.20. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$equals</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><expr 1></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><expr 2></span></strong></div>)</span></div></strong><br><br> |
|
|
1256
|
+ This mark has a boolean value which is <em>true</em> if <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><expr 1></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><expr 2></span></strong></div> are equal. By <em>equal</em>, we |
|
|
1257
|
+ mean identical after <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><expr 1></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><expr 2></span></strong></div> are computed. |
|
|
1258
|
+ |
|
|
1259
|
+ <a id="false"></a><br><br><strong>8.21. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$false</div></strong></span></div></strong><br><br> This mark represents the truth value <em>false</em>. |
|
|
1260
|
+ |
|
|
1261
|
+ <a id="if"></a><br><br><strong>8.22. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><test></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if true></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if false></span></strong></div>)</span></div></strong><br><br> |
|
|
1262
|
+ This mark represents <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if true></span></strong></div> if <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><test></span></strong></div> is true, and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if false></span></strong></div> otherwise. Only one of |
|
|
1263
|
+ <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if true></span></strong></div> and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><if false></span></strong></div> is evaluated. |
|
|
1264
|
+ |
|
|
1265
|
+ <a id="ifhtml"></a><br><br><strong>8.23. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ifhtml</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> The operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> is present in the HTML output, but not in the <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> nor in the PDF |
|
|
1266
|
+ output. |
|
|
1267
|
+ |
|
|
1268
|
+ <a id="ifpdf"></a><br><br><strong>8.24. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ifpdf</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> The operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> is present in the <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> and in the PDF |
|
|
1269
|
+ output, but not in the HTML output. |
|
|
1270
|
+ |
|
|
1271
|
+ <a id="image"></a><br><br><strong>8.25. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$image</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><width></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><file path></span></strong></div>)</span></div></strong><br><br> |
|
|
1272
|
+ This mark inserts an image in the text. The operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><width></span></strong></div> is the width the image will have |
|
|
1273
|
+ when displayed (in pixels in the case of HTML, and points in the case of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">), and <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><file path></span></strong></div> is the path of the file |
|
|
1274
|
+ containing the image. For example, |
|
|
1275
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$center</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$image</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$ifpdf</div></strong>(<div style="display: inline; color: rgb(160,082,045)">100</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$ifhtml</div></strong>(<div style="display: inline; color: rgb(160,082,045)">200</div>))(<strong><div style="display: inline; color: rgb(255,000,000)">$id</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$thisfilepath</div></strong>)/cows.jpg))<br><br></pre> |
|
|
1276
|
+ produces: |
|
|
1277
|
+ <br><center><table style="color: inherit; font-size: inherit;"><tr><td><img src="/home/alp/amoi/Anubis1/anubis_dev/library/doc_tools//cows.jpg" width="200"></td></tr></table></center><br> |
|
|
1278
|
+ |
|
|
1279
|
+ Remark the presence of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$id</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$thisfilepath</div></strong>)/</span> before the name of the file (which is here assumed to be |
|
|
1280
|
+ in the same directory as the maml file containing the above expression). The mark <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$thisfilepath</div></strong></span> gives |
|
|
1281
|
+ the absolute path of the file it is written into. Also, because we need to glue this path to the name of the image |
|
|
1282
|
+ file, we use the macro <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$id</div></strong></span> defined by <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(id)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)</span>. <br><br> |
|
|
1283
|
+ |
|
|
1284
|
+ At the same time, you remark that the width of the image doesn't need to be given lexically and |
|
|
1285
|
+ can be computed using <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks. |
|
|
1286
|
+ |
|
|
1287
|
+ |
|
|
1288
|
+ <a id="input"></a><br><br><strong>8.26. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><file name></span></strong></div>)</span></div></strong><br><br> |
|
|
1289
|
+ This mark let you insert the content of another <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> file. This other file could for example contain your own <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> |
|
|
1290
|
+ macros.<br><br> |
|
|
1291
|
+ Notice that the input file also needs to have a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span> and an <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$end</div></strong></span>. |
|
|
1292
|
+ In other words, when told to read another file by |
|
|
1293
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong></span> the <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> compiler ignores everything in this other file until it finds a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$begin</div></strong></span>. |
|
|
1294
|
+ <br><br> |
|
|
1295
|
+ This mark can be <strong><div style="display: inline; color: rgb(220,0,0)">unsafe</div></strong> on the web, except if you filter the operand. See the Anubis library documentation. |
|
|
1296
|
+ |
|
|
1297
|
+ |
|
|
1298
|
+ <a id="italic"></a><br><br><strong>8.27. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$italic</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> Prints its operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> in <em>italic</em>. |
|
|
1299
|
+ |
|
|
1300
|
+ <a id="item"></a><br><br><strong>8.28. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong></span></div></strong><br><br> Marks the begining of an <em>item</em> within a <a rel="tag" href="#list"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$list</div></strong></span></a> |
|
|
1301
|
+ |
|
|
1302
|
+ <a id="label"></a><br><br><strong>8.29. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$label</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><tag></span></strong></div>)</span></div></strong><br><br> This mark defines a <em>label</em> in the text, in other words, a position where to jump. |
|
|
1303
|
+ This is to be used in conjunction with <a rel="tag" href="#ref"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ref</div></strong></span></a>. |
|
|
1304
|
+ |
|
|
1305
|
+ <a id="latex"></a><br><br><strong>8.30. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$latex</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><formula></span></strong></div>)</span></div></strong><br><br> This mark allows to include math formulas to be formated by <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">. |
|
|
1306
|
+ For example, |
|
|
1307
|
+ <br><center><table style="color: inherit; font-size: inherit;"><tr><td><pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$latex</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$$</div></strong>\int_<div style="display: inline; color: rgb(160,082,045)">0</div>^\infty\frac{dx}{<div style="display: inline; color: rgb(160,082,045)">1</div>+x^<div style="display: inline; color: rgb(160,082,045)">2</div>}<strong><div style="display: inline; color: rgb(255,000,000)">$$</div></strong>)<br><br></pre></td></tr></table></center><br> |
|
|
1308
|
+ is rendered as: |
|
|
1309
|
+ <br><center><img src="png/fq22PnfBrYNx2fPr8NQyxy5tdO_A.png" width="72" height="36" style="vertical-align: -0px"></center><br> |
|
|
1310
|
+ This mark should not be used for big pieces of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> |
|
|
1311
|
+ text. It is mainly intended for math formulas, especially for HTML output where the formula is rendered |
|
|
1312
|
+ as a PNG image with transparent background. |
|
|
1313
|
+ <br><br> |
|
|
1314
|
+ You can use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$latex</div></strong></span> in the text. The result is correctly aligned with the text. For example,<br> |
|
|
1315
|
+ <br><center><table style="color: inherit; font-size: inherit;"><tr><td><pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br>the polynomial <strong><div style="display: inline; color: rgb(255,000,000)">$latex</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$X</div></strong>^<div style="display: inline; color: rgb(160,082,045)">2</div>+X+<div style="display: inline; color: rgb(160,082,045)">1</div><strong><div style="display: inline; color: rgb(255,000,000)">$)</div></strong> is of degree <div style="display: inline; color: rgb(160,082,045)">2</div><br><br></pre></td></tr></table></center><br> |
|
|
1316
|
+ is rendered as: |
|
|
1317
|
+ <br><center><table style="color: inherit; font-size: inherit;"><tr><td>the polynomial <img src="png/fyKx7xRolFAoYjXkjs4VdbNyRjAQ.png" width="77" height="16" style="vertical-align: -1px"> is of degree <div style="display: inline; color: rgb(160,082,045)">2</div></td></tr></table></center><br> |
|
|
1318
|
+ |
|
|
1319
|
+ Unfortunatly, <img src="png/foAbejNaCwiT0Jzk31KqV0gRWsOY.png" width="25" height="14" style="vertical-align: -3px"> is <strong><div style="display: inline; color: rgb(220,0,0)">unsafe</div></strong> as explained in <a href="http://cseweb.ucsd.edu/~hovav/dist/texhack.pdf">this document</a>. |
|
|
1320
|
+ Hence, you should forbid this mark for a web usage, except if you add a filter in order to reject all <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> |
|
|
1321
|
+ commands which don't belong to a given list of safe commands. This list doesn't need to be very long since the |
|
|
1322
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$latex</div></strong></span> mark is mainly used for inserting math formulas. See the Anubis library documentation to learn how |
|
|
1323
|
+ to install this list of safe <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> commands. |
|
|
1324
|
+ |
|
|
1325
|
+ <a id="length"></a><br><br><strong>8.31. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$length</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span></div></strong><br><br> |
|
|
1326
|
+ This mark returns the number of elements in its operand which is supposed to be a list. If the operand is not a list, |
|
|
1327
|
+ the result is <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(160,082,045)">1</div></span> if the operand is not empty (i.e. if it contains at least one character), and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(160,082,045)">0</div></span> if it is |
|
|
1328
|
+ empty. |
|
|
1329
|
+ |
|
|
1330
|
+ <a id="list"></a><br><br><strong>8.32. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$list</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><items></span></strong></div>)</span></div></strong><br><br> This mark allows to create a list. The operand <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><items></span></strong></div> must be a sequence of <em>items</em>, |
|
|
1331
|
+ i.e. texts which are all prefixed by the mark <a rel="tag" href="#item"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong></span></a>.<br><br> |
|
|
1332
|
+ Example: |
|
|
1333
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$list</div></strong>( |
|
|
1334
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong> Boys: <strong><div style="display: inline; color: rgb(255,000,000)">$list</div></strong>( <strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong> John <strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong> Max) |
|
|
1335
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong> Girls: <strong><div style="display: inline; color: rgb(255,000,000)">$list</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong> Julie <strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong> Geraldine <strong><div style="display: inline; color: rgb(255,000,000)">$item</div></strong> Sophia))<br><br></pre> |
|
|
1336
|
+ produces: |
|
|
1337
|
+ <span><ul> |
|
|
1338
|
+ <li> Boys: <span><ul> <li> John <li> Max</ul></span> |
|
|
1339
|
+ <li> Girls: <span><ul><li> Julie <li> Geraldine <li> Sophia</ul></span></ul></span> |
|
|
1340
|
+ |
|
|
1341
|
+ <a id="lpar"></a><br><br><strong>8.33. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong></span></div></strong><br><br> This mark inserts a left (opening) parenthese into the text. You must use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong></span> and/or |
|
|
1342
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rpar</div></strong></span> if you want to introduce unbalanced parentheses within an operand of a mark. |
|
|
1343
|
+ |
|
|
1344
|
+ <a id="mailto"></a><br><br><strong>8.34. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$mailto</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><address></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This marks, which appears as <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>, |
|
|
1345
|
+ creates a link which is supposed, in the HTML case, to open your mail agent in order to let you |
|
|
1346
|
+ send an email to the indicated <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><address></span></strong></div>. In the PDF case, the <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><address></span></strong></div> is just indicated between parentheses |
|
|
1347
|
+ beside <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>. |
|
|
1348
|
+ For example,<br> |
|
|
1349
|
+ <br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$blue</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$mailto</div></strong>(XZ<div style="display: inline; color: rgb(160,082,045)">32</div>@planet.mars)(the martian))</span></td></tr></table></center><br> produces: |
|
|
1350
|
+ <div style="display: inline; color: rgb(000,000,255)"><a href="mailto:XZ32@planet.mars">the martian</a></div> (you can try it). |
|
|
1351
|
+ |
|
|
1352
|
+ <a id="nolist"></a><br><br><strong>8.35. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$nolist</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> |
|
|
1353
|
+ This mark inhibits the recognition of the square brackets and the comma as list delimitors within <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>. See |
|
|
1354
|
+ <a rel="tag" href="#lists">Lists</a>. |
|
|
1355
|
+ |
|
|
1356
|
+ <a id="note"></a><br><br><strong>8.36. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$note</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark produces a footnote containing <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>. |
|
|
1357
|
+ In the case of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">/PDF this is a usual |
|
|
1358
|
+ footnote. In the case of HTML, this is a popup which appears at the bottom of the browser's window when the mouse |
|
|
1359
|
+ passes over this indication : <div class="dropdown"><span>(<sup>note</sup>)</span> |
|
|
1360
|
+ <div class="drp-content" style="font-size:10px; width:600-100; padding: 6px 6px 6px 6px;">Here is the note !</div></div>. Try it ! |
|
|
1361
|
+ |
|
|
1362
|
+ <a id="nth"></a><br><br><strong>8.37. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$nth</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span></div></strong><br><br> |
|
|
1363
|
+ This mark extracts the <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><n></span></strong></div><sup>th</sup> element of the list <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>. It generates an error if this element doesn't |
|
|
1364
|
+ exist. Numbering begins at zero. |
|
|
1365
|
+ |
|
|
1366
|
+ <a id="output"></a><br><br><strong>8.38. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$output</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><file path></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark does not produce anything in the resulting HTML or PDF files, but outputs |
|
|
1367
|
+ <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> (without any modification) into the file <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><file path></span></strong></div>. |
|
|
1368
|
+ <br> |
|
|
1369
|
+ <br> |
|
|
1370
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$output</div></strong></span> can be very <strong><div style="display: inline; color: rgb(220,0,0)">unsafe</div></strong> for the web. In any case it is not very useful on the web because web pages offer |
|
|
1371
|
+ other ways of uploading files. So, the best is just to forbid it. |
|
|
1372
|
+ |
|
|
1373
|
+ <a id="par"></a><br><br><strong>8.39. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong></span></div></strong><br><br> This marks generates a line break. You can use several <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong></span> in order to make some |
|
|
1374
|
+ vertical space in your text. |
|
|
1375
|
+ <br><br> |
|
|
1376
|
+ <em>Warning:</em> The MAML parser doesn't take newline characters into account (they are just read as spaces). Hence, |
|
|
1377
|
+ using <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong></span> is often necessary. You can also define a macro inserting several such newlines. For example: |
|
|
1378
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(p)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong><strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong>)<br><br></pre> |
|
|
1379
|
+ |
|
|
1380
|
+ <a id="popcounter"></a><br><br><strong>8.40. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$popcounter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span></div></strong><br><br> |
|
|
1381
|
+ This mark destroys the most recent counter whose name is <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>. |
|
|
1382
|
+ |
|
|
1383
|
+ <a id="postpone"></a><br><br><strong>8.41. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$postpone</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> |
|
|
1384
|
+ The <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> text <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> is evaluated only after the entire <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> source is parsed and evaluated (including the |
|
|
1385
|
+ sources obtained via <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong></span>). |
|
|
1386
|
+ On the contrary, everything not within a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$postpone</div></strong></span> is |
|
|
1387
|
+ evaluated at the moment it is parsed. The mark <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$postpone</div></strong></span> is typically used in conjunction with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$accumulator</div></strong></span>, |
|
|
1388
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$append</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$content</div></strong></span> for creating a table of contents at the beginning of a document. This is how |
|
|
1389
|
+ the table of contents at the beginning of this tutorial was made.<br><br> |
|
|
1390
|
+ |
|
|
1391
|
+ As another easy example, the sentence <em>Below is a description of the 60 |
|
|
1392
|
+ primitive <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks.</em> that you can find just after the section title <a rel="tag" href="#catalog">The catalog of <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks</a> contains a |
|
|
1393
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$postpone</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$countervalue</div></strong>(markcount))</span> producing the number 60 (where |
|
|
1394
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">markcount</span> is the name of the counter used for numbering the marks in this catalog). |
|
|
1395
|
+ |
|
|
1396
|
+ <a id="pushcounter"></a><br><br><strong>8.42. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$pushcounter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><init></span></strong></div>)</span></div></strong><br><br> |
|
|
1397
|
+ This mark creates a new counter under the name <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>, with <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><init></span></strong></div> as its initial value. See |
|
|
1398
|
+ <a rel="tag" href="#counters">Counters</a>. |
|
|
1399
|
+ |
|
|
1400
|
+ <a id="ref"></a><br><br><strong>8.43. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ref</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><tag></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> |
|
|
1401
|
+ This mark creates an internal hyperlink. When clicked upon, this moves the text |
|
|
1402
|
+ to the position of the <a rel="tag" href="#label"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$label</div></strong></span></a> (this is a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$ref</div></strong></span> !) with the same tag name. |
|
|
1403
|
+ |
|
|
1404
|
+ <a id="reverse"></a><br><br><strong>8.44. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$reverse</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span></div></strong><br><br> |
|
|
1405
|
+ This mark return its operand (assumed to be a list), but in reverse order. If the operand is not a list, an error |
|
|
1406
|
+ message is generated. |
|
|
1407
|
+ |
|
|
1408
|
+ <a id="rgb"></a><br><br><strong>8.45. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><color></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark sets the color of characters in <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> to <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><color></span></strong></div>, where |
|
|
1409
|
+ <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><color></span></strong></div> has the form of three integers separated by commas, representing the intensities of red, green and blue. |
|
|
1410
|
+ These numbers must be between 0 and 255. For example,<br> |
|
|
1411
|
+ <br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">255</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(the text)</span></td></tr></table></center><br> |
|
|
1412
|
+ produces: |
|
|
1413
|
+ <br><center><table style="color: inherit; font-size: inherit;"><tr><td><div style="display: inline; color: rgb(255,0,0)">the text</div></td></tr></table></center><br> |
|
|
1414
|
+ See also <a rel="tag" href="#colors">the predefined colors</a>. |
|
|
1415
|
+ |
|
|
1416
|
+ <a id="rpar"></a><br><br><strong>8.46. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rpar</div></strong></span></div></strong><br><br> This mark inserts a right (closing) parenthese into the text. You must use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong></span> and/or |
|
|
1417
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rpar</div></strong></span> if you want to introduce unbalanced parentheses within an operand of a mark. |
|
|
1418
|
+ |
|
|
1419
|
+ <a id="setcounter"></a><br><br><strong>8.47. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$setcounter</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div>)</span></div></strong><br><br> |
|
|
1420
|
+ This mark puts the value <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><value></span></strong></div> in the most recent counter whose name is <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>. See <a rel="tag" href="#counters">Counters</a>. |
|
|
1421
|
+ |
|
|
1422
|
+ <a id="sort"></a><br><br><strong>8.48. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sort</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span></div></strong><br><br> |
|
|
1423
|
+ This marks performs a quick sorting of its operand which is supposed to be a list. If the operand is not a list, it is |
|
|
1424
|
+ returned as is.<br><br> |
|
|
1425
|
+ |
|
|
1426
|
+ The sorting is always alphabetic, but it can be relative to any part of the elements in the list. In order to |
|
|
1427
|
+ designate which part of an element of the list must be used for comparison, put the special mark |
|
|
1428
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$alphabetic</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><part></span></strong></div>)</span> around this part.<br><br> |
|
|
1429
|
+ |
|
|
1430
|
+ At the rendering stage <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$alphabetic</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><part></span></strong></div>)</span> is just replaced by <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><part></span></strong></div></span>. See <a rel="tag" href="#box"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong></span></a> |
|
|
1431
|
+ for an example. |
|
|
1432
|
+ |
|
|
1433
|
+ <a id="sp"></a><br><br><strong>8.49. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sp</div></strong></span></div></strong><br><br> This mark (space) produces an unbreakable space (translated into <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">&nbsp;</span> in HTML and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">~</span> in <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">). |
|
|
1434
|
+ |
|
|
1435
|
+ <a id="sub"></a><br><br><strong>8.50. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sub</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark lowers <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> and renders it in a smaller size. For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">x<strong><div style="display: inline; color: rgb(255,000,000)">$sub</div></strong>(<div style="display: inline; color: rgb(160,082,045)">1</div>)</span> |
|
|
1436
|
+ produces x<sub>1</sub>. |
|
|
1437
|
+ |
|
|
1438
|
+ <a id="sublist"></a><br><br><strong>8.51. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sublist</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><start></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><end></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list></span></strong></div>)</span></div></strong><br><br> |
|
|
1439
|
+ The third operand of this mark is supposed to be a list. If it's not a list, an error message is generated.<br><br> |
|
|
1440
|
+ |
|
|
1441
|
+ If it is a list, the result is the sublist beginning at element number <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><start></span></strong></div> (included) and finishing at |
|
|
1442
|
+ element number <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><end></span></strong></div> (not included). Notice that numbering begins at <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(160,082,045)">0</div></span>, not <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(160,082,045)">1</div></span>. |
|
|
1443
|
+ If the value of <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><start></span></strong></div> or <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><end></span></strong></div> is out of bounds, this value is |
|
|
1444
|
+ replaced by the actual bound which is <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(160,082,045)">0</div></span> for <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><start></span></strong></div> and the length of the list for <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><end></span></strong></div>. For example, |
|
|
1445
|
+ |
|
|
1446
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$sublist</div></strong>(-<div style="display: inline; color: rgb(160,082,045)">3</div>)(<div style="display: inline; color: rgb(160,082,045)">4</div>)([a,b,c,d,e,f,g,h,i,j,k])<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong> |
|
|
1447
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$sublist</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<div style="display: inline; color: rgb(160,082,045)">4</div>)([a,b,c,d,e,f,g,h,i,j,k])<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong> |
|
|
1448
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$sublist</div></strong>(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<div style="display: inline; color: rgb(160,082,045)">4</div>)([a,b,c,d,e,f,g,h,i,j,k])<br><br></pre> |
|
|
1449
|
+ produces:<br><br> |
|
|
1450
|
+ abcd<br> |
|
|
1451
|
+ abcd<br> |
|
|
1452
|
+ bcd |
|
|
1453
|
+ |
|
|
1454
|
+ |
|
|
1455
|
+ |
|
|
1456
|
+ <a id="sup"></a><br><br><strong>8.52. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sup</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark raises <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> and renders it in a smaller size. For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">x<strong><div style="display: inline; color: rgb(255,000,000)">$sup</div></strong>(<div style="display: inline; color: rgb(160,082,045)">1</div>)</span> |
|
|
1457
|
+ produces x<sup>1</sup>. |
|
|
1458
|
+ |
|
|
1459
|
+ <a id="tbgc"></a><br><br><strong>8.53. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><color></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark (<em>text background color</em>) shows <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> over a background of color |
|
|
1460
|
+ <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><color></span></strong></div>. For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tbgc</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$_lavender</div></strong>)(Some text.)</span> |
|
|
1461
|
+ produces: <div style="display: inline; background-color: rgb(200,200,220); ">Some text.</div> |
|
|
1462
|
+ <br><br> |
|
|
1463
|
+ This is valuable for short texts. For long texts, <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(...)</span></a> may be more |
|
|
1464
|
+ appropriate. |
|
|
1465
|
+ |
|
|
1466
|
+ <a id="thisfilepath"></a><br><br><strong>8.54. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$thisfilepath</div></strong></span></div></strong><br><br> |
|
|
1467
|
+ This marks provides the absolute path of the file it is written into.<br><br> |
|
|
1468
|
+ |
|
|
1469
|
+ <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$thisfilepath</div></strong></span> is <strong><div style="display: inline; color: rgb(220,0,0)">unsafe</div></strong> for the web, because it can reveal an absolute path of your web server. You should forbid |
|
|
1470
|
+ it. |
|
|
1471
|
+ |
|
|
1472
|
+ <a id="tlink"></a><br><br><strong>8.55. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tlink</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><url></span></strong></div>)</span></div></strong><br><br> This mark creates an hypertext link targeting the <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><url></span></strong></div>, and shown as the clickable |
|
|
1473
|
+ <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> (which can also be an image). For example, |
|
|
1474
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$tlink</div></strong>(Visit |
|
|
1475
|
+ <strong><div style="display: inline; color: rgb(255,000,000)">$big</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$blue</div></strong>(G)<strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(o)<strong><div style="display: inline; color: rgb(255,000,000)">$yellow</div></strong>(o)<strong><div style="display: inline; color: rgb(255,000,000)">$blue</div></strong>(g)<strong><div style="display: inline; color: rgb(255,000,000)">$green</div></strong>(l)<strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(e))) |
|
|
1476
|
+ (http://www.google.com)<br><br></pre> |
|
|
1477
|
+ produces |
|
|
1478
|
+ <a href="http://www.google.com">Visit |
|
|
1479
|
+ <big><div style="display: inline; color: rgb(000,000,255)">G</div><div style="display: inline; color: rgb(255,000,000)">o</div><div style="display: inline; color: rgb(255,255,000)">o</div><div style="display: inline; color: rgb(000,000,255)">g</div><div style="display: inline; color: rgb(000,255,000)">l</div><div style="display: inline; color: rgb(255,000,000)">e</div></big></a> (that |
|
|
1480
|
+ you can click upon). |
|
|
1481
|
+ |
|
|
1482
|
+ |
|
|
1483
|
+ |
|
|
1484
|
+ <a id="transpose"></a><br><br><strong>8.56. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$transpose</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><list of lists></span></strong></div>)</span></div></strong><br><br> |
|
|
1485
|
+ This mark <em>transposes</em> (somehow as in mathematics) a list of lists considered as a <em>matrix</em>. As an example, |
|
|
1486
|
+ we define: |
|
|
1487
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(mylist)(<div style="display: inline; color: rgb(160,082,045)">0</div>)([[a,b],[c,d,e],[f,g]]) |
|
|
1488
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(addbox)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">16</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
1489
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(separ)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(addbox)(<div style="display: inline; color: rgb(255,000,255)">$1</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong>)<br><br></pre> |
|
|
1490
|
+ |
|
|
1491
|
+ |
|
|
1492
|
+ |
|
|
1493
|
+ |
|
|
1494
|
+ |
|
|
1495
|
+Now, if we write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(separ)(<strong><div style="display: inline; color: rgb(255,000,000)">$mylist</div></strong>)</span>, we obtain: |
|
|
1496
|
+<br><br> |
|
|
1497
|
+<div align="left" style="display: inline-block; width: 16px;">a</div><div align="left" style="display: inline-block; width: 16px;">b</div><br><div align="left" style="display: inline-block; width: 16px;">c</div><div align="left" style="display: inline-block; width: 16px;">d</div><div align="left" style="display: inline-block; width: 16px;">e</div><br><div align="left" style="display: inline-block; width: 16px;">f</div><div align="left" style="display: inline-block; width: 16px;">g</div><br> |
|
|
1498
|
+<br> |
|
|
1499
|
+and if we write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(separ)(<strong><div style="display: inline; color: rgb(255,000,000)">$transpose</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$mylist</div></strong>))</span>, we obtain: |
|
|
1500
|
+<br><br> |
|
|
1501
|
+<div align="left" style="display: inline-block; width: 16px;">a</div><div align="left" style="display: inline-block; width: 16px;">c</div><div align="left" style="display: inline-block; width: 16px;">f</div><br><div align="left" style="display: inline-block; width: 16px;">b</div><div align="left" style="display: inline-block; width: 16px;">d</div><div align="left" style="display: inline-block; width: 16px;">g</div><br><div align="left" style="display: inline-block; width: 16px;"></div><div align="left" style="display: inline-block; width: 16px;">e</div><br> |
|
|
1502
|
+<br> |
|
|
1503
|
+ |
|
|
1504
|
+ |
|
|
1505
|
+ Notice that if a line of the matrix is shorter than a subsequent line, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$transpose</div></strong></span> automatically inserts <em>empty</em> |
|
|
1506
|
+ (invisible) elements in the |
|
|
1507
|
+ transposed matrix so that items which are in the same <em>line</em> in the original matrix are in the same <em>column</em> in the |
|
|
1508
|
+ transposed matrix.<br><br> |
|
|
1509
|
+ |
|
|
1510
|
+ This is useful (in conjunction with <a rel="tag" href="#sublist"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sublist</div></strong></span></a>) and some <a rel="tag" href="#arithmetics">arithmetics</a> |
|
|
1511
|
+ for example for displaying a list of items on several columns, with the first group of elements in the first |
|
|
1512
|
+ column (not the first line), the next group of elements in the second column, and so on. This can be used for example |
|
|
1513
|
+ for automatically producing an index on several columns. This is also used in this tutorial for displaying the list |
|
|
1514
|
+ of all marks on four columns <a rel="tag" href="#catalog">at the beginning of this section</a>.<br><br> |
|
|
1515
|
+ |
|
|
1516
|
+ Below is a simple example. We want to sort a list of words in alphabetic order and to present them on two columns. |
|
|
1517
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br> <div style="display: inline; color: rgb(000,100,000)">$// define a list of words</div> |
|
|
1518
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(words)(<div style="display: inline; color: rgb(160,082,045)">0</div>) |
|
|
1519
|
+ ([We,want,to,sort,a,list,of,words,and, |
|
|
1520
|
+ to,present,them,in,alphabetic,order,on,two,columns])<br><br></pre> |
|
|
1521
|
+ |
|
|
1522
|
+ |
|
|
1523
|
+ |
|
|
1524
|
+ We prepare the sorting of the list by applying a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">120</div>)</span> and a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$alphabetic</div></strong></span> to all elements. |
|
|
1525
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(a)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$box</div></strong>(<div style="display: inline; color: rgb(160,082,045)">120</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$alphabetic</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>))) <div style="display: inline; color: rgb(000,100,000)">$// because $apply accepts only macros</div> |
|
|
1526
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(sortedwords)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$sort</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(a)(<strong><div style="display: inline; color: rgb(255,000,000)">$words</div></strong>)))<br><br></pre> |
|
|
1527
|
+ |
|
|
1528
|
+ |
|
|
1529
|
+ |
|
|
1530
|
+so that <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$sortedwords</div></strong></span> looks like this: |
|
|
1531
|
+<br><br> |
|
|
1532
|
+<div align="left" style="display: inline-block; width: 120px;">a</div><div align="left" style="display: inline-block; width: 120px;">alphabetic</div><div align="left" style="display: inline-block; width: 120px;">and</div><div align="left" style="display: inline-block; width: 120px;">columns</div><div align="left" style="display: inline-block; width: 120px;">in</div><div align="left" style="display: inline-block; width: 120px;">list</div><div align="left" style="display: inline-block; width: 120px;">of</div><div align="left" style="display: inline-block; width: 120px;">on</div><div align="left" style="display: inline-block; width: 120px;">order</div><div align="left" style="display: inline-block; width: 120px;">present</div><div align="left" style="display: inline-block; width: 120px;">sort</div><div align="left" style="display: inline-block; width: 120px;">them</div><div align="left" style="display: inline-block; width: 120px;">to</div><div align="left" style="display: inline-block; width: 120px;">to</div><div align="left" style="display: inline-block; width: 120px;">two</div><div align="left" style="display: inline-block; width: 120px;">want</div><div align="left" style="display: inline-block; width: 120px;">We</div><div align="left" style="display: inline-block; width: 120px;">words</div> |
|
|
1533
|
+<br><br> |
|
|
1534
|
+ Now, we compute the length of this list, divide it by <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(160,082,045)">2</div></span> and add 1 if the remainder is not zero, |
|
|
1535
|
+ so that we can cut our list in two lists |
|
|
1536
|
+ of almost the same length (the first one with possibly one element more than the second one). |
|
|
1537
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(halflen)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$add</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$quotient</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$length</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$sortedwords</div></strong>))(<div style="display: inline; color: rgb(160,082,045)">2</div>)) |
|
|
1538
|
+ (<strong><div style="display: inline; color: rgb(255,000,000)">$if</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$equals</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$remainder</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$length</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$sortedwords</div></strong>))(<div style="display: inline; color: rgb(160,082,045)">2</div>)))(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<div style="display: inline; color: rgb(160,082,045)">1</div>))) |
|
|
1539
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(column<div style="display: inline; color: rgb(160,082,045)">1</div>)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$sublist</div></strong>(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$halflen</div></strong>)(<strong><div style="display: inline; color: rgb(255,000,000)">$sortedwords</div></strong>)) |
|
|
1540
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(column<div style="display: inline; color: rgb(160,082,045)">2</div>)(<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$sublist</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$halflen</div></strong>)(<strong><div style="display: inline; color: rgb(255,000,000)">$length</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$sortedwords</div></strong>))(<strong><div style="display: inline; color: rgb(255,000,000)">$sortedwords</div></strong>))<br><br></pre> |
|
|
1541
|
+ |
|
|
1542
|
+ |
|
|
1543
|
+ |
|
|
1544
|
+ |
|
|
1545
|
+ |
|
|
1546
|
+Finally, we can get the wanted result by writing: |
|
|
1547
|
+ |
|
|
1548
|
+<pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(putpar)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<div style="display: inline; color: rgb(255,000,255)">$1</div><strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong>) |
|
|
1549
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$center</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$apply</div></strong>(putpar)(<strong><div style="display: inline; color: rgb(255,000,000)">$transpose</div></strong>([<strong><div style="display: inline; color: rgb(255,000,000)">$column1</div></strong>,<strong><div style="display: inline; color: rgb(255,000,000)">$column2</div></strong>])))<br><br></pre> |
|
|
1550
|
+ |
|
|
1551
|
+<center><table style="color: inherit; font-size: inherit;"><tr><td><div align="left" style="display: inline-block; width: 120px;">a</div><div align="left" style="display: inline-block; width: 120px;">present</div><br><div align="left" style="display: inline-block; width: 120px;">alphabetic</div><div align="left" style="display: inline-block; width: 120px;">sort</div><br><div align="left" style="display: inline-block; width: 120px;">and</div><div align="left" style="display: inline-block; width: 120px;">them</div><br><div align="left" style="display: inline-block; width: 120px;">columns</div><div align="left" style="display: inline-block; width: 120px;">to</div><br><div align="left" style="display: inline-block; width: 120px;">in</div><div align="left" style="display: inline-block; width: 120px;">to</div><br><div align="left" style="display: inline-block; width: 120px;">list</div><div align="left" style="display: inline-block; width: 120px;">two</div><br><div align="left" style="display: inline-block; width: 120px;">of</div><div align="left" style="display: inline-block; width: 120px;">want</div><br><div align="left" style="display: inline-block; width: 120px;">on</div><div align="left" style="display: inline-block; width: 120px;">We</div><br><div align="left" style="display: inline-block; width: 120px;">order</div><div align="left" style="display: inline-block; width: 120px;">words</div><br></td></tr></table></center> |
|
|
1552
|
+<br><br> |
|
|
1553
|
+ The macro <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$multicolumns</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><number of columns></span></strong></div>)(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><items></span></strong></div>)</span> defined in <div style="display: inline; color: rgb(0,80,50)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">basis.maml</span></div> |
|
|
1554
|
+ is just a more general version of the above. |
|
|
1555
|
+ |
|
|
1556
|
+ |
|
|
1557
|
+ <a id="true"></a><br><br><strong>8.57. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$true</div></strong></span></div></strong><br><br> This mark represents the truth value <em>true</em>. |
|
|
1558
|
+ |
|
|
1559
|
+ <a id="tt"></a><br><br><strong>8.58. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tt</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This mark renders <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> in fixed width (typewriter) font. It is similar to |
|
|
1560
|
+ <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(...)</span></a>, with the difference that <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> is put inline instead of as a separate block. |
|
|
1561
|
+ For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(<strong><div style="display: inline; color: rgb(255,000,000)">$tt</div></strong>(This)) is <strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(<div style="display: inline; color: rgb(160,082,045)">220</div>,<div style="display: inline; color: rgb(160,082,045)">220</div>,<div style="display: inline; color: rgb(160,082,045)">220</div>)(an) example.</span> |
|
|
1562
|
+ produces: <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">This</span></div> is <pre style="color: inherit; font-size: inherit; background-color: rgb(220,220,220); width: 600px;">an</pre> example. |
|
|
1563
|
+ <br><br> |
|
|
1564
|
+ See also <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(...)</span></a> and <a rel="tag" href="#verbatim"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong>(...)</span></a>. |
|
|
1565
|
+ |
|
|
1566
|
+ <a id="undefine"></a><br><br><strong>8.59. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$undefine</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div>)</span></div></strong><br><br> This mark allows to <em>undefine</em> a macro previously defined by <a rel="tag" href="#define"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span></a>. |
|
|
1567
|
+ Actually, it removes only the last definition of the macro whose name is given, so that the previous definition of |
|
|
1568
|
+ this same mark name (if any) is working again. |
|
|
1569
|
+ If no macro with name <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><name></span></strong></div> exists, nothing happens. <br><br> |
|
|
1570
|
+ |
|
|
1571
|
+ Example: |
|
|
1572
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(emph)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$italic</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
1573
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$emph</div></strong>(text<div style="display: inline; color: rgb(160,082,045)">1</div>)<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong> |
|
|
1574
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(emph)(<div style="display: inline; color: rgb(160,082,045)">2</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$bold</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>):<strong><div style="display: inline; color: rgb(255,000,000)">$red</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$2</div>)) |
|
|
1575
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$emph</div></strong>(text<div style="display: inline; color: rgb(160,082,045)">2</div>a)(text<div style="display: inline; color: rgb(160,082,045)">2</div>b)<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong> |
|
|
1576
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$undefine</div></strong>(emph) |
|
|
1577
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$emph</div></strong>(text<div style="display: inline; color: rgb(160,082,045)">3</div>)<br><br></pre> |
|
|
1578
|
+ produces:<br><br> |
|
|
1579
|
+ |
|
|
1580
|
+ |
|
|
1581
|
+<em>text1</em><br> |
|
|
1582
|
+ |
|
|
1583
|
+<strong>text2a</strong>:<div style="display: inline; color: rgb(255,000,000)">text2b</div><br> |
|
|
1584
|
+ |
|
|
1585
|
+<em>text3</em> |
|
|
1586
|
+ <br><br> |
|
|
1587
|
+ As a consequence, a <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> text can safely be embedded into another <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> text using <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$input</div></strong></span>, provided |
|
|
1588
|
+ that you <em>undefine</em> the macros defined in the embedded text at the end of the embedded text. <br><br> |
|
|
1589
|
+ |
|
|
1590
|
+ As told in <a rel="tag" href="#define"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span></a>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong></span> doesn't allow recursion. However, if a macro with the same |
|
|
1591
|
+ name is already defined, any usage of this macro name in the body of the new definition refers to the previous |
|
|
1592
|
+ definition. For example, |
|
|
1593
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(bu)(<div style="display: inline; color: rgb(160,082,045)">1</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$italic</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>)) |
|
|
1594
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$bu</div></strong>(Some text.)<strong><div style="display: inline; color: rgb(255,000,000)">$par</div></strong> |
|
|
1595
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$define</div></strong>(bu)(<div style="display: inline; color: rgb(160,082,045)">2</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">120</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$bu</div></strong>(<div style="display: inline; color: rgb(255,000,255)">$1</div>) <div style="display: inline; color: rgb(255,000,255)">$2</div>)) |
|
|
1596
|
+<strong><div style="display: inline; color: rgb(255,000,000)">$bu</div></strong>(Text<div style="display: inline; color: rgb(160,082,045)">1</div>)(Text<div style="display: inline; color: rgb(160,082,045)">2</div>)<br><br></pre> produces:<br><br> |
|
|
1597
|
+ |
|
|
1598
|
+ |
|
|
1599
|
+ |
|
|
1600
|
+ <em>Some text.</em><br> |
|
|
1601
|
+ |
|
|
1602
|
+ <div style="display: inline; color: rgb(120,0,0)"><em>Text1</em> Text2</div><br> |
|
|
1603
|
+ |
|
|
1604
|
+ |
|
|
1605
|
+ <a id="verbatim"></a><br><br><strong>8.60. <div style="display: inline; color: rgb(255,000,000)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong>(<div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>)</span></div></strong><br><br> This marks reproduces its content without any change with two exceptions. |
|
|
1606
|
+ Indeed, <strong><div style="display: inline; color: rgb(180,0,0)">M</div><div style="display: inline; color: rgb(0,120,0)">A</div><div style="display: inline; color: rgb(80,80,80)">M</div><div style="display: inline; color: rgb(0,0,220)">L</div></strong> marks within |
|
|
1607
|
+ <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> are not interpreted, except the two marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong></span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rpar</div></strong></span>, which allows you |
|
|
1608
|
+ to produce unbalanced parentheses in <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div> despite the fact that actual parentheses <em>must</em> be |
|
|
1609
|
+ balanced in <div style="display: inline; color: rgb(0,80,0)"><strong><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><text></span></strong></div>. Example: |
|
|
1610
|
+ <br> |
|
|
1611
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong>(In this (<strong><div style="display: inline; color: rgb(255,000,000)">$italic</div></strong>(text))(), ((parentheses) are) <strong><div style="display: inline; color: rgb(255,000,000)">$rpar</div></strong><strong><div style="display: inline; color: rgb(255,000,000)">$rpar</div></strong><strong><div style="display: inline; color: rgb(255,000,000)">$lpar</div></strong> balanced.)<br><br></pre> |
|
|
1612
|
+ produces: |
|
|
1613
|
+ <br><br> |
|
|
1614
|
+ In this ($italic(text))(), ((parentheses) are) ))( balanced. |
|
|
1615
|
+ <br><br> |
|
|
1616
|
+ Nevertheless, colors are applied if <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong>(...)</span> is within a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(...)(...)</span>. Indeed, |
|
|
1617
|
+ <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$rgb</div></strong>(<div style="display: inline; color: rgb(160,082,045)">255</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>,<div style="display: inline; color: rgb(160,082,045)">0</div>)(<strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong>(Red verbatim text))<br><br></pre> produces: |
|
|
1618
|
+ <div style="display: inline; color: rgb(255,0,0)">Red verbatim text</div> |
|
|
1619
|
+ On the contrary, <pre style="color: inherit; font-size: inherit; background-color: rgb(230,235,220); width: 600px;"><br><strong><div style="display: inline; color: rgb(255,000,000)">$colorize</div></strong>(maml)(<strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong>(Red verbatim text))<br><br></pre> produces: |
|
|
1620
|
+ Red verbatim text |
|
|
1621
|
+ because <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$verbatim</div></strong></span> is not a macro. |
|
|
1622
|
+ <br> |
|
|
1623
|
+ <br> |
|
|
1624
|
+ See also <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$code</div></strong>(...)</span></a> and <a rel="tag" href="#tt"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><strong><div style="display: inline; color: rgb(255,000,000)">$tt</div></strong>(...)</span></a>. |
|
|
1625
|
+ <br><br><br><br> |
|
|
1626
|
+ |
|
|
1627
|
+ |
|
|
1628
|
+ |
|
|
1629
|
+<br><br><br><br><br><br><br><br> |
|
|
1630
|
+ |
|
|
1631
|
+</div></td></tr></table></center></body></html> |
|
0
|
1632
|
\ No newline at end of file |
...
|
...
|
|