From 58febe21a02ff7c7447ee75bf5edd34c99ee6f1c Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 28 Oct 2010 17:27:30 -0400 Subject: [PATCH] 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. --- collects/meta/web/common/extras.rkt | 2 +- collects/meta/web/common/layout.rkt | 3 +-- collects/meta/web/common/links.rkt | 2 +- collects/meta/web/common/resources.rkt | 2 +- collects/scribble/html/lang.rkt | 17 +++++------------ collects/scribble/html/main.rkt | 12 +++++++++++- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/collects/meta/web/common/extras.rkt b/collects/meta/web/common/extras.rkt index 021d377d25..e3ec31be9c 100644 --- a/collects/meta/web/common/extras.rkt +++ b/collects/meta/web/common/extras.rkt @@ -1,6 +1,6 @@ #lang at-exp racket/base -(require scribble/html (only-in scribble/html/lang #%top)) +(require scribble/html) ;; list of a header paragraphs and sub paragraphs (don't use `p' since it looks ;; like they should not be nested) diff --git a/collects/meta/web/common/layout.rkt b/collects/meta/web/common/layout.rkt index ab1e8bdd00..7235e9383b 100644 --- a/collects/meta/web/common/layout.rkt +++ b/collects/meta/web/common/layout.rkt @@ -1,7 +1,6 @@ #lang at-exp racket/base -(require scribble/html (only-in scribble/html/lang #%top) - (for-syntax racket/base syntax/name) +(require scribble/html (for-syntax racket/base syntax/name) "utils.rkt" "resources.rkt") (define-for-syntax (process-contents who layouter stx xs) diff --git a/collects/meta/web/common/links.rkt b/collects/meta/web/common/links.rkt index fb11bed26f..5bb5ed731c 100644 --- a/collects/meta/web/common/links.rkt +++ b/collects/meta/web/common/links.rkt @@ -1,6 +1,6 @@ #lang at-exp racket/base -(require scribble/html (only-in scribble/html/lang #%top)) +(require scribble/html) (define-syntax-rule (define* id E) (begin (define id E) (provide id))) diff --git a/collects/meta/web/common/resources.rkt b/collects/meta/web/common/resources.rkt index 9e963a3f24..5d3cee02b5 100644 --- a/collects/meta/web/common/resources.rkt +++ b/collects/meta/web/common/resources.rkt @@ -1,6 +1,6 @@ #lang at-exp racket/base -(require scribble/html (only-in scribble/html/lang #%top)) +(require scribble/html) ;; These are some resources that are shared across different toplevel ;; sites. They could be included from a single place, but then when one diff --git a/collects/scribble/html/lang.rkt b/collects/scribble/html/lang.rkt index 258dd15f9b..3caefb4a32 100644 --- a/collects/scribble/html/lang.rkt +++ b/collects/scribble/html/lang.rkt @@ -1,20 +1,13 @@ #lang racket/base -(require "main.rkt" scribble/text/lang scribble/text/syntax-utils - (for-syntax racket/base)) +(require "main.rkt" (except-in scribble/text/lang #%top) + scribble/text/syntax-utils) -(provide (except-out (all-from-out scribble/text/lang) #%top #%module-begin) - (rename-out [top #%top] [module-begin #%module-begin]) +(provide (except-out (all-from-out scribble/text/lang) #%module-begin) + (rename-out [module-begin #%module-begin]) (all-from-out "main.rkt")) -(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)))])) - +(require (for-syntax racket/base)) (define-syntax-rule (module-begin expr ...) (#%plain-module-begin (port-count-lines! (current-output-port)) diff --git a/collects/scribble/html/main.rkt b/collects/scribble/html/main.rkt index 0ab3b2aa69..789c4fe3cc 100644 --- a/collects/scribble/html/main.rkt +++ b/collects/scribble/html/main.rkt @@ -4,4 +4,14 @@ ;; includes all of the scribble/text utilities 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)))]))