/* * さわるなきけん! * DO NOT USE! * */ (function(){ const U = liberator.plugins.libly.$U; let pluginDirPath = liberator.globalVariables.pmwriter_plugin_dir; let outputDir = liberator.globalVariables.pmwriter_output_dir; if (!(pluginDirPath && outputDir)) return; if (!liberator.plugins.pmwriter) liberator.plugins.pmwriter = {}; // make を改造 { let makeLink = liberator.eval('makeLink', liberator.plugins.pluginManager.list); if (!liberator.plugins.pmwriter.makeLink) { liberator.plugins.pmwriter.makeLink = function (str) makeLink(str, true); liberator.eval('makeLink = liberator.plugins.pmwriter.makeLink ', liberator.plugins.pluginManager.list); } let WikiParser = liberator.eval('WikiParser', liberator.plugins.pluginManager.list); WikiParser.prototype.inlineParse = function (str) { function replacer(_, s) ({ '<': '<', '>': '>', '&': '&' })[s] || '' + s + ''; try { return XMLList(str.replace(/(>|<|&|(?:https?:\/\/|mailto:)\S+)/g, replacer)); } catch (e) { return XMLList(str); } }; } function action () { const IOService = services.get('io'); const DOCUMENT_TITLE = 'Vimperator Plugins in CodeRepos'; const CodeRepos = 'http://coderepos.org/share/browser/lang/javascript/vimperator-plugins/trunk/'; function Context (file) { this.NAME = file.leafName.replace(/\..*/, '') .replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); }; let myname = __context__.NAME; let otags = liberator.eval('tags', liberator.plugins.pluginManager.list); let template = liberator.eval('template', liberator.plugins.pluginManager.list); let linkTo; let tags = { __proto__: otags, name: function () {otags.name.apply(otags, arguments)} }; let files = io.readDirectory(pluginDirPath); let indexHtml = <>>; files.forEach(function (file) { if (!/\.js$/.test(file.path)) return; if (!/PLUGIN_INFO/.test(io.readFile(file.path))) return; let context = new Context(file); let pluginName = file.leafName.replace(/\..*$/, ''); let pluginFilename = file.leafName; if (context.NAME == myname) return; let pluginInfo; let htmlFilename = pluginName + '.html'; context.watch('PLUGIN_INFO', function (n, O, N) { pluginInfo = N; throw 'STOP';}); try { services.get("subscriptLoader").loadSubScript(IOService.newFileURI(file).spec, context); } catch (e) { /* DO NOTHING */ } tags.name = function () {otags.name.apply(otags, arguments)}; let plugin = []; let (info = pluginInfo) { plugin['name'] = pluginName; plugin['info'] = {}; plugin['orgInfo'] = {}; for (let tag in tags){ plugin.orgInfo[tag] = info[tag]; let value = tags[tag](info); if (value && value.toString().length > 0){ plugin.push([tag, value]); plugin.info[tag] = value; } } } let authors; { for each (let a in pluginInfo.author) { let hp = a.@homepage.toString(); let xml = hp ? {a.toString()} : {a.toString()} if (authors) authors += , + xml; else authors = xml; } } // プラグイン毎のドキュメント { io.writeFile( io.getFile(outputDir + htmlFilename),
Name | Description | Author |
---|