scribble: add #:indirect
option to defmodule
Also, fix up some command-line argument handling for `scribble`. original commit: b8f6311e4b082cf7a5ce33f64d0dafeb9ffcfb36
This commit is contained in:
parent
837249163c
commit
82b85a9155
|
@ -537,6 +537,7 @@ corresponding @racketidfont{racket...} binding.}
|
|||
#:no-declare
|
||||
(code:line #:use-sources (src-module-path ...))
|
||||
(code:line #:link-target? link-target?-expr)
|
||||
#:indirect
|
||||
#:lang
|
||||
#:reader
|
||||
(code:line #:packages (pkg-expr ...))])]{
|
||||
|
@ -579,6 +580,12 @@ sub-parts). These link targets are referenced via
|
|||
@racket[racketmodname], which thus points to the enclosing section,
|
||||
rather than the individual @racket[module-path]s.
|
||||
|
||||
Specifying @racket[#:indirect] normally makes sense only when
|
||||
@racket[#:link-target?] is specified with a true value. Specifying
|
||||
@racket[#:indirect] makes the module path that is displayed (and that
|
||||
normally refers to some other declaration of the module) use
|
||||
@racket[racketmodname] with @racket[#:indirect].
|
||||
|
||||
If @racket[#:lang] is provided as an option, then the module name is
|
||||
shown after @hash-lang[] (instead of in a @racket[require] form) to
|
||||
indicate that the @racket[module-path]s are suitable for use by either
|
||||
|
|
|
@ -1220,7 +1220,8 @@
|
|||
(and ext? external-tag-path))
|
||||
;; Redirected to search:
|
||||
(url->string*
|
||||
(let ([u (string->url external-tag-path)])
|
||||
(let ([u (string->url (or external-tag-path
|
||||
"http://doc.racket-lang.com/"))])
|
||||
(struct-copy
|
||||
url
|
||||
u
|
||||
|
|
|
@ -43,13 +43,6 @@
|
|||
(make-element (make-style #f (list (make-background-color-property "yellow"))) content))
|
||||
;; ---------------------------------------------------------------------------------------------------
|
||||
|
||||
(begin-for-syntax
|
||||
(define-splicing-syntax-class link-target?-kw
|
||||
#:description "#:link-target? keyword"
|
||||
(pattern (~seq #:link-target? expr))
|
||||
(pattern (~seq)
|
||||
#:with expr #'#t)))
|
||||
|
||||
(define-syntax (defmodule stx)
|
||||
(syntax-parse stx
|
||||
[(_ (~or (~seq #:require-form req)
|
||||
|
@ -58,6 +51,7 @@
|
|||
name)
|
||||
(~or (~optional (~seq #:link-target? link-target-expr)
|
||||
#:defaults ([link-target-expr #'#t]))
|
||||
(~optional (~and #:indirect indirect))
|
||||
(~optional (~seq #:use-sources (pname ...)))
|
||||
(~optional (~seq #:module-paths (modpath ...)))
|
||||
(~optional (~seq #:packages (pkg ...)))
|
||||
|
@ -71,7 +65,10 @@
|
|||
#'(name2 ...))]
|
||||
[(pname ...) (if (attribute pname)
|
||||
#'(pname ...)
|
||||
#'())])
|
||||
#'())]
|
||||
[(indirect-kw ...) (if (attribute indirect)
|
||||
#'(#:indirect)
|
||||
#'())])
|
||||
(with-syntax ([(decl-exp ...)
|
||||
(if (attribute no-declare)
|
||||
#'()
|
||||
|
@ -83,7 +80,7 @@
|
|||
[(attribute readr) #''reader]
|
||||
[else #'#f])]
|
||||
[modpaths (if (attribute modpath)
|
||||
#'(list (racketmodname modpath) ...)
|
||||
#'(list (racketmodname modpath indirect-kw ...) ...)
|
||||
#'#f)]
|
||||
[packages (if (attribute pkg)
|
||||
#'(list pkg ...)
|
||||
|
@ -100,7 +97,7 @@
|
|||
[(show-name ...)
|
||||
(if (attribute modpath)
|
||||
#'(name2 ...)
|
||||
#'((racketmodname name2) ...))])
|
||||
#'((racketmodname name2 indirect-kw ...) ...))])
|
||||
#'(begin
|
||||
decl-exp ...
|
||||
(*defmodule (list show-name ...)
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
(define multi-html:render-mixin
|
||||
(lambda (%) (html:render-multi-mixin (html:render-mixin %))))
|
||||
|
||||
(define current-render-mixin (make-parameter text:render-mixin))
|
||||
(define current-html (make-parameter #f))
|
||||
(define current-render-mixin (make-parameter html:render-mixin))
|
||||
(define current-html (make-parameter #t))
|
||||
(define current-dest-directory (make-parameter #f))
|
||||
(define current-dest-name (make-parameter #f))
|
||||
(define current-info-output-file (make-parameter #f))
|
||||
|
@ -35,8 +35,6 @@
|
|||
(let ([v (read i)])
|
||||
(and (eof-object? (read i)) v)))))
|
||||
|
||||
(current-render-mixin html:render-mixin)
|
||||
|
||||
(define (run)
|
||||
(command-line
|
||||
#:program (short-program+command-name)
|
||||
|
@ -48,17 +46,22 @@
|
|||
(current-html #t)
|
||||
(current-render-mixin multi-html:render-mixin)]
|
||||
[("--latex") "generate LaTeX-format output"
|
||||
(current-html #f)
|
||||
(current-render-mixin latex:render-mixin)]
|
||||
[("--pdf") "generate PDF-format output (with PDFLaTeX)"
|
||||
(current-html #f)
|
||||
(current-render-mixin pdf:render-mixin)]
|
||||
[("--latex-section") n "generate LaTeX-format output for section depth <n>"
|
||||
(current-html #f)
|
||||
(let ([v (string->number n)])
|
||||
(unless (exact-nonnegative-integer? v)
|
||||
(raise-user-error 'scribble (format "bad section depth: ~a" n)))
|
||||
(current-render-mixin (latex:make-render-part-mixin v)))]
|
||||
[("--text") "generate text-format output"
|
||||
(current-html #f)
|
||||
(current-render-mixin text:render-mixin)]
|
||||
[("--markdown") "generate markdown-format output"
|
||||
(current-html #f)
|
||||
(current-render-mixin markdown:render-mixin)]
|
||||
#:once-each
|
||||
[("--dest") dir "write output in <dir>"
|
||||
|
|
Loading…
Reference in New Issue
Block a user