Scribble HTML: included needed tag prefixes in "Link to this section"
original commit: f79ac7b510b1b0c6b65744f815f0cd1740904383
This commit is contained in:
parent
ffa98a1c11
commit
389123af2f
|
@ -1586,11 +1586,13 @@ part. Clicking on a section title within the part may show
|
||||||
other documents can link to the section.
|
other documents can link to the section.
|
||||||
|
|
||||||
More specifically, the section title is given the HTML attributes
|
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
|
@racketmodname[scribble/manual] style recognizes those tags to make
|
||||||
clicking a title show cross-reference information.
|
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?
|
@defstruct[html-defaults ([prefix (or/c bytes? path-string?
|
||||||
|
|
|
@ -22,4 +22,4 @@
|
||||||
|
|
||||||
(define pkg-authors '(mflatt eli))
|
(define pkg-authors '(mflatt eli))
|
||||||
|
|
||||||
(define version "1.6")
|
(define version "1.7")
|
||||||
|
|
|
@ -1116,6 +1116,10 @@
|
||||||
(cadr t)))])
|
(cadr t)))])
|
||||||
(if (and src taglet)
|
(if (and src taglet)
|
||||||
`([x-source-module ,(format "~s" src)]
|
`([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)])
|
[x-part-tag ,(format "~s" taglet)])
|
||||||
'()))
|
'()))
|
||||||
,@(format-number number '((tt nbsp)))
|
,@(format-number number '((tt nbsp)))
|
||||||
|
|
|
@ -19,6 +19,9 @@ function AddPartTitleOnClick(elem) {
|
||||||
var mod_path = elem.getAttribute("x-source-module");
|
var mod_path = elem.getAttribute("x-source-module");
|
||||||
var tag = elem.getAttribute("x-part-tag");
|
var tag = elem.getAttribute("x-part-tag");
|
||||||
if (mod_path && tag) {
|
if (mod_path && tag) {
|
||||||
|
// Might not be present:
|
||||||
|
var prefixes = elem.getAttribute("x-part-prefixes");
|
||||||
|
|
||||||
var info = document.createElement("div");
|
var info = document.createElement("div");
|
||||||
info.className = "RPartExplain";
|
info.className = "RPartExplain";
|
||||||
|
|
||||||
|
@ -30,9 +33,13 @@ function AddPartTitleOnClick(elem) {
|
||||||
|
|
||||||
/* Break `secref` into two lines if the module path and tag
|
/* Break `secref` into two lines if the module path and tag
|
||||||
are long enough: */
|
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 line1 = document.createElement("div");
|
||||||
|
var line1x = ((is_long && prefixes) ? document.createElement("div") : line1);
|
||||||
var line2 = (is_long ? document.createElement("div") : line1);
|
var line2 = (is_long ? document.createElement("div") : line1);
|
||||||
|
|
||||||
function add(dest, str, cn) {
|
function add(dest, str, cn) {
|
||||||
|
@ -49,9 +56,16 @@ function AddPartTitleOnClick(elem) {
|
||||||
if (!is_top)
|
if (!is_top)
|
||||||
add(line1, tag, "RktVal");
|
add(line1, tag, "RktVal");
|
||||||
if (is_long) {
|
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");
|
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)
|
if (!is_top)
|
||||||
add(line2, " #:doc ", "RktPn");
|
add(line2, " #:doc ", "RktPn");
|
||||||
add(line2, "'", "RktVal");
|
add(line2, "'", "RktVal");
|
||||||
|
@ -59,6 +73,8 @@ function AddPartTitleOnClick(elem) {
|
||||||
add(line2, "]", "RktPn");
|
add(line2, "]", "RktPn");
|
||||||
|
|
||||||
info.appendChild(line1);
|
info.appendChild(line1);
|
||||||
|
if (is_long)
|
||||||
|
info.appendChild(line1x);
|
||||||
if (is_long)
|
if (is_long)
|
||||||
info.appendChild(line2);
|
info.appendChild(line2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user