gozilla10 / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

Link.js is using "publish.conf" from publish.js where it shouldn't #287

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. For the template im creating i do not need the "srcDir" property from
the "publish.conf" dir, so i have removed it
2. Now when i want to use the Link functionality it doesnt deliver correct
Links / URL's

It would be better if the Link functionality would use calling methods
instead of properties to retrieve the different configuration options, like:

publish.conf = {
    getSrcUrl: function(url) {
        //Actually copy pasted from Link.js
        var srcFile = url.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "_");
//Doing some transformation
        return "someprefix" + srcFile + "somepostfix";
    }
}

This will also allow for reusage of that same getSrcUrl in the publish.js
so that its not needed to copy again the regexp used to convert the urls to
filenames.

Original issue reported on code.google.com by sjoerdmu...@gmail.com on 21 Apr 2010 at 2:28

GoogleCodeExporter commented 8 years ago
Addition: 

Link.js will actually look like the following then and no need for me then to 
modify
it or overwrite the whole _makeSrcLink:

Link.prototype._makeSrcLink = function(srcFilePath) {
    var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";

    // transform filepath into a filename
    var srcFile = publish.conf.getSrcDir(srcFilePath);

    if (!this.text) this.text = FilePath.fileName(srcFilePath);
    return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
}

Original comment by sjoerdmu...@gmail.com on 21 Apr 2010 at 2:30