commit 1013d7841503b5d9354ff109933b8a7e89d4638f
parent 47d955917b8d544b19d59023b9255e18e78fa531
Author: Eli Barzilay <eli@barzilay.org>
Date: Tue, 26 Oct 2010 05:20:02 -0400
Provide `process-begin/text' to make it convenient to define more
`scribble/text'-like languages. Use it to define a convenient syntax
for html modules.
This is not used by the web content files since they define functions
rather than spit out html when required, but makes it convenient to make
an html markup language similar to scribble/text.
original commit: 7ac83e25c90c4d05b9e9e39be678b32790e94f31
Diffstat:
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/collects/meta/web/html/main.rkt b/collects/meta/web/html/main.rkt
@@ -1,16 +1,16 @@
#lang racket/base
-(provide (except-out (all-from-out racket/base) #%top)
- (rename-out [top #%top])
- ;; to be used as a text language
+(provide (except-out (all-from-out racket/base) #%top #%module-begin)
+ (rename-out [top #%top] [module-begin #%module-begin])
+ ;; to be used as a text language (output via `output-xml')
(all-from-out scribble/text)
- ;; provide a `text' alias
- (rename-out [begin/text text])
+ ;; provide a `text' alias and an `include' alias
+ (rename-out [begin/text text] [include/text include])
;; main functionality
(all-from-out "xml.rkt" "html.rkt" "resource.rkt"))
(require "xml.rkt" "html.rkt" "resource.rkt"
- scribble/text (for-syntax racket/base))
+ scribble/text scribble/text/syntax-utils (for-syntax racket/base))
(define-syntax (top stx)
(syntax-case stx ()
@@ -19,3 +19,8 @@
(if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*)))
#''x
#'(#%top . x)))]))
+
+(define-syntax-rule (module-begin expr ...)
+ (#%plain-module-begin
+ (port-count-lines! (current-output-port))
+ (process-begin/text begin output-xml expr ...)))
diff --git a/collects/scribble/text/lang/reader.rkt b/collects/scribble/text/lang/reader.rkt
@@ -7,6 +7,5 @@ scribble/text/textlang
#:whole-body-readers? #t
#:info (scribble-base-reader-info)
-(require (prefix-in scribble: "../../reader.ss")
- (only-in scribble/base/reader
- scribble-base-reader-info))
+(require (prefix-in scribble: scribble/reader)
+ (only-in scribble/base/reader scribble-base-reader-info))
diff --git a/collects/scribble/text/syntax-utils.rkt b/collects/scribble/text/syntax-utils.rkt
@@ -2,8 +2,8 @@
(require "output.ss" (for-syntax scheme/base syntax/kerncase))
-(provide module-begin/text begin/text include/text
- begin/collect)
+(provide module-begin/text begin/text include/text begin/collect
+ process-begin/text)
(begin-for-syntax
(define definition-ids ; ids that don't require forcing