From ad6ac7fe286abea3cac46c614f5243c33ba395a1 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 8 Oct 2014 05:50:38 -0600 Subject: [PATCH] distro-build: "detail" label rendering on download page original commit: f0bd4e6d711b99af110a687445425da462458b65 --- .../distro-build-client/doc.txt | 11 +++-- .../distro-build-server/download-page.rkt | 45 +++++++++++++------ 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/pkgs/distro-build-pkgs/distro-build-client/doc.txt b/pkgs/distro-build-pkgs/distro-build-client/doc.txt index 1204180..ceca0de 100644 --- a/pkgs/distro-build-pkgs/distro-build-client/doc.txt +++ b/pkgs/distro-build-pkgs/distro-build-client/doc.txt @@ -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] [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 -------- diff --git a/pkgs/distro-build-pkgs/distro-build-server/download-page.rkt b/pkgs/distro-build-pkgs/distro-build-server/download-page.rkt index fcb06e1..bf907ad 100644 --- a/pkgs/distro-build-pkgs/distro-build-server/download-page.rkt +++ b/pkgs/distro-build-pkgs/distro-build-server/download-page.rkt @@ -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))