From b4d7e25e090d081b024b46123a98a2e6441c8e46 Mon Sep 17 00:00:00 2001 From: anekos Date: Mon, 2 Mar 2009 15:05:25 +0000 Subject: なにかしらんけど、変更したのでコミット git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@30713 d0d07461-0603-4401-acd4-de1884942a52 --- PMWriter.js | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 11 deletions(-) (limited to 'PMWriter.js') diff --git a/PMWriter.js b/PMWriter.js index d4b93c6..a60fcb2 100644 --- a/PMWriter.js +++ b/PMWriter.js @@ -2,6 +2,7 @@ /* * さわるなきけん! * DO NOT USE! + * このコードを読むと失明する場合があります。 * */ @@ -39,6 +40,23 @@ //}; } + let langselector = +
+ + +
; + + //''); function action () { const IOService = services.get('io'); @@ -91,6 +109,26 @@ return result; } + function allLang (tag, info, utf, f) { + if (!f) + f = function (v) v; + + let ff = utf ? function (v) fromUTF8Octets(f(v).toString()) + : f + + if (!tag) + tag = 'div'; + + let result = <>; + + for (let i = 0, l = info.length(); i < l; i++) { + let it = info[i]; + result += <{tag} class={'lang-hide '+(i==0?"lang-default ":'')+(i==l-1?'lang-ja ':'')+"lang-"+(it.@lang.toString()||'default')}>{ff(it)}; + } + + return result; + } + let myname = __context__.NAME; let otags = liberator.eval('tags', liberator.plugins.pluginManager.list); @@ -178,16 +216,28 @@ // プラグイン毎のドキュメント { - let src = pluginInfo.detail.toString(); - //let detailBody = liberator.plugins.PMWikiParser(src.split(/\n/)); - let detailBody = plugin.info.detail + //let src = pluginInfo.detail.toString(); + let detailBody = allLang('div', + pluginInfo.detail, + false, + function (v) liberator.plugins.PMWikiParser.parse(fromUTF8Octets(v.toString()))); + //let detailBody = plugin.info.detail + let title = allLang('span', + pluginInfo.name, + true, + function (it) (it.toString() || '---')) + let description = allLang('span', + pluginInfo.description, + true, + function (it) (it.toString()) || '---') let body =
+
{langselector}
-

{plugin.info.name.toString()}

+

{title}

Description
-
{plugin.info.description || '---'}
+
{description}
Latest version
{plugin.info.version || '???'}
Vimperator version
@@ -199,7 +249,10 @@
Author
{authors}
License
-
{plugin.info.license || '--'}
+
{allLang('span', + pluginInfo.license, + true, + function (v) (v || '--'))}
@@ -210,7 +263,7 @@ io.getFile(outputDir + htmlFilename), - {plugin.info.name.toString()} + {pluginFilename} @@ -220,17 +273,15 @@ .toString() ); allHtml += body; - } - // index.html - { + // index.html indexHtml += {"\u2606"} {plugin.name} - {plugin.info.description} + {description} {authors} @@ -253,6 +304,7 @@ + {langselector}