doctool-yaml.patch 2.58 KB
Newer Older
Jérémy Lal's avatar
Jérémy Lal committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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) {
Jérémy Lal's avatar
Jérémy Lal committed
25 26
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
Jérémy Lal's avatar
Jérémy Lal committed
27
@@ -440,10 +440,7 @@
Jérémy Lal's avatar
Jérémy Lal committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
     }
 
     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
51 52
--- a/Makefile
+++ b/Makefile
Jérémy Lal's avatar
Jérémy Lal committed
53
@@ -356,26 +356,12 @@
54 55 56
 # 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
Jérémy Lal's avatar
Jérémy Lal committed
57
-	@[ -e tools/doc/node_modules/js-yaml/package.json ] || \
58 59 60 61 62 63 64 65 66
-		[ -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
Jérémy Lal's avatar
Jérémy Lal committed
67 68
 gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html \
 			--template=doc/template.html --analytics=$(DOCS_ANALYTICS) $< > $@
69
 out/doc/api/%.html: doc/api/%.md
Jérémy Lal's avatar
Jérémy Lal committed
70
-	@[ -e tools/doc/node_modules/js-yaml/package.json ] || \
71 72 73 74 75 76 77 78
-		[ -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)
 
Jérémy Lal's avatar
Jérémy Lal committed
79
 docopen: $(apidocs_html)