From a13ac69ff9157648b191b33d3dc0282444b7e84d 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 Backport-PR-URL: https://github.com/nodejs/node/pull/15670 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 | 12 ++++++++++++ doc/template.html | 11 ++++------- tools/doc/html.js | 13 ++++++++++--- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 559245c7cef5a4..53e6f0aa8624a3 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,9 @@ ol.version-picker { #gtoc ol.version-picker li { display: block; + border-right: 0; + margin-right: 0; + width: 100%; } ol.version-picker li a { diff --git a/doc/template.html b/doc/template.html index d65b56ca5e80ad..165e47022c8124 100644 --- a/doc/template.html +++ b/doc/template.html @@ -25,18 +25,15 @@

Node.js __VERSION__ Documentation


diff --git a/tools/doc/html.js b/tools/doc/html.js index 9b6d93b7a7bb1c..c4ed0b0eda7bbe 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -33,7 +33,6 @@ var gtocPath = path.resolve(path.join( var gtocLoading = null; var gtocData = null; var docCreated = null; -var nodeVersion = null; /** * opts: input, filename, template, nodeVersion. @@ -211,9 +210,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