Browse files

Recover from aberrant doc generation gracefully.

node-create.js in pr2 documents the NodeList import methods incorrectly, and causes a newline and warning to get printed as part of the methods collection key and method.name property. Avoid it with some loop hanky panky.
  • Loading branch information...
1 parent f652baa commit de4855033bde1d88bbbfdf43ac687546ca9741a9 @evocateur evocateur committed Mar 14, 2012
Showing with 19 additions and 1 deletion.
  1. +19 −1 build.js
View
20 build.js
@@ -107,7 +107,25 @@ function onFetchSuccess(data) {
if (klass.methods) {
util.each(klass.methods, function (method, name) {
- var match = name.match(/\.([^\.]+)$/);
+ var match, descr;
+
+ // catch a doc bug where description gets inserted in method name
+ if (name && name.indexOf('\n') > -1) {
+ descr = name.split('\n');
+ // clean method name
+ name = descr.shift().trim();
+ // append to existing description, if present
+ if (method.description) {
+ descr.unshift(method.description);
+ }
+ // augment methods object with clean copy of method config
+ klass.methods[name] = util.merge(method, {
+ description: descr.join('\n'),
+ name: name
+ });
+ }
+
+ match = name.match(/\.([^\.]+)$/);
name = match ? match[1].trim() : name.trim();

0 comments on commit de48550

Please sign in to comment.