[jala-dev] AW: Re: Missing Methods when generating JsDoc with HopKit

  • From: <stefan.pollach@xxxxxx>
  • To: <jala-dev@xxxxxxxxxxxxx>
  • Date: Fri, 9 Mar 2007 16:46:36 +0100

Hi!

I was just working on the same thing.

Your solution actually was the original regex before this commit: 
https://opensvn.csie.org/traccgi/jala/changeset/51. 

This wa a fix to another problem, which was that such a function assignment
  Hopobject.prototype.test = function test()..
got changed to
  Hopobject.prototype.test = HopObject.prototype.test = function()..

Now, this is the regex that works with all that:
var functionReg = /(^|[^=]\s+)function\s+(\w+)\s*\(/gi;

I've attached a patch for lib.xml (against branches/release-1.1).
This also fixes a problem if the path to the working directory contains a dot 
and copies only the files really needed for documentation. The jsdoc call 
doesn't include the sources anymore as they are slightly different from the 
actual application.

lg,
Stefan


> -----Ursprüngliche Nachricht-----
> Von: jala-dev-bounce@xxxxxxxxxxxxx 
> [mailto:jala-dev-bounce@xxxxxxxxxxxxx] Im Auftrag von Anton Pirker
> Gesendet: Freitag, 09. März 2007 16:25
> An: jala-dev@xxxxxxxxxxxxx
> Betreff: [jala-dev] Re: Missing Methods when generating JsDoc 
> with HopKit
> 
> hi all!
> 
> I found the SOLUTION!
> 
> There was a little bug in lib.xml. functionReg was wrong.
> 
> I changed it from:
>     var functionReg = /^(\s*)function (.*)\(/gi; to
>     var functionReg = /(\s*)function (.*)\(/gi;
> 
> Because of the ^ only the first (if any) function in a file 
> was converted to the PrototypeName.prototype.functionName = 
> function() Syntax.
> Now every function is converted. Works quite good for me now! 
> Great stuff, that JsDoc!
> 
> 
> i wish you all a nice weekend!
> 
> cheers,
> Anton
> 
> 
> 
> Anton Pirker wrote:
> > hi tobi!
> >
> > thanks for the fast response!
> >
> >> however, the docs task actually should pre-process your files 
> >> accordingly. it copies the javascript code files into a working 
> >> directory and replaces the globally defined prototype methods with 
> >> definitions as described above.
> >>   
> > that's strange. i did a little debug-output in the preprocessing of 
> > the files and it seems, that nothing is changed by the script.
> > maybe this debug-output helps:
> > (for the record: i have the latest jala lib from the svn in 
> use, with 
> > the latest helma from svn and java 1.6)
> >
> >     [echo] ################################ functionReg: 
> > /^(\s*)function (.*)\(/gi
> >     [echo] ################################ 
> fileNameResult[1]: AccountMgr
> >     [echo] ################################ before (var content):
> >     [echo] /**
> >     [echo]  * macro renders a link to signup if user is not 
> member of 
> > this site
> >     [echo]  * if user is member, it displays the level of membership
> >     [echo]  */
> >     [echo] function membership_macro(param) {
> >     [echo]    if (session.user == null || path.Site == null || 
> > path.Site.members.getMembershipRole(session.user) == null)
> >     [echo]       return;
> >     [echo]    res.write(I18n.getMessage("Membership.role." + 
> > path.Site.members.getMembershipRole(session.user)));
> >     [echo] }
> >     [echo]
> >     [echo]
> >     [echo] /**
> >     [echo]  * macro renders a table with all shareable layouts
> >     [echo]  * rendering a preview image, a preview button and some 
> > basic information
> >     [echo]  */
> >     [echo] function visualLayoutChooser_macro(param) {
> >     [echo]    res.write("DEPRECATED: use Paginator instead")
> >     [echo] }
> >     [echo] ################################ after (var str):
> >     [echo] /**
> >     [echo]  * macro renders a link to signup if user is not 
> member of 
> > this site
> >     [echo]  * if user is member, it displays the level of membership
> >     [echo]  */
> >     [echo] function membership_macro(param) {
> >     [echo]    if (session.user == null || path.Site == null || 
> > path.Site.members.getMembershipRole(session.user) == null)
> >     [echo]       return;
> >     [echo]    res.write(I18n.getMessage("Membership.role." + 
> > path.Site.members.getMembershipRole(session.user)));
> >     [echo] }
> >     [echo]
> >     [echo]
> >     [echo] /**
> >     [echo]  * macro renders a table with all shareable layouts
> >     [echo]  * rendering a preview image, a preview button and some 
> > basic information
> >     [echo]  */
> >     [echo] function visualLayoutChooser_macro(param) {
> >     [echo]    res.write("DEPRECATED: use Paginator instead")
> >     [echo] }
> >
> >
> >
> > Anton
> >
> >
> 
> 
> 

Other related posts: