Added a blogger template.

This required refactoring some of the layout code to make it possible to
embed pieces of it in the template.
This commit is contained in:
Eli Barzilay 2010-06-14 14:24:12 -04:00
parent 27eb374612
commit 8ff7a162db
4 changed files with 1171 additions and 74 deletions

View File

@ -126,8 +126,8 @@
nav))))
(force pages-promise)))))
(lambda (this)
(div class: 'navbar
(div class: 'titlecontent
(div class: 'racketnav
(div class: 'navcontent
(table border: 0 cellspacing: 0 cellpadding: 0 width: "100%"
(tr (header-cell logo)
(td class: 'helpiconcell
@ -158,26 +158,36 @@
;; site) to have its own resources (and possibly other customizations).
(provide define+provide-context define-context)
(define-for-syntax (make-define+provide-context stx provide?)
(define (make-it dir [icon #f] [logo #f] [style #f])
(with-syntax ([dir dir]
[page-id (datum->syntax stx 'page)]
[plain-id (datum->syntax stx 'plain)]
[copyfile-id (datum->syntax stx 'copyfile)]
[symlink-id (datum->syntax stx 'symlink)]
[resources-id (datum->syntax stx 'the-resources)])
(with-syntax
([icon (or icon #'(make-icon dir))]
[logo (or logo #`(make-logo dir))]
[style (or style #`(make-style dir))]
[provides (if provide?
#'(provide page-id plain-id copyfile-id symlink-id)
#'(begin))])
#'(begin
(define resources-id (make-resources icon logo style))
(define-syntax-rule (page-id . xs)
(page #:resources resources-id #:dir dir . xs))
(define-syntax-rule (plain-id . xs)
(plain #:dir dir . xs))
(define (copyfile-id source [target #f] [referrer values])
(copyfile-resource source target referrer #:dir dir))
(define (symlink-id source [target #f] [referrer values])
(symlink-resource source target referrer #:dir dir))
provides))))
(syntax-case stx ()
[(_ dir)
(with-syntax ([page-id (datum->syntax stx 'page)]
[plain-id (datum->syntax stx 'plain)]
[copyfile-id (datum->syntax stx 'copyfile)]
[symlink-id (datum->syntax stx 'symlink)])
#`(begin
(define resources
(make-resources (make-icon dir) (make-logo dir) (make-style dir)))
(define-syntax-rule (page-id . xs)
(page #:resources resources #:dir dir . xs))
(define-syntax-rule (plain-id . xs)
(plain #:dir dir . xs))
(define (copyfile-id source [target #f] [referrer values])
(copyfile-resource source target referrer #:dir dir))
(define (symlink-id source [target #f] [referrer values])
(symlink-resource source target referrer #:dir dir))
#,@(if provide?
#'((provide page-id plain-id copyfile-id symlink-id))
'())))]))
(make-it #'dir)]
[(_ dir #:resources icon logo style)
(make-it #'dir #'icon #'logo #'style)]))
(define-syntax (define+provide-context stx)
(make-define+provide-context stx #t))
(define-syntax (define-context stx)

View File

@ -8,7 +8,7 @@
(require "utils.ss")
(provide make-logo make-icon make-style)
(provide make-logo make-icon make-style navbar-style)
(define ((make-file-copier file) dir)
(copyfile-resource (in-here file) (web-path dir file)))
@ -18,10 +18,73 @@
(define (make-style dir)
(resource (web-path dir "plt.css")
(file-writer output (list the-style "\n"))
(file-writer output (list racket-style "\n"))
(lambda (url) (link rel: "stylesheet" type: "text/css"
href: url title: "default"))))
(define the-style
(define page-style
@text{
margin-left: auto;
margin-right: auto;
width: 45em;
})
(define font-style
@text{
font-family: Optima, Arial, Verdana, Helvetica, sans-serif;
})
(define navbar-style
;; All of these are made to apply only inside `racketnav', so the styles can
;; be used in places with their own CSS (eg, blog.racket-lang.org)
@text{
.racketnav {
background-color: #000;
color: #fff;
margin-bottom: 1em;
padding: 0.5em 0em;
white-space: nowrap;
}
.racketnav a {
color: #fff;
text-decoration: none;
}
.racketnav .navcontent {
@page-style
@font-style
}
.racketnav .navtitle {
font-size: xx-large;
font-weight: bold;
}
.racketnav .navitem {
text-decoration: none;
font-size: 88%;
}
.racketnav .navlink a {
padding: 0em 1em;
}
.racketnav .navcurlink a {
padding: 0em 1em;
background-color: #555;
}
.racketnav .navlink a:hover,
.racketnav .navcurlink a:hover {
background-color: #888;
}
.racketnav .navlinkcell {
text-align: center;
}
.racketnav .helpiconcell {
text-align: right;
vertical-align: top;
}
.racketnav .helpicon {
font-weight: bold;
font-size: 88%;
}
})
(define racket-style
@text{
@; ---- generic styles ----
html {
@ -30,7 +93,7 @@
body {
color: black;
background-color: white;
font-family: Optima, Arial, Verdana, Helvetica, sans-serif;
@font-style
margin: 0px;
padding: 0px;
}
@ -41,53 +104,11 @@
text-decoration: underline;
}
@; ---- content styles ----
.titlecontent, .bodycontent {
margin-left: auto;
margin-right: auto;
width: 45em;
.bodycontent {
@page-style
}
@; ---- styles for the navbar ----
.navbar {
background-color: #000;
color: #fff;
margin-bottom: 1em;
padding: 0.5em 0em;
white-space: nowrap;
}
.navbar a {
color: #fff;
text-decoration: none;
}
.navtitle {
font-size: xx-large;
font-weight: bold;
}
.navitem {
text-decoration: none;
font-size: 88%;
}
.navlink a {
padding: 0em 1em;
}
.navcurlink a {
padding: 0em 1em;
background-color: #555;
}
.navlink a:hover,
.navcurlink a:hover {
background-color: #888;
}
.navlinkcell {
text-align: center;
}
.helpiconcell {
text-align: right;
vertical-align: top;
}
.helpicon {
font-weight: bold;
font-size: 88%;
}
@navbar-style
@; ---- styles for extras ----
.parlisttitle {
margin-bottom: 0.5em;

File diff suppressed because it is too large Load Diff

View File

@ -3,3 +3,6 @@
(provide page (all-from-out "../common.rkt"))
(define+provide-context "www")
;; needed for sites that use the icon from here (eg, blog.racket-lang.org)
(provide the-resources)