From 282bc0e3fa3b8b413ea4a12d90709d64a3aee106 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 15:31:44 -0500 Subject: Add horribly formatted :help versions page. --HG-- extra : transplant_source : %C3%C4%DAw9%B5%A8%3B%03y%9F%91X%1A%0Fk%14%B0%9F%02 --- common/content/dactyl.js | 66 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/content/dactyl.js b/common/content/dactyl.js index f05f893e..332f5672 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -619,8 +619,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { }); // Process plugin help entries. - XML.ignoreWhiteSpace = false; - XML.prettyPrinting = false; + XML.ignoreWhiteSpace = XML.prettyPrinting = false; let body = XML(); for (let [, context] in Iterator(plugins.contexts)) @@ -654,6 +653,69 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { .toXMLString())); fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help]; + fileMap["versions"] = function () { + let NEWS = util.httpGet(config.addon.getResourceURI("NEWS").spec).responseText; + + let re = util.regexp( \s*) + (?P [-*+]) \x20 + (?P .*\n + (?: \1\x20\x20.*\n | \s*\n)* ) + | + (?P + (?: ^ [^\S\n]* + (?:[^-*+\s] | [-*+]\S) + .*\n + )+ + ) + | + (?: ^ [^\S\n]* \n) + + ]]>, "gmy"); + + default xml namespace = NS; + function rec(text, level) { + let res = <>; + let list, space; + + for (let match in re.iterate(text)) { + if (match.char) { + if (!list) + res += list =
    ; + list.* +=
  • {rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1)}
  • ; + } + else if (match.par) { + list = null; + if (level == 0 && /^.*:\n$/.test(match.par)) + res +=

    {template.linkifyHelp(match.par.slice(0, -1), true)}

    ; + else { + let [, a, b] = /^(IMPORTANT:?)?([^]*)/.exec(match.par); + res +=

    { + a ? {a} : "" + }{ + template.linkifyHelp(b, true) + }

    ; + } + } + } + return res; + } + + XML.prettyPrinting = XML.ignoreWhitespace = false; + return ["application/xml", + '\n' + + '\n' + + '\n' + + unescape(encodeURI( // UTF-8 handling hack. + +

    Versions

    + + + {rec(NEWS, 0)} +
    .toXMLString())) + ] + } + default xml namespace = NS; overlayMap["index"] = function () ['text/xml;charset=UTF-8', -- cgit v1.2.3