support documentation for bindings from a hypothetical module, as opposed to a specific module

svn: r8663
This commit is contained in:
Matthew Flatt 2008-02-14 16:59:26 +00:00
parent ca1a9dc8bf
commit b87d9a986e
5 changed files with 55 additions and 26 deletions

View File

@ -116,6 +116,6 @@
(parameterize ([current-namespace (namespace-anchor->empty-namespace (parameterize ([current-namespace (namespace-anchor->empty-namespace
anchor)]) anchor)])
(set! generate-search-results (set! generate-search-results
(dynamic-require 'help/search 'generate-search-results)))) (dynamic-require 'help/search 'perform-search))))
(generate-search-results strs)) (generate-search-results strs))

View File

@ -256,13 +256,10 @@
;; String String *-> Element ;; String String *-> Element
;; an in-lined image, relative to the current directory ;; an in-lined image, relative to the current directory
(define (image filename-relative-to-source . alt) (define (image filename-relative-to-source . alt)
(centerline ;; this doesn't do anything?
(make-element (make-element
(make-image-file filename-relative-to-source) (make-image-file filename-relative-to-source)
(decode-content alt)))) (decode-content alt)))
;; MF! -- the centerline is used in the drscheme manual
;; otherwise I'd switch
(define (image/plain filename-relative-to-source . alt) (define (image/plain filename-relative-to-source . alt)
(make-element (make-element
(make-image-file filename-relative-to-source) (make-image-file filename-relative-to-source)
@ -376,7 +373,8 @@
checker))))]) checker))))])
(and (checker id) (and (checker id)
lib))) lib)))
source-libs) (or source-libs
null))
(and (pair? libs) (and (pair? libs)
(car libs)))]) (car libs)))])
(and lib (and lib
@ -571,10 +569,23 @@
schemegrammar schemegrammar* schemegrammar schemegrammar*
var svar void-const undefined-const) var svar void-const undefined-const)
(define-syntax declare-exporting (define-syntax (declare-exporting stx)
(syntax-rules () (syntax-case stx ()
[(_ lib ... #:use-sources (plib ...)) (*declare-exporting '(lib ...) '(plib ...))] [(_ lib ... #:use-sources (plib ...))
[(_ lib ...) (*declare-exporting '(lib ...) '())])) (let ([libs (syntax->list #'(lib ... plib ...))])
(for-each (lambda (l)
(unless (module-path? (syntax->datum l))
(raise-syntax-error #f
"not a module path"
stx
l)))
libs)
(when (null? libs)
(raise-syntax-error #f
"need at least one module path"
stx))
#'(*declare-exporting '(lib ...) '(plib ...)))]
[(_ lib ...) #'(*declare-exporting '(lib ...) '())]))
(define-struct (exporting-libraries element) (libs source-libs)) (define-struct (exporting-libraries element) (libs source-libs))
@ -585,9 +596,10 @@
(make-collect-element #f (make-collect-element #f
null null
(lambda (ri) (lambda (ri)
(collect-put! ri '(exporting-libraries #f) libs)))) (collect-put! ri '(exporting-libraries #f)
libs))))
(make-part-collect-decl (make-part-collect-decl
(make-exporting-libraries #f null libs source-libs))))) (make-exporting-libraries #f null (and (pair? libs) libs) source-libs)))))
(define-syntax (quote-syntax/loc stx) (define-syntax (quote-syntax/loc stx)
(syntax-case stx () (syntax-case stx ()

View File

@ -209,13 +209,13 @@ Like @scheme[defmodule], but documents @scheme[id] as a module path
suitable for use by either @scheme[require] or @schememodfont{#lang}.} suitable for use by either @scheme[require] or @schememodfont{#lang}.}
@defform[(defmodule* (id ...) maybe-sources pre-flow ...)]{ @defform[(defmodule* (id ...+) maybe-sources pre-flow ...)]{
Like @scheme[defmodule], but introduces multiple module paths instead Like @scheme[defmodule], but introduces multiple module paths instead
of just one.} of just one.}
@defform[(defmodulelang* (id ...) maybe-sources pre-flow ...)]{ @defform[(defmodulelang* (id ...+) maybe-sources pre-flow ...)]{
Like @scheme[defmodulelang], but introduces multiple module paths Like @scheme[defmodulelang], but introduces multiple module paths
instead of just one.} instead of just one.}
@ -267,6 +267,13 @@ declaration:
} }
The initial @scheme[mod-path]s sequence can be empty if
@scheme[mod-path]s are given with @scheme[#:use-sources]. In that
case, the rendered documentation never reports an exporting module for
identifiers that are documented within the section, but the
@scheme[mod-path]s in @scheme[#:use-sources] provide a binding context
for connecting (via hyperlinks) definitions and uses of identifiers.
The @scheme[declare-exporting] form should be used no more than once The @scheme[declare-exporting] form should be used no more than once
per section, since the declaration applies to the entire section, per section, since the declaration applies to the entire section,
although overriding @scheme[declare-exporting] forms can appear in although overriding @scheme[declare-exporting] forms can appear in
@ -862,12 +869,22 @@ combination of @scheme[envvar] and @scheme[as-index].}
@; ------------------------------------------------------------------------ @; ------------------------------------------------------------------------
@section{Images} @section{Images}
@defproc[(image [filename-relative-to-source string?]) element?]{ @defproc[(image [filename-relative-to-source string?]
creates a centered image, from the given relative source path.} [pre-element any/c] ...)
flow-element?]{
Creates a centered image from the given relative source path. The
@tech{decode}d @scheme[pre-content] serves as the alternate text for
contexts where the image cannot be displayed.
@defproc[(image/plain [filename-relative-to-source string?]) element?]{ The path is relative to the current directory, which is set by
creates an in-lined image, from the given relative source path.} @exec{setup-plt} and @exec{scribble} to the directory of the main
document file.}
@defproc[(image/plain [filename-relative-to-source string?]
[pre-element any/c] ...)
element?]{
Like @scheme[image], but the result is an element to appear inline in
a paragraph.}
@; ------------------------------------------------------------------------ @; ------------------------------------------------------------------------
@section{Bibliography} @section{Bibliography}

View File

@ -12,17 +12,17 @@ is different and what API is provided.
@; ------------------------------------------------------------ @; ------------------------------------------------------------
@section[#:tag "lang-servlets"]{Definition} @section[#:tag "lang-servlets"]{Definition}
@require[(for-label "dummy-language-servlet.ss")] ; to give a binding context @require[(for-label "dummy-language-servlet.ss")] @; to give a binding context
@declare-exporting[web-server/scribblings/dummy-language-servlet] @declare-exporting[#:use-sources (web-server/scribblings/dummy-language-servlet)]
A @defterm{Web language servlet} is a module written in the A @defterm{Web language servlet} is a module written in the
@scheme[(lib "lang.ss" "web-server")] module language. It should provide @schememodname[web-server/lang] language. The servlet module should
the following identifier: provide the following function:
@defproc[(start [initial-request request?]) @defproc[(start [initial-request request?])
response?]{ response?]{
This function is called when this servlet is invoked. Called when this servlet is invoked.
The argument is the HTTP request that initiated the servlet. The argument is the HTTP request that initiated the servlet.
} }

View File

@ -14,7 +14,7 @@ of these servlets. This API is provided by @filepath{servlet.ss}.
@section[#:tag "module-servlets"]{Definition} @section[#:tag "module-servlets"]{Definition}
@require[(for-label "dummy-servlet.ss")] @; to give a binding context @require[(for-label "dummy-servlet.ss")] @; to give a binding context
@declare-exporting[web-server/scribblings/dummy-servlet] @declare-exporting[#:use-sources (web-server/scribblings/dummy-servlet)]
A @defterm{servlet} is a module that provides the following: A @defterm{servlet} is a module that provides the following: