port techreports page to Racket
This commit is contained in:
parent
80b6ef7dd1
commit
57d3dd7df7
|
@ -20,9 +20,13 @@
|
|||
(void) (if dir (web-path dir target) target))
|
||||
(lambda (file) (file-op source file)) referrer)))
|
||||
|
||||
(provide copyfile-resource symlink-resource)
|
||||
(define (write-to-file text file)
|
||||
(with-output-to-file file (lambda () (write-string text))))
|
||||
|
||||
(provide copyfile-resource symlink-resource content-resource)
|
||||
(define copyfile-resource (make-path-resourcer copy-file))
|
||||
(define symlink-resource (make-path-resourcer make-file-or-directory-link))
|
||||
(define content-resource (make-path-resourcer write-to-file))
|
||||
|
||||
(provide web-path)
|
||||
(define (web-path . xs)
|
||||
|
|
156
collects/meta/web/www/bib.rkt
Normal file
156
collects/meta/web/www/bib.rkt
Normal file
|
@ -0,0 +1,156 @@
|
|||
#lang at-exp s-exp "shared.rkt"
|
||||
|
||||
(require scheme/list scheme/string scheme/dict scheme/promise scheme/function)
|
||||
|
||||
;; bib values are hash tables mapping field names (symbols) to strings.
|
||||
;; Keywords can also be used for the field names, which makes them meta-fields
|
||||
;; that are not included in the usual bib printout. Two of them are required:
|
||||
;; - #:type the type of the entry (a symbol: 'article, 'techreport, etc)
|
||||
;; - #:key the label for the entry
|
||||
|
||||
(define bib-fields
|
||||
'(author editor title booktitle journal
|
||||
edition volume number series
|
||||
chapter pages
|
||||
type
|
||||
school institution organization
|
||||
publisher howpublished
|
||||
address
|
||||
month year
|
||||
key
|
||||
crossref
|
||||
url
|
||||
note
|
||||
eprint))
|
||||
|
||||
(define meta-field? keyword?)
|
||||
|
||||
(define key->number
|
||||
(let ([t (for/hash ([k bib-fields] [i (in-naturals)]) (values k i))])
|
||||
(lambda (key)
|
||||
(hash-ref t key (lambda ()
|
||||
(error 'key->number "unknown field name: ~e" key))))))
|
||||
|
||||
;; converts the hash to an alist with the order specified by bib-fields
|
||||
(define (bib->alist bib)
|
||||
(sort (filter-not (compose meta-field? car) (hash-map bib cons))
|
||||
< #:key (compose key->number car) #:cache-keys? #t))
|
||||
|
||||
(define (display* . xs)
|
||||
(for-each display xs))
|
||||
|
||||
(define (display-attr attr)
|
||||
(let* ([prefix (format " ~a = {" (car attr))]
|
||||
[sep (delay (string-append "\n" (make-string (string-length prefix)
|
||||
#\space)))])
|
||||
(display* prefix
|
||||
(if (regexp-match? #rx"\n" (cdr attr))
|
||||
(regexp-replace* #rx"\n" (cdr attr) (force sep))
|
||||
(cdr attr))
|
||||
"}")))
|
||||
|
||||
(provide display-bib)
|
||||
(define (display-bib bib)
|
||||
(display* "@" (hash-ref bib '#:type) "{" (hash-ref bib '#:key))
|
||||
(for ([attr (bib->alist bib)]) (display* ",\n") (display-attr attr))
|
||||
(display* "\n}\n"))
|
||||
|
||||
(provide with-braces without-braces)
|
||||
(define (with-braces str) (regexp-replace* #px"\\b\\w+[A-Z]\\w*" str "{\\0}"))
|
||||
(define (without-braces str) (regexp-replace* #rx"[{}]+" str ""))
|
||||
|
||||
(provide bib-author)
|
||||
(define (bib-author bib)
|
||||
(let ([authors (regexp-split #rx"[ \t\n]+and[ \t\n]+"
|
||||
(hash-ref bib 'author))])
|
||||
(case (length authors)
|
||||
[(0) "???"]
|
||||
[(1) (car authors)]
|
||||
[(2) (apply format "~a and ~a" authors)]
|
||||
[(3) (apply format "~a, ~a, and ~a" authors)]
|
||||
[else (format "~a et al" (car authors))])))
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
|
||||
;; processes the (key val ...) alist to a hash of (key . val) by combining the
|
||||
;; possibly multiple values for each key (each value becomes a line)
|
||||
(provide bib)
|
||||
(define (bib type key attrs)
|
||||
(define t (make-hasheq))
|
||||
(hash-set! t '#:type type)
|
||||
(hash-set! t '#:key key)
|
||||
(for ([a attrs])
|
||||
(define (err) (error 'make-bib "bad attribute: ~e" a))
|
||||
(unless (and (pair? a) (pair? (cdr a)) (list? (cdr a))) (err))
|
||||
(let ([key (car a)])
|
||||
(unless (hash-ref t key #f) ; previous keys take precedence
|
||||
(cond [(symbol? key)
|
||||
;; turn non-strings to strings, join multiple strings, normalize
|
||||
;; spaces
|
||||
(let* ([val (cdr a)]
|
||||
[val (map (lambda (x) (if (string? x) x (format "~a" x)))
|
||||
val)]
|
||||
[val (string-append* (add-between val "\n"))]
|
||||
[val (regexp-replace* #rx"\t" val " ")]
|
||||
[val (regexp-replace* #rx" +" val " ")]
|
||||
[val (regexp-replace #rx"^ +" val "")]
|
||||
[val (regexp-replace #rx" +$" val "")]
|
||||
[val (regexp-replace* #rx"(?: *\r?\n *)+" val "\n")])
|
||||
(hash-set! t key val))]
|
||||
[(and (meta-field? key) (null? (cddr a)))
|
||||
(hash-set! t key (cadr a))]
|
||||
[else (err)]))))
|
||||
t)
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
|
||||
#|
|
||||
In the future, it might be good to do some field verification, etc. From the
|
||||
bibtext thing:
|
||||
article: An article from a journal or magazine.
|
||||
req: author, title, journal, year
|
||||
opt: volume, number, pages, month, note
|
||||
book: A book with an explicit publisher.
|
||||
req: author or editor, title, publisher, year
|
||||
opt: volume or number, series, address, edition, month, note
|
||||
booklet: A work that is printed and bound, but without a named publisher or
|
||||
sponsoring institution.
|
||||
req: title
|
||||
opt: author, howpublished, address, month, year, note
|
||||
conference: The same as `inproceedings', included for Scribe compatibility.
|
||||
inbook: A part of a book, which may be a chapter (or section or whatever)
|
||||
and/or a range of pages.
|
||||
req: author or editor, title, chapter and/or pages, publisher, year
|
||||
opt: volume or number, series, type, address, edition, month, note
|
||||
incollection: A part of a book having its own title.
|
||||
req: author, title, booktitle, publisher, year
|
||||
opt: editor, volume or number, series, type, chapter, pages, address,
|
||||
edition, month, note
|
||||
inproceedings: An article in a conference proceedings.
|
||||
req: author, title, booktitle, year
|
||||
opt: editor, volume or number, series, pages, address, month, organization,
|
||||
publisher, note
|
||||
manual: Technical documentation.
|
||||
req: title
|
||||
opt: author, organization, address, edition, month, year, note
|
||||
mastersthesis: A Master's thesis.
|
||||
req: author, title, school, year
|
||||
opt: type, address, month, note
|
||||
misc: Use this type when nothing else fits.
|
||||
opt: author, title, howpublished, month, year, note
|
||||
phdthesis: A PhD thesis.
|
||||
req: author, title, school, year
|
||||
opt: type, address, month, note
|
||||
proceedings: The proceedings of a conference.
|
||||
req: title, year
|
||||
opt: editor, volume or number, series, address, month, organization,
|
||||
publisher, note
|
||||
techreport: A report published by a school or other institution, usually
|
||||
numbered within a series.
|
||||
req: author, title, institution, year
|
||||
opt: type, number, address, month, note
|
||||
unpublished: A document having an author and title, but not formally
|
||||
published.
|
||||
req: author, title, note
|
||||
opt: month, year
|
||||
|#
|
|
@ -87,13 +87,17 @@
|
|||
@a[href: "http://www.cs.utah.edu/~mflatt/"]{Matthew},
|
||||
@a[href: "http://www.cs.brown.edu/~sk/"]{Shriram}}})
|
||||
|
||||
(require "techreports.rkt")
|
||||
(define techreports
|
||||
@page[#:file "techreports/" #:part-of learning
|
||||
#:title "Technical Reports"
|
||||
#:extra-headers
|
||||
@meta[http-equiv: "refresh"
|
||||
content: "0;url=http://plt-scheme.org/techreports/"]]{
|
||||
TODO})
|
||||
#:title "Technical Reports"]{
|
||||
@p{PLT publishes technical reports about some of its tools and libraries so
|
||||
that scholars who wish to give proper credit to some of our innovations
|
||||
have a definite citation. Each entry below provides the full pdf and a
|
||||
bibtex entry; some of the bibtex entries provide additional citations to
|
||||
published papers.}
|
||||
|
||||
@make-bib-table{}})
|
||||
|
||||
;; redirection page for the previous name of this page
|
||||
(define outreach+research
|
||||
|
|
361
collects/meta/web/www/techreports.rkt
Normal file
361
collects/meta/web/www/techreports.rkt
Normal file
|
@ -0,0 +1,361 @@
|
|||
#lang at-exp s-exp "shared.rkt"
|
||||
|
||||
(require "bib.rkt" (prefix-in ver: version/utils)
|
||||
racket/list)
|
||||
|
||||
(provide make-bib-table)
|
||||
|
||||
(define version->date
|
||||
'#hash(["5.0" . ("2010" "May")]
|
||||
["4.2.5" . ("2010" "April")]
|
||||
["4.2.4" . ("2010" "January")]
|
||||
["4.2.3" . ("2009" "December")]
|
||||
["4.2.2" . ("2009" "October")]
|
||||
["4.2.1" . ("2009" "July")]
|
||||
["4.2" . ("2009" "June")]
|
||||
["4.1.5" . ("2009" "March")]
|
||||
["4.1.4" . ("2009" "January")]
|
||||
["4.1.3" . ("2008" "November")]
|
||||
["4.1.2" . ("2008" "October")]
|
||||
["4.1.1" . ("2008" "October")]
|
||||
["4.1" . ("2008" "August")]
|
||||
["4.0.2" . ("2008" "July")]
|
||||
["4.0.1" . ("2008" "June")]
|
||||
["4.0" . ("2008" "June")]
|
||||
["372" . ("2007" "December")]
|
||||
["371" . ("2007" "August")]
|
||||
["370" . ("2007" "May")]
|
||||
["360" . ("2006" "November")]
|
||||
["352" . ("2006" "July")]
|
||||
["351" . ("2006" "July")]
|
||||
["350" . ("2006" "June")]
|
||||
["301" . ("2006" "January")]
|
||||
["300" . ("2005" "December")]
|
||||
["209" . ("2004" "December")]
|
||||
["208" . ("2004" "August")]
|
||||
["207" . ("2004" "May")]
|
||||
["206p1" . ("2004" "January")]
|
||||
["206" . ("2004" "January")]
|
||||
["205" . ("2003" "August")]
|
||||
["204" . ("2003" "May")]
|
||||
["203" . ("2002" "December")]
|
||||
["202" . ("2002" "August")]
|
||||
["201" . ("2002" "July")]
|
||||
["200" . ("2002" "June")]
|
||||
["103p1" . ("2001" "August")]))
|
||||
|
||||
(define authors
|
||||
'([plt "PLT"]
|
||||
[mflatt "Matthew Flatt"]
|
||||
[robby "Robert Bruce Findler"]
|
||||
[ff mflatt robby]
|
||||
[fplt mflatt plt]
|
||||
[rplt robby plt]
|
||||
[ffplt ff plt]
|
||||
[ffc ff clements]
|
||||
[fb mflatt eli]
|
||||
[eli "Eli Barzilay"]
|
||||
[clements "John Clements"]
|
||||
[dorai "Dorai Sitaram"]
|
||||
[wright "Andrew K. Wright"]
|
||||
[flanagan "Cormac Flanagan"]
|
||||
[web burns gregp jaym]
|
||||
[burns "Mike Burns"]
|
||||
[jaym "Jay McCarthy"]
|
||||
[gregp "Greg Pettyjohn"]
|
||||
[dyoo "Danny Yoo"]
|
||||
[ym dyoo jaym]
|
||||
[kathyg "Kathryn E. Gray"]
|
||||
[jacobm "Jacob Matthews"]
|
||||
[sowens "Scott Owens"]
|
||||
[plot alex raymond]
|
||||
[alex "Alexander Friedman"]
|
||||
[raymond "Jamie Raymond"]
|
||||
[dskippy "Mike T. McHenry"]
|
||||
[ptg "Paul Graunke"]
|
||||
[ryanc "Ryan Culpepper"]
|
||||
[steck "Paul Steckler"]
|
||||
[samth "Sam Tobin-Hochstadt"]
|
||||
[gcooper "Greg Cooper"]))
|
||||
|
||||
(define doc-defs
|
||||
;; each item is:
|
||||
;; (docname [docnum] versions author title . attrs)
|
||||
;; docname: a symbol for the name of the document
|
||||
;; docnum: an optional integer used in the TR number (docname used otherwise)
|
||||
;; versions: version range specification (see `versions->pred' below)
|
||||
;; author: is a symbol from the `authors' table
|
||||
;; title: is a string (no braces)
|
||||
`(;; old versions
|
||||
(mzscheme 1 "...*" mflatt "PLT MzScheme: Language Manual")
|
||||
(mred 2 "...*" ff "PLT MrEd: Graphical Toolbox Manual")
|
||||
(drscheme 3 "...*" robby "PLT DrScheme: Programming Environment Manual"
|
||||
[#:note ("See also:"
|
||||
"R. B. Findler, J. Clements, C. Flanagan, M. Flatt,"
|
||||
"S. Krishnamurthi, P. Steckler and M. Felleisen."
|
||||
"DrScheme: A programming environment for Scheme,"
|
||||
"Journal of Functional Programming,"
|
||||
"12(2):159--182, March 2002."
|
||||
"http://www.ccs.neu.edu/scheme/pubs/")])
|
||||
(mzlib 4 "200...*" plt "PLT MzLib: Libraries Manual")
|
||||
(framework "...*" plt "PLT Framework: GUI Application Framework")
|
||||
(tools "...*" robby "PLT Tools: DrScheme Extension Manual")
|
||||
(web-server "300...*" web "Web Server Manual")
|
||||
(mrlib "207...*" plt "PLT MrLib: Graphical Libraries Manual")
|
||||
(plot "207...*" plot "PLoT Manual")
|
||||
(mzc "...*" plt "PLT mzc: MzScheme Compiler Manual")
|
||||
(insidemz "...*" mflatt "Inside PLT MzScheme")
|
||||
(foreign "...*" eli "PLT Foreign Interface Manual")
|
||||
(misclib "...*" plt "PLT Miscellaneous Libraries: Reference Manual")
|
||||
(tex2page "200...*" dorai "TeX2page")
|
||||
(t-y-scheme "200...*" dorai "Teach Yourself Scheme in Fixnum Days"
|
||||
[type "Introduction"])
|
||||
(match "103p1" wright "Pattern Matching for Scheme")
|
||||
(mrspidey "103p1" flanagan "PLT MrSpidey: Static Debugger Manual")
|
||||
;; new Scheme versions
|
||||
(quick "*...!" mflatt
|
||||
"Quick: An Introduction to PLT Scheme with Pictures"
|
||||
[type "Introduction"])
|
||||
(more "*...!" plt "More: Systems Programming with PLT Scheme"
|
||||
[type "Introduction"])
|
||||
;; (continue "4.1.1...!" ym "Continue: Web Applications in PLT Scheme"
|
||||
;; [type "Introduction"])
|
||||
(guide "*...!" ffplt "Guide: PLT Scheme" [type "Introduction"])
|
||||
(reference "*...!" fplt "Reference: PLT Scheme")
|
||||
(htdp-langs "*...!" plt "How to Design Programs Languages")
|
||||
(htdc "*...!" kathyg "How to Design Classes Languages")
|
||||
(teachpack "*...!" plt "Teachpacks")
|
||||
(eopl "*...!" plt "Essentials of Programming Languages Language")
|
||||
(drscheme "*...!" rplt "DrScheme: PLT Programming Environment")
|
||||
(mzc "*...!" plt "mzc: PLT Compilation and Packaging")
|
||||
(setup-plt "*...!" plt "setup-plt: PLT Configuration and Installation")
|
||||
(planet "*...!" jacobm "PLaneT: Automatic Package Distribution")
|
||||
(redex "4.1...!" robby "Redex: Debugging Operational Semantics")
|
||||
(scribble "*...!" fb "Scribble: PLT Documentation Tool")
|
||||
(slideshow "*...!" ff "Slideshow: PLT Figure and Presentation Tools")
|
||||
(web-server "*...!" jaym "Web Server: PLT HTTP Server")
|
||||
(tools "*...!" robby "Plugins: Extending DrScheme")
|
||||
(gui "*...!" ffc "GUI: PLT Graphics Toolkit")
|
||||
(framework "*...!" ff "Framework: PLT GUI Application Framework")
|
||||
(sgl "*...!" sowens "GL: 3-D Graphics")
|
||||
(plot "*...!" plot "PLoT: Graph Plotting")
|
||||
(browser "*...!" plt "Browser: Simple HTML Rendering")
|
||||
(cards "*...!" plt "Cards: Virtual Playing Cards Library")
|
||||
(embedded-gui "*...!" dskippy "Embedded GUI: Widgets within editor<%>")
|
||||
(games "*...!" plt "Games: Fun Examples")
|
||||
(gl-board-game "*...!" plt "GL Board Game: 3-D Game Support")
|
||||
(mrlib "*...!" plt "MrLib: Extra GUI Libraries")
|
||||
(string-constants "*...!" plt "String Constants: GUI Internationalization")
|
||||
(syntax-color "*...!" sowens "Syntax Color: Utilities")
|
||||
(turtles "*...!" plt "Turtle Graphics")
|
||||
(net "*...!" plt "Net: PLT Networking Libraries")
|
||||
(openssl "*...!" plt "OpenSSL")
|
||||
(file "*...!" plt "File: PLT File Format Libraries")
|
||||
(html "*...!" plt "HTML: Parsing Library")
|
||||
(parser-tools "*...!" sowens "Parser Tools: lex and yacc-style Parsing")
|
||||
(xml "*...!" ptg "XML: Parsing and Writing")
|
||||
(config "*...!" plt "Config: Installation and Search Paths")
|
||||
(dynext "*...!" plt "Dynext: Running a C Compiler/Linker")
|
||||
(errortrace "*...!" plt "Errortrace: Debugging and Profiling")
|
||||
(macro-debugger "*...!" ryanc "Macro Debugger")
|
||||
(make "*...!" plt "Make: Dependency Manager")
|
||||
(readline "*...!" plt "Readline: Terminal Interaction")
|
||||
(slatex-wrap "*...!" plt "SLaTeX Wrapper")
|
||||
(trace "*...!" plt "Trace: Instrumentation to Show Function Calls")
|
||||
(version "*...!" plt "Version: PLT Version Checking")
|
||||
(foreign "*...!" eli "FFI: PLT Scheme Foreign Interface")
|
||||
(inside "*...!" mflatt "Inside: PLT Scheme C API")
|
||||
(cffi "*...!" mflatt "c-lambda: C FFI via mzc")
|
||||
(mysterx "*...!" steck "MysterX: Using Windows COM Objects in Scheme")
|
||||
(mzcom "*...!" steck "MzCOM: Scheme as a Windows COM Object")
|
||||
(srfi "*...!" plt "SRFIs: Libraries")
|
||||
(htdp-lib "*...!" plt "HtDP: Languages as Libraries")
|
||||
(swindle "*...!" plt "Swindle")
|
||||
(syntax "*...!" plt "Syntax: Meta-Programming Helpers")
|
||||
(typed-scheme "*...!" samth "Typed Scheme: Scheme with Static Types")
|
||||
(frtime "*...!" gcooper "FrTime: A Language for Reactive Programs")
|
||||
(lazy "*...!" eli "Lazy Scheme")
|
||||
(r5rs "*...!" plt "R5RS: Legacy Standard Language"
|
||||
[#:note ("See also:"
|
||||
"Rickard Kelsey and William Clinger"
|
||||
"and Jonathan Rees (Editors)"
|
||||
"Revised$^5$ Report of the Algorithmic Language Scheme"
|
||||
"ACM SIGPLAN Notices"
|
||||
"33(9):26--76, 1998")])
|
||||
(graphics "*...!" plt "Graphics: Legacy Library")
|
||||
(mzlib "*...!" plt "MzLib: Legacy PLT Libraries")
|
||||
(preprocessor "*...!" eli "mzpp and mztext: Preprocessors")
|
||||
(mzscheme "*...!" plt "MzScheme: Legacy Module Language")
|
||||
(algol60 "*...!" plt "Algol 60")
|
||||
(honu "*...!" plt "Honu")
|
||||
(test-box-recovery "*...!" plt "Test Box Recovery Tool")
|
||||
|
||||
;; Racket versions
|
||||
(quick "+..." mflatt
|
||||
"Quick: An Introduction to Racket with Pictures"
|
||||
[type "Introduction"])
|
||||
(more "+..." plt "More: Systems Programming with Racket"
|
||||
[type "Introduction"])
|
||||
(guide "+..." ffplt "Guide: Racket" [type "Introduction"])
|
||||
(reference "+..." fplt "Reference: Racket")
|
||||
(drracket "+..." rplt "DrRacket: Programming Environment")
|
||||
(scribble "+..." fb "Scribble: Racket Documentation Tool")
|
||||
(slideshow "+..." ff "Slideshow: Racket Figure and Presentation Tools")
|
||||
(web-server "+..." jaym "Web Server: Racket HTTP Server")
|
||||
(foreign "+..." eli "FFI: Racket Foreign Interface")
|
||||
(inside "+..." mflatt "Inside: Racket C API")
|
||||
|
||||
|
||||
;; Both Scheme and Racket
|
||||
(r6rs "*..." plt "R6RS: Standard Language"
|
||||
[#:note ("See also:"
|
||||
"Michael Sperber and R. Kent Dybvig and Matthew Flatt"
|
||||
"and Anton Van Straaten (Editors)"
|
||||
"Revised$^6$ Report of the Algorithmic Language Scheme"
|
||||
"September 2007")])
|
||||
|
||||
;; (article fcffksf:drscheme
|
||||
;; [author "Robert Bruce Findler and John Clements and Cormac Flanagan"
|
||||
;; "and Matthew Flatt and Shriram Krishnamurthi"
|
||||
;; "and Paul Steckler and Matthias Felleisen"]
|
||||
;; [title "{DrScheme}: A Programming Environment for {Scheme}"]
|
||||
;; [volume 12]
|
||||
;; [number 2]
|
||||
;; [pages "159--182"]
|
||||
;; [month "March"]
|
||||
;; [journal "Journal of Functional Programming"]
|
||||
;; [year "2002"])
|
||||
))
|
||||
|
||||
(define version->integer
|
||||
(let ([t (for/hash ([(v d) (in-hash version->date)])
|
||||
(values v (ver:version->integer v)))])
|
||||
(lambda (ver)
|
||||
(hash-ref t ver (lambda ()
|
||||
(error 'version->integer
|
||||
"unknown pltreport version: ~e" ver))))))
|
||||
|
||||
(define versions
|
||||
(sort (hash-map version->date (lambda (v d) v))
|
||||
> #:key version->integer #:cache-keys? #t))
|
||||
|
||||
;; "V...V" version range
|
||||
;; "...V", "V..." open-ended version range
|
||||
;; "..." all versions
|
||||
;; "V" specific version
|
||||
;; "" no versions
|
||||
;; V can be `*' which is a number between the v3 docs and the v4 docs
|
||||
;; V can be `!' which is the last PLT Scheme version
|
||||
;; V can be `+' which is the first Racket version
|
||||
(define middle-version (ver:version->integer "379"))
|
||||
(define last-scheme-version (ver:version->integer "4.2.5"))
|
||||
(define first-racket-version (ver:version->integer "5.0"))
|
||||
(define (versions->pred str)
|
||||
(let* ([str (regexp-replace* #rx" +" str " ")]
|
||||
[str (regexp-replace #rx"^ +" str "")]
|
||||
[str (regexp-replace #rx" +$" str "")]
|
||||
[l (regexp-split #rx" *[.][.][.] *" str)]
|
||||
[l (map (lambda (x)
|
||||
(cond [(equal? "" x) #f]
|
||||
[(equal? "*" x) middle-version]
|
||||
[(equal? "!" x) last-scheme-version]
|
||||
[(equal? "+" x) first-racket-version]
|
||||
[(version->integer x)]
|
||||
[else (error 'versions->pred "bad version: ~e" x)]))
|
||||
l)])
|
||||
(apply
|
||||
(case-lambda [(ver)
|
||||
(if ver
|
||||
(lambda (v) (equal? ver (version->integer v)))
|
||||
(lambda (v) #f))]
|
||||
[(from to)
|
||||
(let ([from (or from -inf.0)]
|
||||
[to (or to +inf.0)])
|
||||
(lambda (ver) (<= from (version->integer ver) to)))]
|
||||
[_ (error 'versions->pred "bad versions spec: ~e" str)])
|
||||
l)))
|
||||
|
||||
(define authors*
|
||||
(let ([t (make-hasheq)])
|
||||
(for ([a authors])
|
||||
(hash-set! t (car a)
|
||||
((if (and (= 2 (length a)) (string? (cadr a))) cadr cdr) a)))
|
||||
t))
|
||||
|
||||
(define (author->string author)
|
||||
(let ([r (hash-ref authors* author)])
|
||||
(if (string? r)
|
||||
r
|
||||
(let ([r (apply string-append
|
||||
(add-between (map author->string r) " and "))])
|
||||
(hash-set! authors* author r)
|
||||
r))))
|
||||
|
||||
(define doc-defs*
|
||||
(for/list ([d doc-defs])
|
||||
(apply
|
||||
(lambda (docname docnum versions author title . attrs)
|
||||
`(,(versions->pred versions)
|
||||
[#:docname ,docname]
|
||||
[#:number-template ,(format "PLT-TR~~a-~a-v~~a" (or docnum docname))]
|
||||
[title ,(with-braces title)]
|
||||
[author ,(author->string author)]
|
||||
,@attrs))
|
||||
(if (number? (cadr d)) d (list* (car d) #f (cdr d))))))
|
||||
|
||||
(define (url s) s)
|
||||
|
||||
(define bibs
|
||||
(for*/list ([ver versions] [doc doc-defs*] #:when ((car doc) ver))
|
||||
(define attrs (cdr doc))
|
||||
(define (get key [dflt #f]) (cond [(assq key attrs) => cadr] [else dflt]))
|
||||
(define docname (get '#:docname))
|
||||
(define-values (year month) (apply values (hash-ref version->date ver)))
|
||||
(define number (format (get '#:number-template) year ver))
|
||||
(define key (regexp-replace* #rx":" (string-downcase number) "_"))
|
||||
(define note
|
||||
(let ([n1 "\\url{http://plt-scheme.org/techreports/}"]
|
||||
[n2 (get '#:note #f)])
|
||||
(if n2 (cons (string-append n1 ";") n2) (list n1))))
|
||||
(define old? (< (ver:version->integer ver) first-racket-version))
|
||||
(define site (if old? "plt-scheme" "racket-lang"))
|
||||
(define maybe-s (if old? "" "s"))
|
||||
(define (url* path)
|
||||
(url (format (string-append "http://download." site ".org/doc" maybe-s "/~a/" path) ver docname)))
|
||||
(define pdf-url (url* "pdf/~a.pdf"))
|
||||
(define pdf-html (url* "html/~a/"))
|
||||
(bib 'techreport key
|
||||
`(,@attrs
|
||||
[year ,year]
|
||||
[month ,month]
|
||||
[institution "PLT Scheme Inc."]
|
||||
[type "Reference Manual"]
|
||||
[number ,number]
|
||||
[#:version ,ver]
|
||||
[url ,pdf-url]
|
||||
[#:pdf-url ,pdf-url]
|
||||
[#:html-url ,pdf-html]
|
||||
[note ,@note]))))
|
||||
|
||||
(define (make-bib-file bib)
|
||||
(let ([file (format "~a.txt"
|
||||
(regexp-replace* #rx":" (hash-ref bib '#:key) "_"))])
|
||||
(content-resource
|
||||
(parameterize ([current-output-port (open-output-string)])
|
||||
(display-bib bib)
|
||||
(get-output-string (current-output-port)))
|
||||
(web-path "www" "techreports" file))
|
||||
file))
|
||||
|
||||
(define (make-bib-table)
|
||||
(apply table width: "98%" cellspacing: 0 cellpadding: 6 border: 0
|
||||
align: 'center style: "font-size: 75%;"
|
||||
(for/list ([bib bibs] [n (in-naturals)])
|
||||
@tr[valign: 'top bgcolor: (if (even? n) "#e0e0e0" "white")]{
|
||||
@td[style: "white-space: nowrap;"]{@(hash-ref bib 'number)}
|
||||
@td[align: 'left]{@i{@(without-braces (hash-ref bib 'title))}}
|
||||
@td{@(bib-author bib)}
|
||||
@td{@a[href: (url (make-bib-file bib))]{[bib]}@|nbsp|@;
|
||||
@a[href: (hash-ref bib '#:pdf-url)]{[pdf]}@|nbsp|@;
|
||||
@a[href: (hash-ref bib '#:html-url)]{[html]}}})))
|
||||
|
Loading…
Reference in New Issue
Block a user