//libraryMd 库参考 import ide.doc.library; namespace ide.doc; class libraryMd{ ctor( fullpath,aiKnowledge ){ { var builtin = {table=1;string=1;raw=1;io=1;com=1;math=1;time=1;thread=1;fiber=1;global=1;builtin=1 }; var builtinLibName = ..string.match(fullpath,"~[\\/]lib[\\/](\w+)[\\/]_.|<.md>") || fullpath; if( builtin[builtinLibName] ){ fullpath = "builtin"; } else { if(builtinLibName == "ide"){ fullpath = "ide"; } else{ if( fullpath == "win.form" ) fullpath = "win.ui"; if( !..io.exist(fullpath) && ..string.match(fullpath,"^[a-zA-Z][\w\.]+$") ){ var p = fullpath; fullpath = ..io.libpath(p); if(!fullpath){ fullpath = ..io.libpath("win.ui.ctrl." + p); } } if( !..io.exist(fullpath) ) return; } builtinLibName = null; } this = ..ide.doc.library( fullpath ); if(!this) return; if( builtinLibName ){ if(builtinLibName=="builtin" || builtinLibName=="kernel"){ } else{ var sections = { [builtinLibName] = this.sections[builtinLibName]; [builtinLibName+"Object"] = this.sections[builtinLibName+"Object"]; }; if(builtinLibName=="global"){ sections["logfontObject"] = this.sections["logfontObject"]; sections["type"] = this.sections["type"]; sections["sizeObject"] = this.sections["sizeObject"]; sections["rectObject"] = this.sections["rectObject"]; sections["_ARGV"] = this.sections["_ARGV"]; sections["::Shell32"] = this.sections["::Shell32"]; sections["::Kernel32"] = this.sections["::Kernel32"]; sections["::User32"] = this.sections["::User32"]; sections["SubscriberObject"] = this.sections["SubscriberObject"]; sections["_IMPORTURL"] = this.sections["_IMPORTURL"]; }; if(builtinLibName=="fiber"){ sections["fiber.status"] = this.sections["fiber.status"]; }; if(builtinLibName=="raw"){ sections["dllModuleObject"] = this.sections["dllModuleObject"]; sections["rawNumberObject"] = this.sections["rawNumberObject"]; }; if(builtinLibName=="com"){ sections["comVariantObject"] = this.sections["comVariantObject"]; sections["comtypelibObject"] = this.sections["comtypelibObject"]; sections["comtypeinfoObject"] = this.sections["comtypeinfoObject"]; sections["embedObject"] = this.sections["embedObject"]; sections["embedObject._host"] = this.sections["embedObject._host"]; for k,v in ..table.eachName(this.sections){ if(..string.startsWith(k,"com",true)){ sections[k] = this.sections[k] } } }; if(builtinLibName=="math"){ sections["mathSize64Object"] = this.sections["mathSize64Object"]; }; if(builtinLibName=="io"){ sections["fileObject"] = this.sections["fileObject"]; sections["ioFileObject"] = this.sections["ioFileObject"]; sections["io.file"] = this.sections["io.file"]; }; if(builtinLibName=="time"){ sections["timeObject"] = this.sections["timeObject"]; }; if(builtinLibName!="global") { this.define = null;this.const = null; } else { sections["rectObject"] = this.sections["rectObject"]; sections["pointObject"] = this.sections["pointObject"]; sections["sizeObject"] = this.sections["sizeObject"]; } this.sections = sections; } this.libPath = builtinLibName; this.fileName = builtinLibName; this.filePath = builtinLibName; } var tOutput = {}; ..table.push(tOutput,"# ",this.libPath," 库模块帮助文档",'\r\n' ); if(this.details && this.detailsSummary){ ..table.push(tOutput, '\r\n\r\n
'+this.detailsSummary+'

'+this.details +'

','\r\n\r\n'); } if(this.guide){ ..table.push(tOutput, '\r\n\r\n',this.guide,'\r\n\r\n'); } var sortNames; if( this.libPath ) { sortNames = { this.libPath;this.libPath + "Object"}; var h = ..string.match(this.libPath,"^[^.]+"); if( h != this.libPath ) ..table.unshift(sortNames,h); if( this.libPath == "win.ui" ) sortNames = { "win.ui";"win.form";"winform"}; elseif( this.libPath == "web.form" ) sortNames = { "web";"web.form";"wb"}; elseif( this.libPath == "web.layout" ) sortNames = { "web.layout";"wbLayout"}; elseif( ..string.startsWith(this.libPath,"win.ui.ctrl.",true) ){ sortNames = { "win.ui.ctrl";..string.match(this.libPath,"[^.]+$") + "Object"}; } }; var hid = function(id){ if(aiKnowledge) return ""; id = ..string.replace(id,"\.[\?\*]",".any"); return '#' } for(path,section in ..table.eachName(this.sections,,sortNames)){ if(!..table.next(section) ) continue; ..table.push(tOutput, '\r\n## ',#path? path : "全局对象",' 成员列表 ',hid(#path? path : "global"),'\r\n' ,'\r\n'); if( section[path] ){ var v = section[path]; if( ..string.startsWith(v,path) ){ v = ..string.right(v,-(#path+1)); } ..table.push(tOutput,v,'\r\n'); section[path] = null; } if( path == "global" ){ for(k,v in ..table.eachName(section)){ if( globalkw[[k]] ) continue; if( ..io.libpath(k) ) continue; k = ..string.replace(k,"\.\?",".*"); ..table.push(tOutput,'\r\n### ',k,' ' ,hid( ..string.match(k,"(.+\.[^.]+)\(") or k ),'\r\n'); ..table.push(tOutput, ..string.replace(v,"#\s+","# "),'\r\n' ); } } else { for(k,v in ..table.eachName(section)){ k = ..string.replace(k,"\.\?",".*"); ..table.push(tOutput,'\r\n### ',k,' ', hid( ..string.match(k,"(.+\.[^.]+)\(") or k ),'\r\n'); ..table.push(tOutput, ..string.replace(v,"#\s+","# "),'\r\n' ); } } } if( this.const ){ ..table.push(tOutput, '\r\n',"### 全局常量",'\r\n'); for(k,v in ..table.eachName(this.const)){ if( ..io.libpath(k) ) continue; ..table.push(tOutput,'\r\n\r\n### ',k,' ',hid(..string.match(k,"(.+\.[^.]+)\(") or k ),'\r\n'); ..table.push(tOutput, v,'\r\n' ); } } if( this.define ){ ..table.push(tOutput, '\r\n\r\n',"### 自动完成常量",'\r\n'); for(k,v in ..table.eachName(this.define)){ if( ..string.indexOf(v,'\n') ) continue ; ..table.push(tOutput,k,"=",v,' \r\n'); } } this.outputString = ..string.join(tOutput); this.outputString = ..string.replace(this.outputString,"\]\(doc\://","](/"); this.outputString = ..string.crlf(this.outputString,'\r\n',1); } }; @_meta; } namespace libraryMd{ _meta = { _tostring = function(){ return owner.outputString; } } globalkw = { ["and"] = 1;["or"] = 1;["not"] = 1;["class"] = 1;["function"] = 1;["if"] = 1;["for"] = 1;["while"] = 1;["do"] = 1;["do_while_false"] = 1;["do_标记"] = 1; ["break"] = 1;["continue"] = 1;["else"] = 1;["elseif"] = 1;["begin"] = 1;["end"] = 1;["true"] = 1;["false"] = 1;["if"] = 1;["import"] = 1;["intellisense代码模式"] = 1; ["intellisense注释模式"] = 1;["this"] = 1;["owner"] = 1;["global"] = 1;["self"] = 1;["null"] = 1;["select"] = 1;["forin"] = 1;["trycatch"] = 1;["try"] = 1;["return"] = 1; ["var"] = 1;["def"] = 1;["protobuf"] = 1;["zeromq "] = 1;["while_var"] = 1;["while_标记"] = 1; } } /*intellisense(ide.doc) libraryMd(.("库路径") = 返回对象可使用 tostring 函数转换为 Markdown 格式文档\n参数可以是库完整路径或命名空间 libraryMd() = !libDocument. end intellisense*/