diff --git a/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/core.scrbl b/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/core.scrbl index e0fb94d5..ff60a69c 100644 --- a/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/core.scrbl +++ b/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/core.scrbl @@ -1586,11 +1586,13 @@ part. Clicking on a section title within the part may show 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}. The +@tt{x-source-module} and @tt{x-part-tag}, plus @tt{x-part-prefixes} +if the section or enclosing sections declare tag prefixes. The @racketmodname[scribble/manual] style recognizes those tags to make clicking a title show cross-reference information. -@history[#:added "1.2"]} +@history[#:added "1.2" + #:changed "1.7" @elem{Added @tt{x-part-prefixes}.}]} @defstruct[html-defaults ([prefix (or/c bytes? path-string? diff --git a/pkgs/scribble-pkgs/scribble-lib/info.rkt b/pkgs/scribble-pkgs/scribble-lib/info.rkt index e53a3145..27965989 100644 --- a/pkgs/scribble-pkgs/scribble-lib/info.rkt +++ b/pkgs/scribble-pkgs/scribble-lib/info.rkt @@ -22,4 +22,4 @@ (define pkg-authors '(mflatt eli)) -(define version "1.6") +(define version "1.7") diff --git a/pkgs/scribble-pkgs/scribble-lib/scribble/html-render.rkt b/pkgs/scribble-pkgs/scribble-lib/scribble/html-render.rkt index c2a3aa69..dff8405c 100644 --- a/pkgs/scribble-pkgs/scribble-lib/scribble/html-render.rkt +++ b/pkgs/scribble-pkgs/scribble-lib/scribble/html-render.rkt @@ -1116,6 +1116,10 @@ (cadr t)))]) (if (and src taglet) `([x-source-module ,(format "~s" src)] + ,@(let ([prefixes (current-tag-prefixes)]) + (if (null? prefixes) + null + `([x-part-prefixes ,(format "~s" prefixes)]))) [x-part-tag ,(format "~s" taglet)]) '())) ,@(format-number number '((tt nbsp))) diff --git a/pkgs/scribble-pkgs/scribble-lib/scribble/manual-racket.js b/pkgs/scribble-pkgs/scribble-lib/scribble/manual-racket.js index 9691015e..203d6d30 100644 --- a/pkgs/scribble-pkgs/scribble-lib/scribble/manual-racket.js +++ b/pkgs/scribble-pkgs/scribble-lib/scribble/manual-racket.js @@ -19,6 +19,9 @@ function AddPartTitleOnClick(elem) { var mod_path = elem.getAttribute("x-source-module"); var tag = elem.getAttribute("x-part-tag"); if (mod_path && tag) { + // Might not be present: + var prefixes = elem.getAttribute("x-part-prefixes"); + var info = document.createElement("div"); info.className = "RPartExplain"; @@ -30,9 +33,13 @@ function AddPartTitleOnClick(elem) { /* Break `secref` into two lines if the module path and tag are long enough: */ - var is_long = (is_top ? false : (mod_path.length + tag.length > 60)); + var is_long = (is_top ? false : ((mod_path.length + + tag.length + + (prefixes ? (16 + prefixes.length) : 0)) + > 60)); var line1 = document.createElement("div"); + var line1x = ((is_long && prefixes) ? document.createElement("div") : line1); var line2 = (is_long ? document.createElement("div") : line1); function add(dest, str, cn) { @@ -49,9 +56,16 @@ function AddPartTitleOnClick(elem) { if (!is_top) add(line1, tag, "RktVal"); if (is_long) { - /* indent second line: */ + /* indent additional lines: */ + if (prefixes) + add(line1x, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0", "RktPn"); add(line2, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0", "RktPn"); } + if (prefixes) { + add(line1x, " #:tag-prefixes ", "RktPn"); + add(line1x, "'", "RktVal"); + add(line1x, prefixes, "RktVal"); + } if (!is_top) add(line2, " #:doc ", "RktPn"); add(line2, "'", "RktVal"); @@ -59,6 +73,8 @@ function AddPartTitleOnClick(elem) { add(line2, "]", "RktPn"); info.appendChild(line1); + if (is_long) + info.appendChild(line1x); if (is_long) info.appendChild(line2);