Add template files for browsing the installer dirs directly.

This commit is contained in:
Eli Barzilay 2010-06-16 02:01:03 -04:00
parent 1cce6c1f88
commit 098b32b0af
4 changed files with 40 additions and 11 deletions

View File

@ -53,6 +53,10 @@
(define-syntax (page stx)
(syntax-case stx () [(_ . xs) (process-contents 'page #'page* stx #'xs)]))
(define (page* #:id [id #f] #:dir [dir #f] #:file [file #f]
;; if this is true, return only the html -- don't create
;; a resource -- therefore no file is made, and no links
;; to it can be made (useful only for stub templates)
#:html-only [html-only? #f]
#:title [label (if id
(let* ([id (->string (force id))]
[id (regexp-replace #rx"^.*/" id "")]
@ -81,10 +85,11 @@
@(if body-attrs
(apply body `(,@body-attrs ,content))
(body content))}))
(define this (resource (get-path 'plain id file "html" dir)
(file-writer output-xml page)
referrer))
this)
(define this (and (not html-only?)
(resource (get-path 'plain id file "html" dir)
(file-writer output-xml page)
referrer)))
(if html-only? page this))
(provide set-navbar!)
(define-syntax-rule (set-navbar! pages help)

View File

@ -7,11 +7,12 @@
("lists" "http://lists.racket-lang.org/")
;; stubs usually use absolute paths for resources, since they're
;; templates that often get used in sub-dir pages too
("stubs/planet" "http://planet.racket-lang.org/" abs)
("stubs/pre" "http://pre.racket-lang.org/" abs)
("stubs/git" "http://git.racket-lang.org/" abs)
("stubs/blog" "http://blog.racket-lang.org/" abs)
("stubs/mailman" "http://lists.racket-lang.org/" abs)))
("stubs/planet" "http://planet.racket-lang.org/" abs)
("stubs/pre" "http://pre.racket-lang.org/" abs)
("stubs/git" "http://git.racket-lang.org/" abs)
("stubs/blog" "http://blog.racket-lang.org/" abs)
("stubs/mailman" "http://lists.racket-lang.org/" abs)
("stubs/dirlist" "http://download.racket-lang.org/" abs)))
(provide distributions)
(define distributions

View File

@ -0,0 +1,23 @@
#lang at-exp s-exp "../common.rkt"
;; This stub is to generate fancy directory listings with the Racket style
(define-context "stubs/dirlist")
(require racket/port)
(define (xml->string content)
(regexp-replace* #rx" "
(with-output-to-string (lambda () (output-xml content)))
"\\ "))
;; (define (racket-navbar) (xml->string (www:the-resources 'navbar #f)))
;; (define (racket-favicon) (xml->string (www:the-resources 'favicon-headers)))
(define header+footer
(delay (regexp-split #rx"{{{BODY}}}"
(xml->string @page[#:id 'browse-downloads
#:html-only #t
"{{{BODY}}}"]))))
(define header @plain[#:file "header.html" (car (force header+footer))])
(define footer @plain[#:file "footer.html" (cadr (force header+footer))])

View File

@ -2,6 +2,6 @@
(provide planet)
(require "planet.rkt" "blog.rkt"
(require "planet.rkt" "blog.rkt" ; these need to be copied to the service
"pre.rkt" "git.rkt"
"mailman.rkt")
"mailman.rkt" "dirlist.rkt") ; these are used on the server directly