Changeset 65 for trunk

Show
Ignore:
Timestamp:
07/14/06 10:39:07 (2 years ago)
Author:
Jan-Klaas Kollhof
Message:

fixing ticket:16 ticket:22 adn some missing ;

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/jsolait/jsolait.wsf

    r8 r65  
    2727        <named name="compile" helpstring="Specifies to run a the lang.parser on it." many="false" required="0" /> 
    2828        <unnamed name="filename" helpstring="The scriptfiles to run." many="false" required="1" /> 
    29         <named name="script arguments" helpstring="Specifies arguments to pass to the module/script being run" many="false" required="0" /> 
     29        <named name="script-args" helpstring="Specifies arguments to pass to the module/script being run. This may be text or a JSON encoded object" many="false" required="0" /> 
    3030    </runtime> 
    3131     
     
    159159                        if(modl.__main__){ 
    160160                            //todo find arguments 
     161                            if(WScript.arguments.named.exists("script-args")){ 
     162                                var args = WScript.arguments.named.Item("script-args"); 
     163                                switch(args.slice(0,1)){ 
     164                                    case "{": case "'":  case "[":  case '"': 
     165                                        break; 
     166                                    default: 
     167                                        args = repr(args); 
     168                                } 
     169                                f=new Function( "return " + args); 
     170                                args = [f()]; 
     171                            }else{ 
     172                                var args =[]; 
     173                            } 
     174                             
    161175                            try{ 
    162                                 modl.__main__.call(modl,[]); 
     176                                modl.__main__.apply(modl,args); 
    163177                            }catch(e){ 
    164178                                throw new mod.Exception("runing %s  __main__()  failed\n".format(modl),e) 
  • trunk/jsolait/lib/lang.js

    r42 r65  
    10551055     
    10561056    
     1057    var xmlText=function(s){ 
     1058        s=str(s); 
     1059        s= s.replace(/&/g,'&amp;'); 
     1060        s= s.replace(/</g,'&th;'); 
     1061        s= s.replace(/>/g,'&gt;'); 
     1062        return s; 
     1063    }; 
     1064    
     1065    
    10571066    mod.DocParser=Class(function(publ,supr){ 
    10581067        publ.__init__=function(file){ 
     
    11041113        publ.printModuleNode=function(n){ 
    11051114           this.pprint('<module>',4); 
    1106            this.pprint('<name>'+n.name+'</name>'); 
     1115           this.pprint('<name>'+ xmlText(n.name)+'</name>'); 
    11071116           this.pprint('<description>', 4); 
    1108            this.pprint(n.description); 
     1117           this.pprint(xmlText(n.description)); 
    11091118           this.pprint('</description>', -4); 
    1110            this.pprint('<dependencies>'+n.dependencies+'</dependencies>'); 
     1119           this.pprint('<dependencies>'+xmlText(n.dependencies)+'</dependencies>'); 
    11111120             
    11121121            this.printPublics(n); 
     
    11171126        publ.printClassNode=function(n){ 
    11181127           this.pprint('<class>',4); 
    1119            this.pprint('<name>'+n.name+'</name>'); 
     1128           this.pprint('<name>'+xmlText(n.name)+'</name>'); 
    11201129             
    11211130           this.pprint('<description>', 4); 
    1122            this.pprint(n.description); 
     1131           this.pprint(xmlText(n.description)); 
    11231132           this.pprint('</description>', -4); 
    11241133             
     
    11751184        publ.printPropertyNode=function(n){ 
    11761185           this.pprint('<property>',4); 
    1177            this.pprint('<name>' + n.name + '</name>'); 
     1186           this.pprint('<name>' + xmlText(n.name )+ '</name>'); 
    11781187           this.pprint('<description>', 4); 
    1179            this.pprint(n.description); 
     1188           this.pprint(xmlText(n.description)); 
    11801189           this.pprint('</description>', -4); 
    11811190           this.pprint('</property>',-4); 
     
    11851194        publ.printMethodNode=function(n){ 
    11861195           this.pprint('<method>',4); 
    1187            this.pprint('<name>' + n.name + '(' + n.parameters.join(', ') +  ')</name>'); 
     1196           this.pprint('<name>' + xmlText(n.name + '(' + n.parameters.join(', ') )+  ')</name>'); 
    11881197           this.pprint('<description>', 4); 
    1189            this.pprint(n.description); 
     1198           this.pprint(xmlText(n.description)); 
    11901199           this.pprint('</description>', -4); 
    11911200           this.pprint('</method>',-4); 
  • trunk/jsolait/lib/strings.js

    r64 r65  
    2727                if(m){ 
    2828                    this.s=this.s.slice(m[1].length); 
    29                     return m[1].replace(" ","") 
     29                    return m[1].replace(" ",""); 
    3030                }else{ 
    3131                    return; 
  • trunk/tools/build.js

    r54 r65  
    122122    }; 
    123123     
    124     var createFolders=function(path){ 
    125         var pf = fs.GetParentFolderName(path); 
    126         if(! fs.FolderExists(pf)){ 
    127             createFolders(pf); 
    128         } 
    129         fs.CreateFolder(path); 
     124    var clearDir=function(folder){ 
     125        var sfe = new Enumerator(folder.Files); 
     126        var f; 
     127        for (;!sfe.atEnd(); sfe.moveNext()){ 
     128             f = sfe.item(); 
     129             f.Delete(); 
     130        }    
     131         
     132        var sfe = new Enumerator(folder.SubFolders); 
     133        var f; 
     134        for (;!sfe.atEnd(); sfe.moveNext()){ 
     135             f = sfe.item(); 
     136             f.Delete(); 
     137        }    
    130138    }; 
    131139     
    132     mod.__main__=function(){ 
     140    var createFolders=function(path){ 
     141        if(! fs.FolderExists(path)){ 
     142            var pf = fs.GetParentFolderName(path); 
     143            if(! fs.FolderExists(pf)){ 
     144                createFolders(pf); 
     145            } 
     146            fs.CreateFolder(path); 
     147        } 
     148    }; 
     149     
     150    mod.__main__=function(args){ 
     151                 
     152        if(args){ 
     153            if(args.buildPath){ 
     154                mod.buildPath=args.buildPath; 
     155            } 
     156             if(args.docPath){ 
     157                mod.docPath=args.docPath; 
     158            } 
     159        } 
    133160         
    134161        this.gn = new lang.GlobalNode(); 
    135162         
    136163        createFolders(mod.buildPath); 
     164        createFolders(mod.docPath); 
     165         
     166        clearDir(fs.getFolder(mod.buildPath)); 
     167        clearDir(fs.getFolder(mod.docPath)); 
     168                       
    137169         
    138170        mod.buildDir(fs.getFolder(mod.sourcePath), fs.getFolder(mod.buildPath)); 
    139         try{ 
    140             fs.createFolder(mod.docPath); 
    141         }catch(e){ 
    142         } 
     171 
    143172         
    144173        var dp = new lang.DocParser(fs.createTextFile(fs.buildPath(mod.docPath, 'doc.xml')), true);