Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Wildcard exclude and a fix for Issue #12 #13

Merged
merged 3 commits into from

2 participants

@uxdiogenes

Parser will warn of a missing class name instead of failing, and allows /path/* in the exclude list.

@apm apm merged commit 89f9d7c into apm:master
@lsmith lsmith referenced this pull request from a commit in lsmith/yuidocjs
@davglass davglass Fixes #13 - Module names can contain a slash bf0cf2e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 1, 2011
  1. Better warning format

    Diogenes Brito authored
This page is out of date. Refresh to see the latest.
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) {
Something went wrong with that request. Please try again.