distro-build: "detail" label rendering on download page

original commit: f0bd4e6d711b99af110a687445425da462458b65
This commit is contained in:
Matthew Flatt 2014-10-08 05:50:38 -06:00
parent e39f2d9d8c
commit ad6ac7fe28
2 changed files with 39 additions and 17 deletions

View File

@ -405,12 +405,14 @@ sorted. Then, for the purposes of building the table, a "|" separated
by any number of spaces within a name is treated as a hierarchical
delimiter, while anything within "{" and "}" in a hierarchical level
is stripped from the displayed name along with surrounding spaces (so
that it can affect sorting without being displayed).
that it can affect sorting without being displayed). Anything after ";
" within a "|"-separated part is rendered as a detail part of the
label (e.g., in a smaller font).
For example, the names
"Racket | {2} Linux | 32-bit"
"Racket | {2} Linux | 64-bit"
"Racket | {2} Linux | 64-bit; built on Ubuntu"
"Racket | {1} Windows | 32-bit"
"Racket | {1} Windows | 64-bit"
"Racket | {3} Source"
@ -419,14 +421,15 @@ are shown (actually or conceptually) as
Racket
Windows
[32-bit]
[32-bit] <build on Ubuntu>
[64-bit]
Linux
[32-bit]
[64-bit]
[Source]
where the square-bracketed entries are hyperlinks.
where the square-bracketed entries are hyperlinks and the
angle-bracketed pieces are details.
Examples
--------

View File

@ -189,7 +189,7 @@
(define page-headers
(style/inline @~a|{
.detail { font-size: small; }
.detail { font-size: small; font-weight: normal; }
.checksum, .path { font-family: monospace; }
.group { background-color : #ccccff; padding-left: 0.5ex; }
.major { font-weight : bold; font-size : large; left-border: 1ex; }
@ -220,6 +220,21 @@
a { text-decoration: none; }
}|))
(define (strip-detail s)
(if (string? s)
(regexp-replace #rx";.*" s "")
s))
(define (add-detail s e)
(define m (and (string? s)
(regexp-match #rx"(?<=; )(.*)$" s)))
(cond
[m
(span e (span class: "detail"
nbsp
(cadr m)))]
[else e]))
(define page-body
(list
(if page-title
@ -249,17 +264,19 @@
(tr (td
(for/list ([col (in-list mid-cols)])
(span nbsp nbsp nbsp))
(if (past-success? inst)
;; Show missing installer
(span class: (string-append "no-installer " level-class)
last-col)
;; Link to installer
(a class: (string-append "installer " level-class)
href: (url->string
(combine-url/relative
(string->url installers-url)
inst))
last-col))
(add-detail
last-col
(if (past-success? inst)
;; Show missing installer
(span class: (string-append "no-installer " level-class)
(strip-detail last-col))
;; Link to installer
(a class: (string-append "installer " level-class)
href: (url->string
(combine-url/relative
(string->url installers-url)
inst))
(strip-detail last-col))))
(get-site-help last-col))
(td nbsp)
(td (if (past-success? inst)
@ -316,7 +333,9 @@
colspan: num-cols
(for/list ([col (in-list mid-cols)])
(span nbsp nbsp nbsp))
last-col
(add-detail
last-col
(strip-detail last-col))
(get-site-help last-col)))])))
(if (and docs-url
(not site))