1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
Description: use node-yamlish package instead of js-yaml from eslint
because debian nodejs package does not contain eslint because it's too heavy to bundle
Last-Update: 2016-10-06
Author: Jérémy Lal <kapouer@melix.org>
Forwarded: not-needed
--- a/tools/doc/common.js
+++ b/tools/doc/common.js
@@ -1,6 +1,6 @@
'use strict';
-const yaml = require('js-yaml');
+const yaml = require('yamlish');
function isYAMLBlock(text) {
return !!text.match(/^<!-- YAML/);
@@ -19,7 +19,7 @@
.replace(/-->$/, '');
// js-yaml.safeLoad() throws on error
- const meta = yaml.safeLoad(text);
+ const meta = yaml.decode(text);
const added = meta.added || meta.Added;
if (added) {
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
@@ -358,10 +358,7 @@
}
if (tok.type !== 'heading') return;
- if (tok.depth - depth > 1) {
- return cb(new Error('Inappropriate heading level\n' +
- JSON.stringify(tok)));
- }
+ if (tok.depth - depth > 1) return;
depth = tok.depth;
const realFilename = path.basename(realFilenames[0], '.md');
--- a/tools/doc/json.js
+++ b/tools/doc/json.js
@@ -43,8 +43,7 @@
if (type === 'heading' &&
!text.trim().match(/^example/i)) {
if (tok.depth - depth > 1) {
- return cb(new Error('Inappropriate heading level\n' +
- JSON.stringify(tok)));
+ return;
}
// Sometimes we have two headings with a single
--- a/Makefile
+++ b/Makefile
@@ -308,26 +308,12 @@
# check if ./node is actually set, else use user pre-installed binary
gen-json = tools/doc/generate.js --format=json $< > $@
out/doc/api/%.json: doc/api/%.md
- @[ -e tools/doc/node_modules/js-yaml/package.json ] || \
- [ -e tools/eslint/node_modules/js-yaml/package.json ] || \
- if [ -x $(NODE) ]; then \
- cd tools/doc && ../../$(NODE) ../../$(NPM) install; \
- else \
- cd tools/doc && node ../../$(NPM) install; \
- fi
[ -x $(NODE) ] && $(NODE) $(gen-json) || node $(gen-json)
# check if ./node is actually set, else use user pre-installed binary
gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html \
--template=doc/template.html --analytics=$(DOCS_ANALYTICS) $< > $@
out/doc/api/%.html: doc/api/%.md
- @[ -e tools/doc/node_modules/js-yaml/package.json ] || \
- [ -e tools/eslint/node_modules/js-yaml/package.json ] || \
- if [ -x $(NODE) ]; then \
- cd tools/doc && ../../$(NODE) ../../$(NPM) install; \
- else \
- cd tools/doc && node ../../$(NPM) install; \
- fi
[ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html)
docopen: $(apidocs_html)
|