mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
on windows, when the module name isn't documented, generate an appropriate name (#279)
also removes 'file:' from the beginning of generated names in overview tags, which seems like an appropriate change.
This commit is contained in:
parent
f49d69e05d
commit
07a30a5c2d
@ -34,9 +34,12 @@ function setDocletDescriptionToValue(doclet, tag) {
|
||||
}
|
||||
|
||||
function setNameToFile(doclet, tag) {
|
||||
var name = '';
|
||||
if (doclet.meta.filename) {
|
||||
var name = doclet.meta.path || '';
|
||||
doclet.addTag( 'name', path.join(name, doclet.meta.filename) );
|
||||
// TODO: find the shortest path shared by all input files, and remove that from
|
||||
// doclet.meta.path
|
||||
name += path.basename(doclet.meta.path) + '/';
|
||||
doclet.addTag( 'name', name + doclet.meta.filename );
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,8 +64,9 @@ function applyNamespace(docletOrNs, tag) {
|
||||
}
|
||||
|
||||
function setDocletNameToFilename(doclet, tag) {
|
||||
var name = doclet.meta.path || '';
|
||||
name = path.join(name, doclet.meta.filename);
|
||||
// TODO: find the shortest path shared by all input files, and remove that from doclet.meta.path
|
||||
var name = doclet.meta.path ? path.basename(doclet.meta.path) + '/' : '';
|
||||
name += doclet.meta.filename;
|
||||
name = name.replace(/\.js$/i, '');
|
||||
|
||||
for (var i = 0, len = env.opts._.length; i < len; i++) {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/*global describe: true, env: true, expect: true, it: true */
|
||||
|
||||
describe("@overview tag", function() {
|
||||
var parser = require('jsdoc/src/parser'),
|
||||
srcParser = new parser.Parser(),
|
||||
@ -6,8 +8,8 @@ describe("@overview tag", function() {
|
||||
require('jsdoc/src/handlers').attachTo(srcParser);
|
||||
doclets = srcParser.parse(env.dirname + '/test/fixtures/file.js');
|
||||
|
||||
it('When a file overview tag appears in a doclet, the name of the doclet should start with file: and should end with the path to the file.', function() {
|
||||
expect(doclets[0].name).toMatch(/^.*([\/\\]fixtures[\/\\]file\.js)$/);
|
||||
it('When a file overview tag appears in a doclet, the name of the doclet should contain the path to the file.', function() {
|
||||
expect(doclets[0].name).toMatch(/^(fixtures[\/\\]file\.js)$/);
|
||||
});
|
||||
|
||||
it("The name and longname should be equal", function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user