- Timestamp:
- 07/14/06 10:39:07 (2 years ago)
- Files:
-
- trunk/jsolait/jsolait.wsf (modified) (2 diffs)
- trunk/jsolait/lib/lang.js (modified) (5 diffs)
- trunk/jsolait/lib/strings.js (modified) (1 diff)
- trunk/tools/build.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/jsolait/jsolait.wsf
r8 r65 27 27 <named name="compile" helpstring="Specifies to run a the lang.parser on it." many="false" required="0" /> 28 28 <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" /> 30 30 </runtime> 31 31 … … 159 159 if(modl.__main__){ 160 160 //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 161 175 try{ 162 modl.__main__. call(modl,[]);176 modl.__main__.apply(modl,args); 163 177 }catch(e){ 164 178 throw new mod.Exception("runing %s __main__() failed\n".format(modl),e) trunk/jsolait/lib/lang.js
r42 r65 1055 1055 1056 1056 1057 var xmlText=function(s){ 1058 s=str(s); 1059 s= s.replace(/&/g,'&'); 1060 s= s.replace(/</g,'&th;'); 1061 s= s.replace(/>/g,'>'); 1062 return s; 1063 }; 1064 1065 1057 1066 mod.DocParser=Class(function(publ,supr){ 1058 1067 publ.__init__=function(file){ … … 1104 1113 publ.printModuleNode=function(n){ 1105 1114 this.pprint('<module>',4); 1106 this.pprint('<name>'+ n.name+'</name>');1115 this.pprint('<name>'+ xmlText(n.name)+'</name>'); 1107 1116 this.pprint('<description>', 4); 1108 this.pprint( n.description);1117 this.pprint(xmlText(n.description)); 1109 1118 this.pprint('</description>', -4); 1110 this.pprint('<dependencies>'+ n.dependencies+'</dependencies>');1119 this.pprint('<dependencies>'+xmlText(n.dependencies)+'</dependencies>'); 1111 1120 1112 1121 this.printPublics(n); … … 1117 1126 publ.printClassNode=function(n){ 1118 1127 this.pprint('<class>',4); 1119 this.pprint('<name>'+ n.name+'</name>');1128 this.pprint('<name>'+xmlText(n.name)+'</name>'); 1120 1129 1121 1130 this.pprint('<description>', 4); 1122 this.pprint( n.description);1131 this.pprint(xmlText(n.description)); 1123 1132 this.pprint('</description>', -4); 1124 1133 … … 1175 1184 publ.printPropertyNode=function(n){ 1176 1185 this.pprint('<property>',4); 1177 this.pprint('<name>' + n.name+ '</name>');1186 this.pprint('<name>' + xmlText(n.name )+ '</name>'); 1178 1187 this.pprint('<description>', 4); 1179 this.pprint( n.description);1188 this.pprint(xmlText(n.description)); 1180 1189 this.pprint('</description>', -4); 1181 1190 this.pprint('</property>',-4); … … 1185 1194 publ.printMethodNode=function(n){ 1186 1195 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>'); 1188 1197 this.pprint('<description>', 4); 1189 this.pprint( n.description);1198 this.pprint(xmlText(n.description)); 1190 1199 this.pprint('</description>', -4); 1191 1200 this.pprint('</method>',-4); trunk/jsolait/lib/strings.js
r64 r65 27 27 if(m){ 28 28 this.s=this.s.slice(m[1].length); 29 return m[1].replace(" ","") 29 return m[1].replace(" ",""); 30 30 }else{ 31 31 return; trunk/tools/build.js
r54 r65 122 122 }; 123 123 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 } 130 138 }; 131 139 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 } 133 160 134 161 this.gn = new lang.GlobalNode(); 135 162 136 163 createFolders(mod.buildPath); 164 createFolders(mod.docPath); 165 166 clearDir(fs.getFolder(mod.buildPath)); 167 clearDir(fs.getFolder(mod.docPath)); 168 137 169 138 170 mod.buildDir(fs.getFolder(mod.sourcePath), fs.getFolder(mod.buildPath)); 139 try{ 140 fs.createFolder(mod.docPath); 141 }catch(e){ 142 } 171 143 172 144 173 var dp = new lang.DocParser(fs.createTextFile(fs.buildPath(mod.docPath, 'doc.xml')), true);
