diff --git a/collects/scribble/doc/lang/reader.ss b/collects/scribble/doc/lang/reader.ss index f00fec49..8d082a9b 100644 --- a/collects/scribble/doc/lang/reader.ss +++ b/collects/scribble/doc/lang/reader.ss @@ -8,4 +8,6 @@ (case key [(color-lexer) (dynamic-require 'syntax-color/scribble-lexer 'scribble-inside-lexer)] + [(drscheme:toolbar-buttons) + (dynamic-require 'scribble/tools/drscheme-buttons 'drscheme-buttons)] [else defval]))) diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index 2932141d..0acb2aff 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -359,7 +359,8 @@ `((a ([href ,(dest->url (resolve-get t ri (car (part-tags t))))] [class ,(if (or (eq? t d) (and show-mine? (memq t toc-chain))) "tocviewselflink" - "tocviewlink")]) + "tocviewlink")] + [pltdoc "x"]) ,@(render-content (or (part-title-content t) '("???")) d ri))) (format-number (collected-info-number (part-collected-info t ri)) '(nbsp)))) @@ -528,7 +529,8 @@ ,(cond [(part? p) "tocsubseclink"] [any-parts? "tocsubnonseclink"] - [else "tocsublink"])]) + [else "tocsublink"])] + [pltdoc "x"]) ,@(render-content (if (part? p) (or (part-title-content p) @@ -607,8 +609,8 @@ (list style-file) style-extra-files)) ,(scribble-js-contents script-file (lookup-path script-file alt-paths))) - (body ((id ,(or (extract-part-body-id d ri) - "scribble-plt-scheme-org"))) + (body ([id ,(or (extract-part-body-id d ri) + "scribble-plt-scheme-org")]) ,@(render-toc-view d ri) (div ([class "maincolumn"]) (div ([class "main"]) @@ -616,7 +618,8 @@ (render-version d ri)) ,@(navigation d ri #t) ,@(render-part d ri) - ,@(navigation d ri #f))))))))))) + ,@(navigation d ri #f))) + (div ([id "langindicator"]) nbsp))))))))) (define/private (part-parent d ri) (collected-info-parent (part-collected-info d ri))) @@ -705,6 +708,7 @@ (make-target-url url) (make-attributes `([title . ,(if title* (string-append label " to " title*) label)] + [pltdoc . "x"] ,@more))))) (define top-link (titled-url @@ -987,7 +991,8 @@ [else ;; Normal link: (dest->url dest)])) - ,@(attribs)] + ,@(attribs) + [pltdoc "x"]] ,@(if (empty-content? (element-content e)) (render-content (strip-aux (dest-title dest)) part ri) (render-content (element-content e) part ri)))) diff --git a/collects/scribble/manual/lang/reader.ss b/collects/scribble/manual/lang/reader.ss index 4421f4cb..4a8dc4b5 100644 --- a/collects/scribble/manual/lang/reader.ss +++ b/collects/scribble/manual/lang/reader.ss @@ -10,6 +10,8 @@ scribble/manual/lang (case key [(color-lexer) (dynamic-require 'syntax-color/scribble-lexer 'scribble-inside-lexer)] + [(drscheme:toolbar-buttons) + (dynamic-require 'scribble/tools/drscheme-buttons 'drscheme-buttons)] [else (default key defval)])) (require (prefix-in scribble: "../../reader.ss")) diff --git a/collects/scribble/scribble-common.js b/collects/scribble/scribble-common.js index bfd8711f..13b1dfa0 100644 --- a/collects/scribble/scribble-common.js +++ b/collects/scribble/scribble-common.js @@ -1,5 +1,7 @@ // Common functionality for PLT documentation pages +// Cookies -------------------------------------------------------------------- + function GetCookie(key, def) { if (document.cookie.length <= 0) return def; var i, cookiestrs = document.cookie.split(/; */); @@ -36,6 +38,40 @@ function GotoPLTRoot(ver, relative) { return false; } +// URL Parameters ------------------------------------------------------------- + +// In the following functions, the `name' argument is assumed to be simple in +// that it doesn't contain anything that isn't plain text in a regexp. (This +// is because JS doesn't have a `regexp-quote', easy to hack but not needed +// here). Also, the output value from the Get functions and the input value to +// the Set functions is decoded/encoded. Note that `SetArgInURL' mutates the +// string in the url object. + +function GetArgFromString(str, name) { + var rx = new RegExp("(?:^|[;&])"+name+"=([^&;]*)(?:[;&]|$)"); + return rx.test(str) && unescape(RegExp.$1); +} + +function SetArgInString(str, name, val) { + val = escape(val); + if (str.length == 0) return name + "=" + val; + var rx = new RegExp("^((?:|.*[;&])"+name+"=)(?:[^&;]*)([;&].*|)$"); + if (rx.test(str)) return RegExp.$1 + val + RegExp.$2; + else return name + "=" + val + "&" + str; +} + +function GetArgFromURL(url, name) { + if (!url.href.search(/\?([^#]*)(?:#|$)/)) return false; + return GetArgFromString(RegExp.$1, name); +} + +function SetArgInURL(url, name, val) { // note: mutates the string + url.href.search(/^([^?#]*)(?:\?([^#]*))?(#.*)?$/); + url.href = RegExp.$1 + "?" + SetArgInString(RegExp.$2,name,val) + RegExp.$3; +} + +// Utilities ------------------------------------------------------------------ + normalize_rxs = [/\/\/+/g, /\/\.(\/|$)/, /\/[^\/]*\/\.\.(\/|$)/]; function NormalizePath(path) { var tmp, i; @@ -44,6 +80,12 @@ function NormalizePath(path) { return path; } +// `noscript' is problematic in some browsers (always renders as a +// block), use this hack instead (does not always work!) +// document.write(""); + +// Interactions --------------------------------------------------------------- + function DoSearchKey(event, field, ver, top_path) { var val = field.value; if (event && event.keyCode == 13) { @@ -55,13 +97,41 @@ function DoSearchKey(event, field, ver, top_path) { return true; } -function TocviewToggle(glyph,id) { +function TocviewToggle(glyph, id) { var s = document.getElementById(id).style; var expand = s.display == "none"; s.display = expand ? "block" : "none"; glyph.innerHTML = expand ? "▼" : "►"; } -// `noscript' is problematic in some browsers (always renders as a -// block), use this hack instead (does not always work!) -// document.write(""); +// Page Init ------------------------------------------------------------------ + +// Note: could make a function that inspects and uses window.onload to chain to +// a previous one, but this file needs to be required first anyway, since it +// contains utilities for all other files. +var on_load_funcs = []; +function AddOnLoad(fun) { on_load_funcs.push(fun); } +window.onload = function() { + for (var i=0; i