Make the scribble/html' layout mimic the one for scribble/text'.

Ie, the difference between using it as a language and as a module is now
the same in both.  Also, improve `scribble/html' (and
`scribble/html/htmllang') by reproviding most of the corresponding text
modules.

Change `meta/web' accordingly, and improve code by making a new langugae
(`#lang meta/web').  This language is similar to `scribble/html' except
that it uses the plain scribble reader (not the `-inside' one), it
doesn't use the customized module-begin feature (that uses
`output-xml'), and it adds all the relevant bits of `meta/web/common'.
(Also, "meta/web/common.rkt" is gone, since it's used only as a language
now.)

This commit has lots of details and binding games, so it's tricky, and
potentially caused some problems.  (Took me a while to track many
breakages, so I won't be surprised if there are more.)

original commit: 82221a51db9648d74caef31837b1f00b4e9d5773
This commit is contained in:
Eli Barzilay 2010-10-26 15:36:29 -04:00
parent a89b7b0608
commit 0bb6cd944a
5 changed files with 39 additions and 31 deletions

View File

@ -0,0 +1,22 @@
#lang racket/base
(require "main.rkt" scribble/text/textlang scribble/text/syntax-utils
(for-syntax racket/base))
(provide (except-out (all-from-out scribble/text/textlang)
#%top #%module-begin)
(rename-out [top #%top] [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)))]))
(define-syntax-rule (module-begin expr ...)
(#%plain-module-begin
(port-count-lines! (current-output-port))
(process-begin/text begin output-xml expr ...)))

View File

@ -1,27 +1,7 @@
#lang racket/base
(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 and an `include' alias
(rename-out [begin/text text] [include/text include])
;; main functionality
(all-from-out "xml.rkt" "html.rkt" "resource.rkt"
racket/list racket/string))
(require "xml.rkt" "html.rkt" "resource.rkt"
;; includes all of the scribble/text utilities
scribble/text)
(require "xml.rkt" "html.rkt" "resource.rkt" racket/list racket/string
scribble/text scribble/text/syntax-utils (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)))]))
(define-syntax-rule (module-begin expr ...)
(#%plain-module-begin
(port-count-lines! (current-output-port))
(process-begin/text begin output-xml expr ...)))
(provide (all-from-out "xml.rkt" "html.rkt" "resource.rkt" scribble/text))

View File

@ -1,5 +1,4 @@
#lang racket/base
(require racket/promise "text/output.ss" "text/syntax-utils.ss")
(provide (all-from-out racket/promise "text/output.ss")
begin/text include/text)
(require "text/main.rkt")
(provide (all-from-out "text/main.rkt"))

View File

@ -0,0 +1,7 @@
#lang racket/base
(require "output.ss" "syntax-utils.ss"
racket/promise racket/list racket/string)
(provide (all-from-out "output.ss" racket/promise racket/list racket/string)
begin/text include/text)

View File

@ -1,9 +1,9 @@
#lang racket/base
(require "syntax-utils.ss" "output.ss" racket/promise)
(require "syntax-utils.ss" "output.ss"
racket/promise racket/list racket/string)
(provide (except-out (all-from-out racket/base) #%module-begin)
(all-from-out "output.ss" racket/promise)
begin/text
(all-from-out "output.ss" racket/promise racket/list racket/string)
(rename-out [module-begin/text #%module-begin]
[include/text include]))
[begin/text text] [include/text include]))