added make-module-language-tag and use it and make-section-tag

in a few places
This commit is contained in:
Robby Findler 2012-12-27 11:10:40 -06:00
parent a412ab8411
commit 353da62843
6 changed files with 31 additions and 18 deletions

View File

@ -14,6 +14,7 @@
setup/getinfo setup/getinfo
setup/xref setup/xref
scribble/xref scribble/xref
scribble/tag
net/url net/url
syntax/toplevel syntax/toplevel
browser/external browser/external
@ -1342,7 +1343,8 @@
[else (void)]))) [else (void)])))
(send t set-clickback before-docs after-docs (send t set-clickback before-docs after-docs
(λ (t start end) (λ (t start end)
(define-values (path tag) (xref-tag->path+anchor (load-collections-xref) `(mod-path ,(symbol->string lang)))) (define-values (path tag) (xref-tag->path+anchor (load-collections-xref)
(make-module-language-tag lang)))
(define url (path->url path)) (define url (path->url path))
(define url2 (if tag (define url2 (if tag
(make-url (url-scheme url) (make-url (url-scheme url)

View File

@ -50,6 +50,7 @@ module browser threading seems wrong.
scribble/xref scribble/xref
setup/xref setup/xref
scribble/tag
(only-in scribble/base doc-prefix)) (only-in scribble/base doc-prefix))
(provide unit@) (provide unit@)
@ -1532,11 +1533,9 @@ module browser threading seems wrong.
[callback (λ (x y) [callback (λ (x y)
(define-values (path tag) (define-values (path tag)
(xref-tag->path+anchor (load-collections-xref) (xref-tag->path+anchor (load-collections-xref)
`(part (make-section-tag
,(doc-prefix "follow-log"
'(lib "scribblings/drracket/drracket.scrbl") #:doc '(lib "scribblings/drracket/drracket.scrbl"))))
#f
"follow-log"))))
(define url (path->url path)) (define url (path->url path))
(define url2 (if tag (define url2 (if tag
(make-url (url-scheme url) (make-url (url-scheme url)

View File

@ -3,6 +3,7 @@
(require setup/xref (require setup/xref
scribble/xref scribble/xref
scribble/basic scribble/basic
scribble/tag
scheme/promise scheme/promise
net/url net/url
net/sendurl) net/sendurl)
@ -10,13 +11,13 @@
(provide show-scribbling) (provide show-scribbling)
(define (show-scribbling mod-path tag) (define (show-scribbling mod-path tag)
(let ([xref (delay (load-collections-xref))]) (define xref (load-collections-xref))
(lambda () (λ ()
(let-values ([(path anchor) (define-values (path anchor)
(xref-tag->path+anchor (xref-tag->path+anchor
(force xref) xref
(list 'part (list (module-path-prefix->string mod-path) tag)))]) (make-section-tag tag #:doc mod-path)))
(if path (if path
(let ([u (path->url path)]) (let ([u (path->url path)])
(send-url (url->string u))) (send-url (url->string u)))
(error 'show-scribbling "cannot find docs for: ~.s ~.s" mod-path tag)))))) (error 'show-scribbling "cannot find docs for: ~.s ~.s" mod-path tag))))

View File

@ -1,6 +1,7 @@
#lang meta/web #lang meta/web
(require syntax-color/module-lexer setup/xref scribble/xref) (require syntax-color/module-lexer setup/xref
scribble/xref scribble/tag)
(provide code) (provide code)
@ -53,7 +54,8 @@
(if (or always-orig? (syntax-original? mp-stx)) (if (or always-orig? (syntax-original? mp-stx))
(let ([mp (syntax->datum mp-stx)]) (let ([mp (syntax->datum mp-stx)])
(define-values [p a] (define-values [p a]
(xref-tag->path+anchor xref `(mod-path ,(format "~s" mp)) (xref-tag->path+anchor xref
(make-module-language-tag mp)
#:external-root-url doc-root)) #:external-root-url doc-root))
(if p (if p
(list (let ([pos (sub1 (syntax-position mp-stx))]) (list (let ([pos (sub1 (syntax-position mp-stx))])

View File

@ -14,6 +14,7 @@
#:tag-prefixes (or/c #f (listof string?))) #:tag-prefixes (or/c #f (listof string?)))
. ->* . . ->* .
tag?)] tag?)]
[make-module-language-tag (-> symbol? tag?)]
[taglet? (any/c . -> . boolean?)] [taglet? (any/c . -> . boolean?)]
[module-path-prefix->string (module-path? . -> . string?)] [module-path-prefix->string (module-path? . -> . string?)]
[module-path-index->taglet (module-path-index? . -> . taglet?)] [module-path-index->taglet (module-path-index? . -> . taglet?)]
@ -25,6 +26,9 @@
(define (make-section-tag s #:doc [doc #f] #:tag-prefixes [prefix #f]) (define (make-section-tag s #:doc [doc #f] #:tag-prefixes [prefix #f])
`(part ,(doc-prefix doc prefix s))) `(part ,(doc-prefix doc prefix s)))
(define (make-module-language-tag langname)
`(mod-path ,(symbol->string langname)))
(define (taglet? v) (define (taglet? v)
(and (not (generated-tag? v)) (and (not (generated-tag? v))
(tag? (list 'something v)))) (tag? (list 'something v))))

View File

@ -26,6 +26,11 @@ references a section in the document implemented by
prefixes (for intermediate sections, typically) can be provided as prefixes (for intermediate sections, typically) can be provided as
@racket[tag-prefixes].} @racket[tag-prefixes].}
@defproc[(make-module-language-tag [lang symbol?]) tag?]{
Forms a @tech{tag} that refers to a section
that contains @racket[defmodulelang] for the language
@racket[lang].
}
@defproc[(taglet? [v any/c]) boolean?]{ @defproc[(taglet? [v any/c]) boolean?]{