#lang syntax coloring; Scribble syntax coloring

svn: r15607

original commit: 1ba7cf0926a46122d7f759a2dccf086e2ba939a9
This commit is contained in:
Matthew Flatt 2009-07-28 18:06:14 +00:00
parent feaf24cd36
commit 5d62e4e005
9 changed files with 46 additions and 8 deletions

View File

@ -259,6 +259,7 @@
(->* () () #:rest (listof pre-content?) element?))
(provide/contract
[linebreak (-> element?)]
[hspace (-> exact-nonnegative-integer? element?)]
[elem (->* ()
(#:style element-style?)
@ -291,6 +292,9 @@
h))
(make-element 'hspace (list (make-string n #\space)))))
(define (linebreak)
(make-element 'newline '("\n")))
(define (elem #:style [style plain] . str)
(make-element style (decode-content str)))

View File

@ -6,5 +6,10 @@ scribble/base/lang
#:read-syntax scribble:read-syntax-inside
#:whole-body-readers? #t
#:wrapper1 (lambda (t) (list* 'doc 'values '() (t)))
#:info (lambda (key default)
(case key
[(color-lexer)
(dynamic-require 'syntax-color/scribble-lexer 'scribble-inside-lexer)]
[else (default key)]))
(require (prefix-in scribble: "../../reader.ss"))

View File

@ -1,3 +1,11 @@
#lang scheme/base
(require (prefix-in doc: scribble/doc/reader))
(provide (rename-out [doc:read read] [doc:read-syntax read-syntax]))
(provide (rename-out [doc:read read] [doc:read-syntax read-syntax])
get-info)
(define (get-info . args)
(lambda (key)
(case key
[(color-lexer)
(dynamic-require 'syntax-color/scribble-lexer 'scribble-inside-lexer)]
[else #f])))

View File

@ -6,5 +6,10 @@ scribble/manual/lang
#:read-syntax scribble:read-syntax-inside
#:whole-body-readers? #t
#:wrapper1 (lambda (t) (cons 'doc (t)))
#:info (lambda (key default)
(case key
[(color-lexer)
(dynamic-require 'syntax-color/scribble-lexer 'scribble-inside-lexer)]
[else (default key)]))
(require (prefix-in scribble: "../../reader.ss"))

View File

@ -47,6 +47,7 @@
(struct-out var-id)
(struct-out shaped-parens)
(struct-out just-context)
(struct-out alternate-display)
(struct-out literal-syntax)
(for-syntax make-variable-id
variable-id?
@ -178,11 +179,12 @@
(memq (syntax-e c) (current-variable-list)))]
[(s it? sub?)
(let ([sc (syntax-e c)])
(let ([s (format "~s" (if (literal-syntax? sc)
(literal-syntax-stx sc)
(if (var-id? sc)
(var-id-sym sc)
sc)))])
(let ([s (or (syntax-property c 'display-string)
(format "~s" (if (literal-syntax? sc)
(literal-syntax-stx sc)
(if (var-id? sc)
(var-id-sym sc)
sc))))])
(if (and (symbol? sc)
((string-length s) . > . 1)
(char=? (string-ref s 0) #\_)
@ -763,6 +765,7 @@
(define-struct var-id (sym))
(define-struct shaped-parens (val shape))
(define-struct just-context (val ctx))
(define-struct alternate-display (id string))
(define-struct literal-syntax (stx))
(define-struct graph-reference (bx))
@ -792,6 +795,11 @@
s
s
(just-context-ctx v)))]
[(alternate-display? v)
(let ([s (do-syntax-ize (alternate-display-id v) col line ht #f)])
(syntax-property s
'display-string
(alternate-display-string v)))]
[(hash-ref (unbox ht) v #f)
=> (lambda (m)
(unless (unbox m)

View File

@ -6,5 +6,10 @@ scribble/sigplan/lang
#:read-syntax scribble:read-syntax-inside
#:whole-body-readers? #t
#:wrapper1 (lambda (t) (cons 'doc (t)))
#:info (lambda (key default)
(case key
[(color-lexer)
(dynamic-require 'syntax-color/scribble-lexer 'scribble-inside-lexer)]
[else (default key)]))
(require (prefix-in scribble: "../../reader.ss"))

View File

@ -272,6 +272,9 @@ gets progressively larger.}
@defproc[(emph [pre-content pre-content?] ...) element?]{
The same as @scheme[italic].}
@defproc[(linebreak) element?]{
Produces an element that forces a line break.}
@defproc[(hspace [n exact-nonnegative-integer?]) element?]{
Produces an element containing @scheme[n] spaces and style

View File

@ -60,7 +60,7 @@ in the case of Latex).
To add a mapping from your own style name to a CSS configuration, add
a @scheme[css-addition] structure instance to a style's @tech{style property}
list. To map a style name to a Latex macro or environment, add a
scheme[tex-addition] structure instance. A @scheme[css-addition] or
@scheme[tex-addition] structure instance. A @scheme[css-addition] or
@scheme[tex-addition] is normally associated with the style whose name
is implemented by the adition, but it can also be added to the style
for an enclosing part.

View File

@ -167,7 +167,7 @@ needed.
@{blah @|foo|: blah}
}===|
Actually, the command part can be any Scheme expression (that does
Actually, the command part can be any Scheme expression (that does not
start with @litchar["["], @litchar["{"], or @litchar["|"]), which is
particularly useful with such escapes since they can be used with any
expression.