diff options
author | anekos | 2009-02-24 13:10:11 +0000 |
---|---|---|
committer | anekos | 2009-02-24 13:10:11 +0000 |
commit | 96e8b9cd2d2d086152a74b9147719b7abe3fcdbb (patch) | |
tree | f2983a071a2f51c8f3c4e299e48a5ddd07d27125 /PMWriter.js | |
parent | ae0201407c2b741d5b15c2d994ed3ffd8b928676 (diff) | |
download | vimperator-plugins-96e8b9cd2d2d086152a74b9147719b7abe3fcdbb.tar.bz2 |
info.xml 出力追加
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@30495 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'PMWriter.js')
-rw-r--r-- | PMWriter.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/PMWriter.js b/PMWriter.js index 6ff69c3..d4b93c6 100644 --- a/PMWriter.js +++ b/PMWriter.js @@ -51,6 +51,46 @@ .replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); }; + function fromUTF8Octets(octets){ + return decodeURIComponent(octets.replace(/[%\x80-\xFF]/g, function(c){ + return '%' + c.charCodeAt(0).toString(16); + })); + } + + function concatXML (xmls) { + let result = <></>; + xmls.forEach(function (xml) result += xml); + return result; + } + + function langList (info, name) { + let result = <></>; + let i = info.length(); + while (i-- > 0) { + if (info[i].@lang.toString()) { + result += <{name} lang={info[i].@lang.toString()}>{fromUTF8Octets(info[i].toString())}</{name}>; + } else { + result += <{name}>{fromUTF8Octets(info[i].toString())}</{name}>; + } + } + return result; + } + + function chooseByLang(info, lang) { + let result; + let i = info.length(); + while (i-- > 0) { + let it = info[i]; + if (!it.@lang) + result = it; + if (it.@lang.toString() == lang) { + result = it; + break; + } + } + return result; + } + let myname = __context__.NAME; let otags = liberator.eval('tags', liberator.plugins.pluginManager.list); @@ -65,6 +105,7 @@ let files = io.readDirectory(pluginDirPath); let indexHtml = <></>; let allHtml = <></>; + let pminfos = []; files.forEach(function (file) { if (!/\.js$/.test(file.path)) @@ -123,6 +164,18 @@ } } + // infoXML + { + pminfos.push( + <plugin> + {langList(pluginInfo.name, 'name')} + {langList(pluginInfo.description, 'description')} + {langList(pluginInfo.version, 'version')} + <updateURL>{CodeReposFile + pluginFilename}</updateURL> + </plugin> + ); + } + // プラグイン毎のドキュメント { let src = pluginInfo.detail.toString(); @@ -246,6 +299,9 @@ io.writeFile(io.getFile(outputDir + 'index.html'), indexHtml.toString()); io.writeFile(io.getFile(outputDir + 'all.html'), allHtml.toString()); + + let infoXML = <plugins>{concatXML(pminfos)}</plugins>; + io.writeFile(io.getFile(outputDir + 'info.xml'), infoXML.toString()); } commands.addUserCommand( |