cecco974 / jsdoc-toolkit

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

jsdoc/publish.js uses hard coded template directory #177

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using a fresh copy of JSDoc-toolkit 2.0, copy the jsdoc template
directory to a new template directory.
2. In the new directory, remove all of the .tmpl files.
3. Run jsdoc using the new template.

What is the expected output? What do you see instead?
It should output an error because it cannot find the .tmpl files.  Instead,
it runs like normal.

What version of the product are you using? On what operating system?
Jsdoc toolkit 2.0.2.  

Please provide any additional information below.
The publish.js file is using a hard coded template directory:
    templatesDir: SYS.pwd+"../templates/jsdoc/"

This is VERY confusing if you attempt to create a new template based on the
old one.  Instead, publish.js should use the template directory specified
on the command line:
    templatesDir: JSDOC.opt.t

However, JSDOC.opt.t is not modified concatenated with a trailing '/' if it
is not provided on the command line, so additional code is needed in
JsDoc.js.  I have attached modified source files for both of these.

Original issue reported on code.google.com by cory.burkhardt@gmail.com on 10 Sep 2008 at 11:32

Attachments:

GoogleCodeExporter commented 8 years ago
I believe this is a duplicate of issue 176 and so was fixed in revision 672.

http://code.google.com/p/jsdoc-toolkit/source/detail?r=672

This is will be released in the next bugfix release, 2.0.3.

Original comment by micmath on 11 Sep 2008 at 6:47

GoogleCodeExporter commented 8 years ago
You are correct, it is the same bug; I did not seen the other entry.  However, I
don't think the fix is complete.  It does not work if the template directory on 
the
command line does not end with a slash '/'.  The code in the JsDoc.js file that 
I
attached has a fix for this.  I have added the following code:

    if (typeof JSDOC.opt.t == "string") {
        if (!JSDOC.opt.t.charAt(JSDOC.opt.t.length-1).match(/[\\\/]/)) {
            JSDOC.opt.t = JSDOC.opt.t+"/";
        }
        LOG.inform("Template directory set to '"+JSDOC.opt.t+"'.");
    }

Original comment by cory.burkhardt@gmail.com on 11 Sep 2008 at 3:18

GoogleCodeExporter commented 8 years ago
Thanks very much. This has been committed in revision 685.

Original comment by micmath on 11 Sep 2008 at 9:51

GoogleCodeExporter commented 8 years ago
Using 2.1.0b

Looking at changes.txt I think this is the right place to put this comment.

With version 2.0.2 my configuration file, for windows, worked fine when it 
included this:

{
    // Documentation template.
    t: "templates\\jsdoc",
}

With 2.1.0b I get an error unless I put a slash on the end.
{
    // Documentation template.
    t: "templates\\jsdoc\\",
}

JsDoc Toolkit : Generating TslDocs...

js: Couldn't open file "templates\jsdocpublish.js".
>> WARNING: Sorry, that doesn't seem to be a valid template: templates\jsdocpubl
ish.js : ReferenceError: "publish" is not defined.
1 warning.

Is this correct, MUST you now add a slash at the end?

Thanks,

Max

Original comment by m...@dayala.co.uk on 10 Jan 2009 at 3:29

GoogleCodeExporter commented 8 years ago
This is a bug which only affects configuration files. It can be avoided by 
adding the trailing slash, but in the next 
release the trailing slash will be added automatically if it is missing. This 
really isn't directly related to issue 177, 
so I'm going to open a new issue.

Original comment by micmath on 11 Jan 2009 at 12:03

GoogleCodeExporter commented 8 years ago
Moved to Issue #191.

Original comment by micmath on 11 Jan 2009 at 12:19