From 93616edf2b43ae5314e3672810f8a446c55cbff8 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 13 Sep 2017 17:37:32 -0700 Subject: [PATCH] doc: prevent displaying empty version picker PR-URL: https://github.com/nodejs/node/pull/15420 Fixes: https://github.com/nodejs/node/issues/15396 Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Evan Lucas Reviewed-By: Ruben Bridgewater --- doc/api_assets/style.css | 11 +++++++++++ doc/template.html | 11 ++++------- tools/doc/html.js | 12 ++++++++++-- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 6d764fd889..bb2e0290aa 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -91,6 +91,15 @@ em code { #gtoc li { display: inline; + border-right: 1px #000 solid; + margin-right: 0.4em; + padding-right: 0.4em; +} + +#gtoc li:last-child { + border-right: none; + margin-right: 0; + padding-right: 0; } li.version-picker { @@ -118,6 +127,8 @@ ol.version-picker { #gtoc ol.version-picker li { display: block; + border-right: 0; + margin-right: 0; } ol.version-picker li a { diff --git a/doc/template.html b/doc/template.html index 68e93f9747..85dee07120 100644 --- a/doc/template.html +++ b/doc/template.html @@ -25,18 +25,15 @@

Ayo.js __VERSION__ Documentation


diff --git a/tools/doc/html.js b/tools/doc/html.js index 3373750a8d..0c15162c4c 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -232,9 +232,17 @@ function altDocs(filename) { return html + ''; } - const lis = (vs) => vs.filter(lte).map(li).join('\n'); + const lis = versions.filter(lte).map(li).join('\n'); - return `
    ${lis(versions)}
`; + if (!lis.length) + return ''; + + return ` +
  • + View another version +
      ${lis}
    +
  • + `; } // handle general body-text replacements