summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--doc/template.html1
-rw-r--r--test/doctool/test-doctool-html.js21
-rw-r--r--tools/doc/generate.js5
-rw-r--r--tools/doc/html.js26
-rw-r--r--vcbuild.bat2
6 files changed, 7 insertions, 56 deletions
diff --git a/Makefile b/Makefile
index 6b9aa510f2..c5a6b19da0 100644
--- a/Makefile
+++ b/Makefile
@@ -597,11 +597,6 @@ test-v8 test-v8-intl test-v8-benchmarks test-v8-all:
"$ git clone https://github.com/nodejs/node.git"
endif
-# Google Analytics ID used for tracking API docs page views, empty
-# DOCS_ANALYTICS means no tracking scripts will be included in the
-# generated .html files
-DOCS_ANALYTICS ?=
-
apidoc_dirs = out/doc out/doc/api out/doc/api/assets
apidoc_sources = $(wildcard doc/api/*.md)
apidocs_html = $(addprefix out/,$(apidoc_sources:.md=.html))
@@ -646,8 +641,7 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets
run-npm-ci = $(PWD)/$(NPM) ci
gen-api = tools/doc/generate.js --node-version=$(FULLVERSION) \
- --apilinks=out/apilinks.json \
- --analytics=$(DOCS_ANALYTICS) $< --output-directory=out/doc/api
+ --apilinks=out/apilinks.json $< --output-directory=out/doc/api
gen-apilink = tools/doc/apilinks.js $(wildcard lib/*.js) > $@
out/apilinks.json: $(wildcard lib/*.js) tools/doc/apilinks.js
diff --git a/doc/template.html b/doc/template.html
index fdcf0d5821..3317eadf3d 100644
--- a/doc/template.html
+++ b/doc/template.html
@@ -54,6 +54,5 @@
<script src="assets/sh_main.js"></script>
<script src="assets/sh_javascript.min.js"></script>
<script>highlight(undefined, undefined, 'pre');</script>
- <!-- __TRACKING__ -->
</body>
</html>
diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js
index 2fcb8315af..78f48ae54e 100644
--- a/test/doctool/test-doctool-html.js
+++ b/test/doctool/test-doctool-html.js
@@ -22,7 +22,7 @@ const remark2rehype = require('remark-rehype');
const raw = require('rehype-raw');
const htmlStringify = require('rehype-stringify');
-function toHTML({ input, filename, nodeVersion, analytics }, cb) {
+function toHTML({ input, filename, nodeVersion }, cb) {
const content = unified()
.use(markdown)
.use(html.firstHeader)
@@ -35,7 +35,7 @@ function toHTML({ input, filename, nodeVersion, analytics }, cb) {
.processSync(input);
html.toHTML(
- { input, content, filename, nodeVersion, analytics },
+ { input, content, filename, nodeVersion },
cb
);
}
@@ -94,16 +94,14 @@ const testData = [
file: fixtures.path('sample_document.md'),
html: '<ol><li>fish</li><li>fish</li></ol>' +
'<ul><li>Red fish</li><li>Blue fish</li></ul>',
- analyticsId: 'UA-67020396-1'
},
];
const spaces = /\s/g;
-testData.forEach(({ file, html, analyticsId }) => {
+testData.forEach(({ file, html }) => {
// Normalize expected data by stripping whitespace.
const expected = html.replace(spaces, '');
- const includeAnalytics = typeof analyticsId !== 'undefined';
readFile(file, 'utf8', common.mustCall((err, input) => {
assert.ifError(err);
@@ -112,7 +110,6 @@ testData.forEach(({ file, html, analyticsId }) => {
input: input,
filename: 'foo',
nodeVersion: process.version,
- analytics: analyticsId,
},
common.mustCall((err, output) => {
assert.ifError(err);
@@ -121,18 +118,6 @@ testData.forEach(({ file, html, analyticsId }) => {
// Assert that the input stripped of all whitespace contains the
// expected markup.
assert(actual.includes(expected));
-
- // Testing the insertion of Google Analytics script when
- // an analytics id is provided. Should not be present by default.
- const scriptDomain = 'google-analytics.com';
- if (includeAnalytics) {
- assert(actual.includes(scriptDomain),
- `Google Analytics script was not present in "${actual}"`);
- } else {
- assert.strictEqual(actual.includes(scriptDomain), false,
- 'Google Analytics script was present in ' +
- `"${actual}"`);
- }
})
);
}));
diff --git a/tools/doc/generate.js b/tools/doc/generate.js
index 28e09d003f..7ca47e2ae0 100644
--- a/tools/doc/generate.js
+++ b/tools/doc/generate.js
@@ -38,7 +38,6 @@ const json = require('./json');
const args = process.argv.slice(2);
let filename = null;
let nodeVersion = null;
-let analytics = null;
let outputDir = null;
let apilinks = {};
@@ -47,8 +46,6 @@ args.forEach(function(arg) {
filename = arg;
} else if (arg.startsWith('--node-version=')) {
nodeVersion = arg.replace(/^--node-version=/, '');
- } else if (arg.startsWith('--analytics=')) {
- analytics = arg.replace(/^--analytics=/, '');
} else if (arg.startsWith('--output-directory=')) {
outputDir = arg.replace(/^--output-directory=/, '');
} else if (arg.startsWith('--apilinks=')) {
@@ -85,7 +82,7 @@ fs.readFile(filename, 'utf8', (er, input) => {
const basename = path.basename(filename, '.md');
html.toHTML(
- { input, content, filename, nodeVersion, analytics },
+ { input, content, filename, nodeVersion },
(err, html) => {
const target = path.join(outputDir, `${basename}.html`);
if (err) throw err;
diff --git a/tools/doc/html.js b/tools/doc/html.js
index c0a94b6534..fd74563dd7 100644
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
@@ -62,7 +62,7 @@ const gtocHTML = unified()
const templatePath = path.join(docPath, 'template.html');
const template = fs.readFileSync(templatePath, 'utf8');
-function toHTML({ input, content, filename, nodeVersion, analytics }, cb) {
+function toHTML({ input, content, filename, nodeVersion }, cb) {
filename = path.basename(filename, '.md');
const id = filename.replace(/\W+/g, '-');
@@ -77,30 +77,6 @@ function toHTML({ input, content, filename, nodeVersion, analytics }, cb) {
.replace('__EDIT_ON_GITHUB__', editOnGitHub(filename))
.replace('__CONTENT__', content.toString());
- if (analytics) {
- HTML = HTML.replace('<!-- __TRACKING__ -->', `
- <script type="text/javascript">
- // In all the browsers we'll get '1' or 'yes' (FF 32 or above) as a string
- // value when enabling 'DO NOT TRACK'.
- // For more:
- // https://developer.mozilla.org/en-US/docs/Web/API/navigator/doNotTrack
- function isDoNotTrack() {
- var isDoNotTrackEnabled = navigator.doNotTrack || window.doNotTrack ||
- navigator.msDoNotTrack;
- return isDoNotTrackEnabled === '1' || isDoNotTrackEnabled === 'yes';
- }
- if (!isDoNotTrack()) {
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;
- i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},
- i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];
- a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,
- 'script','//www.google-analytics.com/analytics.js','ga');
- ga('create', '${analytics}', 'auto');
- ga('send', 'pageview');
- }
- </script>`);
- }
-
const docCreated = input.match(
/<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.[0-9]+\s*-->/);
if (docCreated) {
diff --git a/vcbuild.bat b/vcbuild.bat
index b90d2b09cc..1e31440cc2 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -460,7 +460,7 @@ robocopy /e doc\api %config%\doc\api
robocopy /e doc\api_assets %config%\doc\api\assets
for %%F in (%config%\doc\api\*.md) do (
- %node_exe% tools\doc\generate.js --node-version=v%FULLVERSION% --analytics=%DOCS_ANALYTICS% %%F --output-directory=%%~dF%%~pF
+ %node_exe% tools\doc\generate.js --node-version=v%FULLVERSION% %%F --output-directory=%%~dF%%~pF
)
:run