| 15 | | let U = liberator.plugins.libly.$U; |
| 16 | | |
| 17 | | let myname = __context__.NAME; |
| 18 | | |
| 19 | | let otags = liberator.eval('tags', liberator.plugins.pluginManager.list); |
| 20 | | let template = liberator.eval('template', liberator.plugins.pluginManager.list); |
| 21 | | |
| 22 | | // makeLink を無理矢理修正 |
| 23 | | let makeLink = liberator.eval('makeLink', liberator.plugins.pluginManager.list); |
| 24 | | liberator.plugins.pmwriter.makeLink = function (str) makeLink(str, true); |
| 25 | | liberator.log(makeLink) |
| 26 | | liberator.eval('makeLink = liberator.plugins.pmwriter.makeLink ', liberator.plugins.pluginManager.list); |
| 27 | | |
| 28 | | let linkTo; |
| 29 | | let tags = { |
| 30 | | __proto__: otags, |
| 31 | | name: function () <a href={linkTo}>{otags.name.apply(otags, arguments)}</a> |
| | 16 | let AUTHORS = { |
| | 17 | Trapezoid: 'http://unsigned.g.hatena.ne.jp/Trapezoid/', |
| | 18 | anekos: 'http://d.hatena.ne.jp/nokturnalmortum/', |
| | 19 | "halt feits": 'http://project-p.jp/halt/', |
| | 20 | hogelog: 'http://d.hatena.ne.jp/hogelog/', |
| | 21 | janus_wel: 'http://d.hatena.ne.jp/janus_wel/', |
| | 22 | mattn: 'http://mattn.kaoriya.net', |
| | 23 | pekepeke: 'http://d.hatena.ne.jp/pekepekesamurai/', |
| | 24 | pekepekesamurai: 'http://d.hatena.ne.jp/pekepekesamurai/', |
| | 25 | suVene: 'http://d.zeromemory.info/', |
| | 26 | teramako: 'http://d.hatena.ne.jp/teramako/', |
| 50 | | function Context (file) { |
| 51 | | this.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); |
| | 35 | let myname = __context__.NAME; |
| | 36 | |
| | 37 | let otags = liberator.eval('tags', liberator.plugins.pluginManager.list); |
| | 38 | let template = liberator.eval('template', liberator.plugins.pluginManager.list); |
| | 39 | |
| | 40 | // makeLink を無理矢理修正 |
| | 41 | let makeLink = liberator.eval('makeLink', liberator.plugins.pluginManager.list); |
| | 42 | liberator.plugins.pmwriter.makeLink = function (str) makeLink(str, true); |
| | 43 | liberator.log(makeLink) |
| | 44 | liberator.eval('makeLink = liberator.plugins.pmwriter.makeLink ', liberator.plugins.pluginManager.list); |
| | 45 | |
| | 46 | let linkTo; |
| | 47 | let tags = { |
| | 48 | __proto__: otags, |
| | 49 | name: function () <a href={linkTo}>{otags.name.apply(otags, arguments)}</a> |
| 73 | | for (let tag in tags){ |
| 74 | | plugin.orgInfo[tag] = info[tag]; |
| 75 | | let value = tags[tag](info); |
| 76 | | if (value && value.toString().length > 0){ |
| 77 | | plugin.push([tag, value]); |
| 78 | | plugin.info[tag] = value; |
| | 78 | context.watch('PLUGIN_INFO', function (n,N,O) { PLUGIN_INFO = O; throw 'STOP';}); |
| | 79 | |
| | 80 | try { services.get("subscriptLoader").loadSubScript(uri.spec, context); } catch (e) {} |
| | 81 | |
| | 82 | let info = PLUGIN_INFO; |
| | 83 | tags.name = function () <a href={linkTo}>{otags.name.apply(otags, arguments)}</a>; |
| | 84 | |
| | 85 | let plugin = [ ]; |
| | 86 | plugin['name'] = context.NAME; |
| | 87 | plugin['info'] = {}; |
| | 88 | plugin['orgInfo'] = {}; |
| | 89 | |
| | 90 | for (let tag in tags){ |
| | 91 | plugin.orgInfo[tag] = info[tag]; |
| | 92 | let value = tags[tag](info); |
| | 93 | if (value && value.toString().length > 0){ |
| | 94 | plugin.push([tag, value]); |
| | 95 | plugin.info[tag] = value; |
| | 96 | } |
| 85 | | let data = plugin.filter(function($_) /name|description|author/.test($_[0])); |
| 86 | | xml_index += template.table(plugin.name, data); |
| 87 | | }); |
| | 102 | let link = 'http://vimperator.kurinton.net/' + detailFilename; |
| | 103 | let alink = AUTHORS[info.author]; |
| | 104 | let data = plugin.filter(function($_) /name|description|author/.test($_[0])); |
| | 105 | xml_index += <tr class="plugin"> |
| | 106 | <td class="name"><a href={link} class="link">{plugin.name}</a></td> |
| | 107 | <td class="description">{plugin.info.description}</td> |
| | 108 | <td class="author"><a href={alink}>{info.author}</a></td> |
| | 109 | </tr> |
| | 110 | //xml_index += template.table(plugin.name, data); |
| | 111 | }); |
| 89 | | io.writeFile(io.getFile(outputDir + 'index.html'), xml_index.toString()); |
| | 113 | let js = "" + |
| | 114 | ""; |
| | 115 | let style = "table {border: solid 1px black; empty-cells: show;}"; |
| | 116 | let title = "Vimperator Plugins in CodeRepos"; |
| | 117 | |
| | 118 | xml_index = <html> |
| | 119 | <head> |
| | 120 | <title>{title}</title> |
| | 121 | <style><![CDATA[ |
| | 122 | {style} |
| | 123 | ]]></style> |
| | 124 | <script type="text/javascript" src="http://s.hatena.ne.jp/js/HatenaStar.js"></script> |
| | 125 | <script type="text/javascript"> |
| | 126 | Hatena.Star.Token = '48e8f4c633307a76a4dd923111e22a25e80b6e8a'; |
| | 127 | </script> |
| | 128 | <script type="text/javascript"><![CDATA[ |
| | 129 | Hatena.Star.SiteConfig = { |
| | 130 | entryNodes: { |
| | 131 | 'tr': { |
| | 132 | uri: "a.link", |
| | 133 | title: 'td.name', |
| | 134 | container: 'td.name' |
| | 135 | } |
| | 136 | } |
| | 137 | }; |
| | 138 | ]]></script> |
| | 139 | </head> |
| | 140 | <body> |
| | 141 | <h1>{title}</h1> |
| | 142 | <table> |
| | 143 | <tr> |
| | 144 | <td>Name</td> |
| | 145 | <td>Description</td> |
| | 146 | <td>Author</td> |
| | 147 | </tr> |
| | 148 | {xml_index} |
| | 149 | </table> |
| | 150 | </body> |
| | 151 | </html>; |
| | 152 | |
| | 153 | io.writeFile(io.getFile(outputDir + 'index.html'), xml_index.toString()); |
| | 154 | } |
| | 155 | |
| | 156 | commands.addUserCommand( |
| | 157 | ['pmwrite'], |
| | 158 | 'PMWriter', |
| | 159 | action, |
| | 160 | {}, |
| | 161 | true |
| | 162 | ); |