Browse files

Merge pull request #13 from squarespace/master

Wildcard exclude and fixes #12
  • Loading branch information...
2 parents 8328d21 + 128635c commit 89f9d7c0c77d8de835a61e0686d320df64b94073 @apm committed Nov 2, 2011
Showing with 42 additions and 18 deletions.
  1. +17 −13 lib/docparser.js
  2. +25 −5 lib/yuidoc.js
View
30 lib/docparser.js
@@ -460,25 +460,29 @@ Y.log('param name/type/descript missing: ' + stringlog(block), 'warn', 'docparse
return host;
},
- // A key bock type for declaring classes, subsequent
+ // A key block type for declaring classes, subsequent
// member blocks will be assigned to this class
'class': function(tagname, value, target, block) {
- //console.log('Setting current class: ', value);
+ // console.log('Setting current class: ', value);
this.set(CURRENT_CLASS, value);
var fullname = this.get(CURRENT_CLASS);
var host = this.classes[fullname],
parent = this.get(CURRENT_MODULE);
- if (parent) {
- host.module = parent;
- }
- //Merge host and target in case the class was defined in a "for" tag
- //before it was defined in a "class" tag
- host = Y.merge(host, target);
- this.classes[fullname] = host;
- parent = this.get(CURRENT_SUBMODULE);
- if (parent) {
- //this.set(CURRENT_SUBMODULE, parent);
- host.submodule = parent;
+ if (host) {
+ if (parent) {
+ host.module = parent;
+ }
+ //Merge host and target in case the class was defined in a "for" tag
+ //before it was defined in a "class" tag
+ host = Y.merge(host, target);
+ this.classes[fullname] = host;
+ parent = this.get(CURRENT_SUBMODULE);
+ if (parent) {
+ //this.set(CURRENT_SUBMODULE, parent);
+ host.submodule = parent;
+ }
+ } else {
+ Y.log('class tag has no name: ' + stringlog(block), 'warn', 'docparser');
}
return host;
},
View
30 lib/yuidoc.js
@@ -109,6 +109,14 @@ YUI.add('yuidoc', function(Y) {
_processConfig: function() {
this.options.extensions = Y.Array.hash(this.options.extension.split(','));
this.options.excludes = Y.Array.hash(this.options.exclude.split(','));
+ this.options.wildcardExcludes = {};
+ var excludesArray = Y.Object.keys(this.options.excludes);
+ for (var i = 0; i < excludesArray.length; i++) {
+ var exclude = excludesArray[i];
+ if (exclude.charAt(exclude.length - 1) === "*") {
+ this.options.wildcardExcludes[exclude.substring(0, exclude.length - 1)] = true;
+ }
+ }
},
/**
* Walks the paths and parses the directory contents
@@ -131,12 +139,24 @@ YUI.add('yuidoc', function(Y) {
throw('Can not find directory: ' + dir);
}
var allfiles = fs.readdirSync(dir), stats,
- files = [], fullpath, self = this;
-
+ files = [], fullpath, excluded, self = this;
+
Y.each(allfiles, function(filename) {
- if (!(filename in self.options.excludes)) {
- fullpath = path.join(dir, filename);
-
+ fullpath = path.join(dir, filename);
+
+ // check if file is excluded
+ excluded = false;
+ if (filename in self.options.excludes) {
+ excluded = true;
+ } else {
+ for (var exclude in self.options.wildcardExcludes) {
+ if (fullpath.indexOf(exclude) === 0) {
+ excluded = true;
+ }
+ }
+ }
+
+ if (!excluded) {
stats = fs.statSync(fullpath);
if (stats.isDirectory() && !self.options.norecurse) {

0 comments on commit 89f9d7c

Please sign in to comment.