summaryrefslogtreecommitdiff
path: root/tools/doc/json.js
diff options
context:
space:
mode:
authorTristian Flanagan <tflanagan@datacollaborative.com>2015-11-13 21:40:38 -0500
committerAnna Henningsen <anna@addaleax.net>2016-05-05 01:15:10 +0200
commit015f4fda0eecf8b5014973cd558674dcb5a120cf (patch)
tree377ef715adea2d1a28a95cfb0fcdcd3ba65f545c /tools/doc/json.js
parent020968dd1803220b76b8fdcbf2bab54c66b695f4 (diff)
downloadandroid-node-v8-015f4fda0eecf8b5014973cd558674dcb5a120cf.tar.gz
android-node-v8-015f4fda0eecf8b5014973cd558674dcb5a120cf.tar.bz2
android-node-v8-015f4fda0eecf8b5014973cd558674dcb5a120cf.zip
tools: parse documentation metadata
This commit introduces the Documentation YAML metadata concept to the documentation. - Parses added or Added for HTML - Parses all data for JSON Ref: https://github.com/nodejs/node/pull/3867 Ref: https://github.com/nodejs/node/issues/3713 Ref: https://github.com/nodejs/node/issues/6470 PR-URL: https://github.com/nodejs/node/pull/6495 Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'tools/doc/json.js')
-rw-r--r--tools/doc/json.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/doc/json.js b/tools/doc/json.js
index 3d08026daa..84a042f470 100644
--- a/tools/doc/json.js
+++ b/tools/doc/json.js
@@ -5,7 +5,8 @@ module.exports = doJSON;
// Take the lexed input, and return a JSON-encoded object
// A module looks like this: https://gist.github.com/1777387
-var marked = require('marked');
+const common = require('./common.js');
+const marked = require('marked');
function doJSON(input, filename, cb) {
var root = {source: filename};
@@ -91,6 +92,8 @@ function doJSON(input, filename, cb) {
current.list = current.list || [];
current.list.push(tok);
current.list.level = 1;
+ } else if (type === 'html' && common.isYAMLBlock(tok.text)) {
+ current.meta = parseYAML(tok.text);
} else {
current.desc = current.desc || [];
if (!Array.isArray(current.desc)) {
@@ -274,6 +277,9 @@ function processList(section) {
delete section.list;
}
+function parseYAML(text) {
+ return common.extractAndParseYAML(text);
+}
// textRaw = "someobject.someMethod(a[, b=100][, c])"
function parseSignature(text, sig) {