diff --git a/scribble-doc/scribblings/scribble/core.scrbl b/scribble-doc/scribblings/scribble/core.scrbl index ff60a69c..294afdbb 100644 --- a/scribble-doc/scribblings/scribble/core.scrbl +++ b/scribble-doc/scribblings/scribble/core.scrbl @@ -1587,12 +1587,14 @@ other documents can link to the section. More specifically, the section title is given the HTML attributes @tt{x-source-module} and @tt{x-part-tag}, plus @tt{x-part-prefixes} -if the section or enclosing sections declare tag prefixes. The +if the section or enclosing sections declare tag prefixes, and +@tt{x-source-pkg} if the source is found within a package at document-build time. The @racketmodname[scribble/manual] style recognizes those tags to make clicking a title show cross-reference information. @history[#:added "1.2" - #:changed "1.7" @elem{Added @tt{x-part-prefixes}.}]} + #:changed "1.7" @elem{Added @tt{x-part-prefixes}.} + #:changed "1.9" @elem{Added @tt{x-source-pkg}.}]} @defstruct[html-defaults ([prefix (or/c bytes? path-string? diff --git a/scribble-lib/info.rkt b/scribble-lib/info.rkt index 1990fb6a..7ddfe04e 100644 --- a/scribble-lib/info.rkt +++ b/scribble-lib/info.rkt @@ -22,4 +22,4 @@ (define pkg-authors '(mflatt eli)) -(define version "1.8") +(define version "1.9") diff --git a/scribble-lib/scribble/html-render.rkt b/scribble-lib/scribble/html-render.rkt index c97c28ec..61e38723 100644 --- a/scribble-lib/scribble/html-render.rkt +++ b/scribble-lib/scribble/html-render.rkt @@ -19,6 +19,7 @@ net/base64 scheme/serialize racket/draw/gif + pkg/path (prefix-in xml: xml/xml) (for-syntax scheme/base) "search.rkt" @@ -312,6 +313,7 @@ root-relative?) (define path-cache (make-hash)) + (define pkg-cache (make-hash)) (define (path->relative p) (let ([p (path->main-doc-relative p)]) @@ -1116,6 +1118,14 @@ (cadr t)))]) (if (and src taglet) `([x-source-module ,(format "~s" src)] + ,@(let* ([path (resolved-module-path-name + (module-path-index-resolve + (module-path-index-join src #f)))] + [pkg (and (path? path) + (path->pkg path #:cache pkg-cache))]) + (if pkg + `([x-source-pkg ,pkg]) + null)) ,@(let ([prefixes (current-tag-prefixes)]) (if (null? prefixes) null