diff --git a/scripts/make-egg-index.scm b/scripts/make-egg-index.scm
index 27df8d3..6d2afa8 100644
a
|
b
|
|
38 | 38 | (macros "Macros and meta-syntax") |
39 | 39 | (misc "Miscellaneous") |
40 | 40 | (hell "Concurrency and parallelism") |
41 | | (uncategorized "Uncategorized") |
| 41 | (uncategorized "Uncategorized or invalid category") |
42 | 42 | (obsolete "Unsupported or redundant") ) ) |
43 | 43 | |
44 | 44 | (define (d fstr . args) |
… |
… |
|
145 | 145 | (p "Generated with Chicken " ,(chicken-version)))) |
146 | 146 | |
147 | 147 | (define (emit-egg-information eggs) |
148 | | (append-map |
149 | | (match-lambda |
150 | | ((cat catname) |
151 | | (let ((eggs (append-map |
152 | | make-egg-entry |
153 | | (sort |
154 | | (filter (lambda (info) |
155 | | (and (eq? cat (cadr (or (assq 'category (cdr info)) |
156 | | '(#f uncategorized)))) |
157 | | (not (assq 'hidden (cdr info))))) |
158 | | eggs) |
159 | | (lambda (e1 e2) |
160 | | (string<? (symbol->string (car e1)) (symbol->string (car e2)))))))) |
161 | | (if (null? eggs) |
162 | | '() |
163 | | (begin |
164 | | (d "category: ~a" catname) |
165 | | `((a (@ (name ,cat))) |
166 | | (h3 (a (@ (href "#category-list")) |
167 | | ,catname)) |
168 | | (table |
169 | | (tr (th "Name") (th "Description") (th "License") (th "Author") (th "Maintainer") (th "Version")) |
170 | | ,@eggs))))))) |
171 | | +categories+)) |
| 148 | (let ((catnames (map car +categories+))) |
| 149 | (append-map |
| 150 | (match-lambda |
| 151 | ((cat catname) |
| 152 | (let ((eggs (append-map |
| 153 | make-egg-entry |
| 154 | (sort |
| 155 | (filter (lambda (info) |
| 156 | (let* ((egg-cat (assq 'category (cdr info))) |
| 157 | (catname (or (and egg-cat |
| 158 | (memq (cadr egg-cat) |
| 159 | catnames) |
| 160 | (cadr egg-cat)) |
| 161 | 'uncategorized))) |
| 162 | (and (eq? cat catname) |
| 163 | (not (assq 'hidden (cdr info)))))) |
| 164 | eggs) |
| 165 | (lambda (e1 e2) |
| 166 | (string<? (symbol->string (car e1)) (symbol->string (car e2)))))))) |
| 167 | (if (null? eggs) |
| 168 | '() |
| 169 | (begin |
| 170 | (d "category: ~a" catname) |
| 171 | `((a (@ (name ,cat))) |
| 172 | (h3 (a (@ (href "#category-list")) |
| 173 | ,catname)) |
| 174 | (table |
| 175 | (tr (th "Name") (th "Description") (th "License") (th "Author") (th "Maintainer") (th "Version")) |
| 176 | ,@eggs))))))) |
| 177 | +categories+))) |
172 | 178 | |
173 | 179 | (define (make-egg-entry egg) |
174 | 180 | (call/cc |
… |
… |
|
178 | 184 | (else def))) |
179 | 185 | (define (check pred x p) |
180 | 186 | (cond ((pred x) x) |
181 | | (else |
182 | | (warning "extension has .meta entry of incorrect type and will not be listed" (car egg) p x) |
183 | | (return '())))) |
| 187 | (else `(span (em (@ (class "meta-file-error")) |
| 188 | "Invalid meta-file property '" ,p "'") |
| 189 | " " (& "mdash") |
| 190 | " please contact this egg's author!")))) |
184 | 191 | (d " ~a ~a" (car egg) (prop 'version "HEAD" any?)) |
185 | 192 | `((tr (td (a (@ (href ,(sprintf "http://wiki.call-cc.org/eggref/~a/~a" *major-version* (car egg)))) |
186 | 193 | ,(symbol->string (car egg)))) |
… |
… |
|
191 | 198 | (td ,(prop 'version "" version?))))))) |
192 | 199 | |
193 | 200 | ;; Names are either raw HTML, or [[user name]] denoting a wiki link. |
194 | | (define (linkify-names str) |
| 201 | (define (linkify-names sxml) |
195 | 202 | ;; Call MATCHED on (sub)matches and DID-NOT-MATCH on non-matches in STR, |
196 | 203 | ;; and collect into a list. |
197 | 204 | (define (transform irx str matched did-not-match) |
… |
… |
|
210 | 217 | (let ((m (irregex-search irx str i end))) |
211 | 218 | (if (not m) |
212 | 219 | (finish i acc) |
213 | | (let* ((end (irregex-match-end m 0)) |
| 220 | (let* ((end (irregex-match-end-index m 0)) |
214 | 221 | (acc (kons i m acc))) |
215 | 222 | (lp end acc)))))))) |
216 | | (let ((irregex-match-start-index irregex-match-start)) ;; upcoming API change in irregex 0.7 |
217 | | (irregex-fold irx |
218 | | (lambda (i m s) |
219 | | (cons (matched (irregex-match-substring m 1)) |
220 | | (cons (did-not-match |
221 | | (substring str i (irregex-match-start-index m 0))) |
222 | | s))) |
223 | | '() |
224 | | str |
225 | | (lambda (i s) |
226 | | (reverse (cons (did-not-match (substring str i)) |
227 | | s)))))) |
228 | | (transform |
229 | | +link-regexp+ |
230 | | str |
231 | | (lambda (name) ;; wiki username |
232 | | `(a (@ (href ,(string-append "http://wiki.call-cc.org/users/" |
233 | | (string-substitute " " "-" name 'global)))) |
234 | | ,name)) |
235 | | (lambda (x) ;; raw HTML chunk |
236 | | `(literal ,x)))) |
| 223 | (irregex-fold irx |
| 224 | (lambda (i m s) |
| 225 | (cons (matched (irregex-match-substring m 1)) |
| 226 | (cons (did-not-match |
| 227 | (substring str i (irregex-match-start-index m 0))) |
| 228 | s))) |
| 229 | '() |
| 230 | str |
| 231 | (lambda (i s) |
| 232 | (reverse (cons (did-not-match (substring str i)) |
| 233 | s))))) |
| 234 | (if (string? sxml) |
| 235 | (transform |
| 236 | +link-regexp+ |
| 237 | sxml |
| 238 | (lambda (name) ;; wiki username |
| 239 | `(a (@ (href ,(string-append "http://wiki.call-cc.org/users/" |
| 240 | (irregex-replace/all " " name "-")))) |
| 241 | ,name)) |
| 242 | (lambda (x) ;; raw HTML chunk |
| 243 | `(literal ,x))) |
| 244 | sxml)) |
237 | 245 | |
238 | 246 | (define name? |
239 | 247 | (disjoin string? symbol?)) |