Move the #%top' binding that makes foo:' keywords self evaluating from

`scribble/html/lang' to `scribble/html'.

Since `foo:' keywords are very common in any code that uses
`scribble/html', it is much more convenient to have it provide the
custom `#%top'.  It simplifies code that uses it, for example, files in
`meta/web/common' now use

  #lang at-exp racket/base
  (require scribble/html)

instead of the (only-in scribble/html/lang #%top) which it used before,
or instead of explicitly quoting all `foo:'s.

original commit: 58febe21a02ff7c7447ee75bf5edd34c99ee6f1c
This commit is contained in:
Eli Barzilay 2010-10-28 17:27:30 -04:00
parent 25c310b0dc
commit 688bb59c1a
2 changed files with 16 additions and 13 deletions

View File

@ -1,20 +1,13 @@
#lang racket/base #lang racket/base
(require "main.rkt" scribble/text/lang scribble/text/syntax-utils (require "main.rkt" (except-in scribble/text/lang #%top)
(for-syntax racket/base)) scribble/text/syntax-utils)
(provide (except-out (all-from-out scribble/text/lang) #%top #%module-begin) (provide (except-out (all-from-out scribble/text/lang) #%module-begin)
(rename-out [top #%top] [module-begin #%module-begin]) (rename-out [module-begin #%module-begin])
(all-from-out "main.rkt")) (all-from-out "main.rkt"))
(define-syntax (top stx) (require (for-syntax racket/base))
(syntax-case stx ()
[(_ . x)
(let ([x* (syntax-e #'x)])
(if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*)))
#''x
#'(#%top . x)))]))
(define-syntax-rule (module-begin expr ...) (define-syntax-rule (module-begin expr ...)
(#%plain-module-begin (#%plain-module-begin
(port-count-lines! (current-output-port)) (port-count-lines! (current-output-port))

View File

@ -4,4 +4,14 @@
;; includes all of the scribble/text utilities ;; includes all of the scribble/text utilities
scribble/text) scribble/text)
(provide (all-from-out "xml.rkt" "html.rkt" "resource.rkt" scribble/text)) (provide (all-from-out "xml.rkt" "html.rkt" "resource.rkt" scribble/text)
(rename-out [top #%top]))
(require (for-syntax racket/base))
(define-syntax (top stx)
(syntax-case stx ()
[(_ . x)
(let ([x* (syntax-e #'x)])
(if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*)))
#''x
#'(#%top . x)))]))