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.
This commit is contained in:
Eli Barzilay 2010-10-26 05:20:02 -04:00
parent 2491ac914c
commit 7ac83e25c9
3 changed files with 15 additions and 11 deletions

View File

@ -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 ...)))

View File

@ -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))

View File

@ -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