blob: 435f78796fa18c302336a8a098ae09dc5eb1a928 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
@
@
@(bind symhash @(hash :equal-based))
@(bind tagmap @(hash :equal-based))
@(bind tochash @(hash :equal-based))
@(bind closedtxt "<TT>[+]</TT>")
@(bind opentxt "<TT>[-]</TT>")
@(bind xpnall "[expand all]")
@(bind clpsall "[collapse all]")
@(bind closed t)
@(do
(defvar dupes (hash))
(defvar tagnum (hash :equal-based))
(defvarl disamb (hash :equal-based))
(defvarl dist-counter 0)
(sys:set-hash-str-limit 1000)
(defun hash-title (title)
(let* ((h (logtrunc (hash-equal title) 32))
(existing [dupes h]))
(when existing
(unless (equal title existing)
(error "~a ~a hash collision!" existing title)))
(set [dupes h] title)
(format nil "N-~,08X" h)))
(defun toc-tag (sec)
`TOC-@sec`)
(set [tagmap "lbAB"] (hash-title "NAME"))
(defun enumerate (title)
(let ((num (inc [tagnum title 0])))
`@title@(if (> num 1) `-@num` "")`))
(defun process-ambiguities (hash)
(hash-update hash (do if (eql (length @1) 1)
(first @1)
(let ((new-tag (format nil "D-~,04X"
(inc dist-counter))))
(set [disamb new-tag] (reverse @1))
new-tag)))))
Content-type: text/html
@(skip 15)
<h1>TXR</h1>
@(skip)Updated: @YEAR-@MONTH-@DAY<br><a href="#index">Index</a>
@(bind TIME @(make-time-utc (int-str YEAR) (int-str MONTH) (int-str DAY)
0 0 0 nil))
@(bind VERSION nil)
@(collect :vars (BODY))
@ (some)
@ (cases)
<a name="@tag"> </a>
@ (some)
<h@level>@sec @title</h@level>
@ (or)
<h@level>@sec @title
</h@level>
@ (end)
@ (bind newtag @(hash-title (enumerate title)))
@ (do (set [tagmap tag] newtag))
@ (output :into BODY)
<a name="@newtag"> </a>
<h@level><a href="#@(toc-tag sec)" onclick="tocjump('@(toc-tag sec)')">@sec</a> @title</h@level>
@ (end)
@ (cat BODY "\n")
@ (or)
@BODY
@ (end)
@ (and)
<b>TXR</b> - text processing language (version @ver)
@ (set VERSION ver)
@ (end)
@(until)
<hr>
<a name="index"> </a><h2>Index</h2>
@(end)
<hr>
@(collect :vars (TOC))
@ (some)
@ (cases)
@ (cases)
<dt><a href="#@tag">@num @rest</a><dd>
@ (or)
<dt><a href="#@tag">@num @rest
</a><dd>
@ (end)
@ (bind TOC `<dt><a name="@(toc-tag num)" class="tocanchor">@num</a> <a href="#@[tagmap tag]">@rest</a></dt>`)
@ (or)
<a name="index">@(skip)
@ (output :into TOC)
<h2>Contents</h2>
<noscript>
<h3>Please turn on Javascript to use the collapsible contents.</h3>
</noscript>
<a href="#/" onclick="toggleall(this)">@clpsall</a>
@ (end)
@ (or)
@TOC
@ (end)
@ (and)
<dt><a href="@nil">@nil TXR LISP</a><dd>
@ (and)
<dt><a href="#@tag">@(coll :vars (sym))<tt>@sym</tt>@(end)
@ (do (let ((n-tag [tagmap tag]))
(mapdo (do pushnew n-tag [symhash @1]) sym)
(set [tochash n-tag] rest)))
@ (and)
<dt><a href="#@tag">@num @nil
@ (maybe)
</a><dd>
@ (end)
<dl>
@ (cat TOC)
@ (bind pos @(car (search-regex TOC #/<a/)))
@ (bind id @(gensym))
@ (do (set [TOC pos..pos]
`<a href="#/" onclick="toggle(this, '@id')" class="toggle">@(if closed closedtxt opentxt)</a>`))
@ (output :into TOC)
@TOC
<dd><dl id="@id"@(if closed " style=\"display: none\"")>
@ (end)
@ (end)
@(until)
This document was created by
@(end)
@(flatten TOC)
@(do (process-ambiguities symhash))
@(set BODY @(let ((inside-tt nil)
(inside-syntax nil))
(mapcar (do cond
((equal @1 "<tt>") (set inside-tt t) @1)
((equal @1 "</tt>") (set inside-tt nil)
(set inside-syntax nil)
@1)
((equal @1 "<dt>Syntax:<dd>") (set inside-syntax t) @1)
((or (and inside-tt (not inside-syntax))
(match-regex @1 #/<dt><tt>/))
(regsub #/@?[\(\[][^ )&]+/
(do let* ((at (if (eql [@1 0] #\@)
(pop @1)))
(tok [@1 1..:])
(bkt [@1 0])
(tag [symhash tok]))
(if tag
`@at@bkt<a href="#@tag">@tok</a>`
`@at@1`)) @1))
((search-regex @1 #/<h[1-9]>/) @1)
(t (regsub #/<tt>.%<\/tt>/
(do let* ((tok [@1 4 -5])
(tend (break-str tok ") "))
pfx sym sfx tag)
(cond
((match-str tok "@(")
(set pfx "@("
sym [tok 2 tend]
sfx [tok tend .. :]
tag [symhash sym]))
(t (set tag [symhash tok]
sym tok)))
(if tag
`<tt>@pfx<a href="#@tag">@sym</a>@sfx</tt>`
@1))
@1)))
BODY)))
@(bind (d-tag n-tag) @(transpose (hash-pairs disamb)))
@(output)
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>Manpage for TXR @VERSION</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
.disambiguations dl { margin-bottom: 2048px; }
</style>
<script type="text/javascript">
function toggle(link, id) {
var e = document.getElementById(id);
if (e.style.display == '') {
e.style.display = 'none';
link.innerHTML = '@closedtxt';
} else {
e.style.display = '';
link.innerHTML = '@opentxt';
}
}
function toggleall(link) {
var toc = document.getElementsByClassName("TOC");
var dls = toc[0].getElementsByTagName("DL");
var atoggles = toc[0].getElementsByClassName("toggle");
var disp = dls[0].style.display;
var ndisp = (disp == '') ? 'none' : '';
var nhtml = (disp == '') ? '@closedtxt' : '@opentxt'
for (var i = 0; i < dls.length; i++)
dls[i].style.display = ndisp;
for (var i = 0; i < atoggles.length; i++)
atoggles[i].innerHTML = nhtml;
link.innerHTML = (disp == '') ? '@xpnall' : '@clpsall';
}
function tocjump(hash) {
var toc = document.getElementsByClassName("TOC");
var tanch = toc[0].getElementsByClassName("tocanchor");
for (var i = 0; i < tanch.length; i++) {
var ta = tanch[i];
if (ta.name == hash) {
for (var e = ta.parentNode; e !== null; e = e.parentElement) {
if (e.tagName == "DL") {
var dt = e.previousElementSibling;
e.style.display = '';
if (dt !== null) {
var atoggles = dt.getElementsByClassName("toggle");
if (atoggles.length > 0)
atoggles[0].innerHTML = '@opentxt';
}
}
}
}
}
}
</script>
</head><body>
<h2>Manpage for <a href="#@[tagmap "lbAB"]">TXR </a>@VERSION</h2>
<h2>@(time-string-utc TIME "%b %d, %Y")</h2>
<p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBQLZSe0xgg+h5deucBW3W3vj5kgJXsNm+Cmidp8krGwBTXBJJ4b6qreIdiArKKEVD6Lohb0f+267KtCvu28j/Kf6MlVfds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IwSBszCBsIAUlp98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTEyMDMxMDEwMzczNFowIwYJKoZIhvcNAQkEMRYEFFrxlUHVygBbXOOpW9sAA30sKa+lMA0GCSqGSIb3DQEBAQUABIGAnn2T3mTtic58GXWIZSnV/PruTSwnEpyfVDVDBLyBNIPVabV0a2ra0HQZfHKxvMZNAPN2bpcBLPMubDZEWCcw6XdkOKPyZ9aJ7PEv5i7t6tg3MRR62YwroREHQVedCcRInnBFExQMOrZe/hTY75Xydk9yuIST4VbMO0CuttVz4aE=-----END PKCS7-----
">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</p>
<div class="toc">
@(repeat)
@TOC
@(end)
</div>
@(repeat)
@BODY
@(first)
@(end)
<div class="disambiguations">
@(repeat)
<a name="@{d-tag}">
<p>Topics matching <tt>@(hash-revget symhash d-tag)</tt>:
<dl>
@ (repeat :counter (n 1))
<dt><a href="#@{n-tag}">@n:</a> @[tochash n-tag]</dt>
@ (end)
</dl>
</a>
@(end)
</div>
</body>
</html>
@(end)
|