From 4ade7080c37b3ba27b018750823fd6f9d0adcc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rory=20O=E2=80=99Kane?= Date: Fri, 24 Apr 2015 20:29:28 -0400 Subject: [PATCH 1/3] =?UTF-8?q?In=20[-]=20doc=20buttons,=20change=20hyphen?= =?UTF-8?q?=20=E2=80=98-=E2=80=99=20to=20minus=20=E2=80=98=E2=88=92?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The minus sign ‘−’ is the same width as the plus sign ‘+’, so the button’s transition between the two symbols will look more smooth. --- src/librustdoc/html/static/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 56cea50a50239..328eef1b5a298 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -808,7 +808,7 @@ $("#toggle-all-docs").on("click", function() { var toggle = $("#toggle-all-docs"); - if (toggle.html() == "[-]") { + if (toggle.html() == "[−]") { toggle.html("[+]"); toggle.attr("title", "expand all docs"); $(".docblock").hide(); @@ -816,12 +816,12 @@ $(".toggle-wrapper").addClass("collapsed"); $(".collapse-toggle").children(".inner").html("+"); } else { - toggle.html("[-]"); + toggle.html("[−]"); toggle.attr("title", "collapse all docs"); $(".docblock").show(); $(".toggle-label").hide(); $(".toggle-wrapper").removeClass("collapsed"); - $(".collapse-toggle").children(".inner").html("-"); + $(".collapse-toggle").children(".inner").html("−"); } }); @@ -840,7 +840,7 @@ } else { relatedDoc.slideDown({duration:'fast', easing:'linear'}); toggle.parent(".toggle-wrapper").removeClass("collapsed"); - toggle.children(".inner").html("-"); + toggle.children(".inner").html("−"); toggle.children(".toggle-label").hide(); } } @@ -848,7 +848,7 @@ $(function() { var toggle = $("", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'}) - .html("[-]"); + .html("[]"); $(".method").each(function() { if ($(this).next().is(".docblock") || From 02428dfde5b1dc326444943dc3c298731945272e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rory=20O=E2=80=99Kane?= Date: Mon, 27 Apr 2015 02:26:58 -0400 Subject: [PATCH 2/3] Change hyphen to minus in HTML template too --- src/librustdoc/html/render.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 1993f03efd1fa..cf975084e2b71 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1460,7 +1460,7 @@ impl<'a> fmt::Display for Item<'a> { try!(write!(fmt, "")); try!(write!(fmt, r##" - [-] + [−] "##)); // Write `src` tag From 72e8f7b1ab344546e7b073317d4f696acab1a5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rory=20O=E2=80=99Kane?= Date: Mon, 27 Apr 2015 02:41:45 -0400 Subject: [PATCH 3/3] =?UTF-8?q?Change=20literal=20minus=20=E2=80=98?= =?UTF-8?q?=E2=88=92=E2=80=99=20to=20HTML=20entity=20=E2=80=98−?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that if people accidentally delete the character, they won’t re-type it as a hyphen, which would cause bugs. I changed ‘+’ too, even though it won’t be re-typed incorrectly, so that it is easier to see when plus is used as a symbol for the button, and when it is used as an operator in code. It also makes it clearer that the use of an entity for minus is on purpose, so people won’t be tempted to replace the entity incorrectly with a hyphen character. --- src/librustdoc/html/render.rs | 2 +- src/librustdoc/html/static/main.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index cf975084e2b71..a2cfb533c1a00 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1460,7 +1460,7 @@ impl<'a> fmt::Display for Item<'a> { try!(write!(fmt, "")); try!(write!(fmt, r##" - [−] + [−] "##)); // Write `src` tag diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 328eef1b5a298..c2a59278a86dc 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -808,20 +808,20 @@ $("#toggle-all-docs").on("click", function() { var toggle = $("#toggle-all-docs"); - if (toggle.html() == "[−]") { - toggle.html("[+]"); + if (toggle.html() == "[−]") { + toggle.html("[+]"); toggle.attr("title", "expand all docs"); $(".docblock").hide(); $(".toggle-label").show(); $(".toggle-wrapper").addClass("collapsed"); - $(".collapse-toggle").children(".inner").html("+"); + $(".collapse-toggle").children(".inner").html("+"); } else { - toggle.html("[−]"); + toggle.html("[−]"); toggle.attr("title", "collapse all docs"); $(".docblock").show(); $(".toggle-label").hide(); $(".toggle-wrapper").removeClass("collapsed"); - $(".collapse-toggle").children(".inner").html("−"); + $(".collapse-toggle").children(".inner").html("−"); } }); @@ -835,12 +835,12 @@ if (relatedDoc.is(":visible")) { relatedDoc.slideUp({duration:'fast', easing:'linear'}); toggle.parent(".toggle-wrapper").addClass("collapsed"); - toggle.children(".inner").html("+"); + toggle.children(".inner").html("+"); toggle.children(".toggle-label").fadeIn(); } else { relatedDoc.slideDown({duration:'fast', easing:'linear'}); toggle.parent(".toggle-wrapper").removeClass("collapsed"); - toggle.children(".inner").html("−"); + toggle.children(".inner").html("−"); toggle.children(".toggle-label").hide(); } } @@ -848,7 +848,7 @@ $(function() { var toggle = $("", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'}) - .html("[]"); + .html("[]"); $(".method").each(function() { if ($(this).next().is(".docblock") ||