Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Solving issue with shortnames #25

Merged
merged 1 commit into from

2 participants

@bmathern

Pull request that solves issue #11

Cheers

@terryweiss terryweiss merged commit edc27b9 into from
@terryweiss
Owner

Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 20, 2014
  1. @bmathern
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 15 deletions.
  1. +6 −14 template/publish.js
  2. +1 −1  template/tmpl/details.tmpl
View
20 template/publish.js
@@ -163,20 +163,14 @@ function shortenPaths( files, commonPrefix ) {
return files;
}
-function resolveSourcePath( filepath ) {
- return path.resolve( process.cwd(), filepath );
-}
-
function getPathFromDoclet( doclet ) {
if ( !doclet.meta ) {
return;
}
- var filepath = doclet.meta.path && doclet.meta.path !== 'null' ?
+ return doclet.meta.path && doclet.meta.path !== 'null' ?
doclet.meta.path + '/' + doclet.meta.filename :
doclet.meta.filename;
-
- return filepath;
}
function generate( docType, title, docs, filename, resolveLinks ) {
@@ -201,7 +195,7 @@ function generate( docType, title, docs, filename, resolveLinks ) {
function generateSourceFiles( sourceFiles ) {
Object.keys( sourceFiles ).forEach( function ( file ) {
var source;
- // links are keyed to the shortened path in each doclet's `meta.filename` property
+ // links are keyed to the shortened path in each doclet's `meta.shortpath` property
var sourceOutfile = helper.getUniqueFilename( sourceFiles[file].shortened );
helper.registerLink( sourceFiles[file].shortened, sourceOutfile );
@@ -425,16 +419,14 @@ exports.publish = function ( taffyData, opts, tutorials ) {
// build a list of source files
var sourcePath;
- var resolvedSourcePath;
if ( doclet.meta ) {
sourcePath = getPathFromDoclet( doclet );
- resolvedSourcePath = resolveSourcePath( sourcePath );
sourceFiles[sourcePath] = {
- resolved : resolvedSourcePath,
+ resolved : sourcePath,
shortened : null
};
- sourceFilePaths.push( resolvedSourcePath );
+ sourceFilePaths.push( sourcePath );
}
} );
@@ -462,13 +454,13 @@ exports.publish = function ( taffyData, opts, tutorials ) {
var url = helper.createLink( doclet );
helper.registerLink( doclet.longname, url );
- // replace the filename with a shortened version of the full path
+ // add a shortened version of the full path
var docletPath;
if ( doclet.meta ) {
docletPath = getPathFromDoclet( doclet );
docletPath = sourceFiles[docletPath].shortened;
if ( docletPath ) {
- doclet.meta.filename = docletPath;
+ doclet.meta.shortpath = docletPath;
}
}
} );
View
2  template/tmpl/details.tmpl
@@ -65,7 +65,7 @@ var self = this;
<?js if (data.meta) {?>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
- <?js= self.linkto(meta.filename) ?><?js if (this.navOptions.linenums) {?>, <?js= self.linkto(meta.filename, 'line ' + meta.lineno, null, 'sunlight-1-line-' + meta.lineno) ?><?js } ?>
+ <?js= self.linkto(meta.shortpath) ?><?js if (this.navOptions.linenums) {?>, <?js= self.linkto(meta.shortpath, 'line ' + meta.lineno, null, 'sunlight-1-line-' + meta.lineno) ?><?js } ?>
</li></ul></dd>
<?js } ?>
Something went wrong with that request. Please try again.