From 96e8b9cd2d2d086152a74b9147719b7abe3fcdbb Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 24 Feb 2009 13:10:11 +0000 Subject: info.xml 出力追加 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@30495 d0d07461-0603-4401-acd4-de1884942a52 --- PMWriter.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'PMWriter.js') 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())}; + } else { + result += <{name}>{fromUTF8Octets(info[i].toString())}; + } + } + 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( + + {langList(pluginInfo.name, 'name')} + {langList(pluginInfo.description, 'description')} + {langList(pluginInfo.version, 'version')} + {CodeReposFile + pluginFilename} + + ); + } + // プラグイン毎のドキュメント { 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 = {concatXML(pminfos)}; + io.writeFile(io.getFile(outputDir + 'info.xml'), infoXML.toString()); } commands.addUserCommand( -- cgit v1.2.3