]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/modules/template.jsm
Import 1.0b7.1 supporting Firefox up to 8.*
[dactyl.git] / common / modules / template.jsm
index 8a398c2e148c1fab6e153a2a2eaf0320c316443b..6e18dc506c676e085153eebcfb9f338d1dfe68be 100644 (file)
@@ -119,7 +119,7 @@ var Template = Module("Template", {
                 "click": function onClick(event) {
                     event.preventDefault();
                     if (this.commandAllowed) {
-                        if (set.has(this.target.commands || {}, this.command))
+                        if (Set.has(this.target.commands || {}, this.command))
                             this.target.commands[this.command].call(this.target);
                         else
                             this.target.command(this.command);
@@ -128,7 +128,7 @@ var Template = Module("Template", {
             },
 
             get commandAllowed() {
-                if (set.has(this.target.allowedCommands || {}, this.command))
+                if (Set.has(this.target.allowedCommands || {}, this.command))
                     return this.target.allowedCommands[this.command];
                 if ("commandAllowed" in this.target)
                     return this.target.commandAllowed(this.command);
@@ -197,7 +197,7 @@ var Template = Module("Template", {
                       - from pushing the baseline down and enlarging
                       - the row.
                       -->
-                   <li highlight="CompResult">{text}&#xa0;</li>
+                   <li highlight={"CompResult " + item.highlight}>{text}&#xa0;</li>
                    <li highlight="CompDesc">{desc}&#xa0;</li>
                </div>;
         // </e4x>
@@ -213,7 +213,7 @@ var Template = Module("Template", {
         else if (/^n_/.test(topic))
             topic = topic.slice(2);
 
-        if (services["dactyl:"].initialized && !set.has(services["dactyl:"].HELP_TAGS, topic))
+        if (services["dactyl:"].initialized && !Set.has(services["dactyl:"].HELP_TAGS, topic))
             return <span highlight={type || ""}>{text || token}</span>;
 
         XML.ignoreWhitespace = false; XML.prettyPrinting = false;
@@ -233,7 +233,7 @@ var Template = Module("Template", {
         else if (/^n_/.test(topic))
             topic = topic.slice(2);
 
-        if (services["dactyl:"].initialized && !set.has(services["dactyl:"].HELP_TAGS, topic))
+        if (services["dactyl:"].initialized && !Set.has(services["dactyl:"].HELP_TAGS, topic))
             return <>{token}</>;
 
         XML.ignoreWhitespace = false; XML.prettyPrinting = false;
@@ -247,7 +247,7 @@ var Template = Module("Template", {
     linkifyHelp: function linkifyHelp(str, help) {
         let re = util.regexp(<![CDATA[
             (?P<pre> [/\s]|^)
-            (?P<tag> '[\w-]+' | :(?:[\w-]+!?|!) | (?:._)?<[\w-]+>\w* | [a-zA-Z]_\w+ | \[[\w-]+\] | E\d{3} )
+            (?P<tag> '[\w-]+' | :(?:[\w-]+!?|!) | (?:._)?<[\w-]+>\w* | \b[a-zA-Z]_(?:\w+|.) | \[[\w-]+\] | E\d{3} )
             (?=      [[\)!,:;./\s]|$)
         ]]>, "gx");
         return this.highlightSubstrings(str, (function () {
@@ -349,7 +349,7 @@ var Template = Module("Template", {
 
     highlightURL: function highlightURL(str, force) {
         if (force || /^[a-zA-Z]+:\/\//.test(str))
-            return <a highlight="URL" href={str}>{str}</a>;
+            return <a highlight="URL" href={str}>{util.losslessDecodeURI(str)}</a>;
         else
             return str;
     },
@@ -363,7 +363,9 @@ var Template = Module("Template", {
         // <e4x>
         return <table>
                 <tr style="text-align: left;" highlight="Title">
-                    <th colspan="2">jump</th><th>title</th><th>URI</th>
+                    <th colspan="2">{_("title.Jump")}</th>
+                    <th>{_("title.Title")}</th>
+                    <th>{_("title.URI")}</th>
                 </tr>
                 {
                     this.map(Iterator(elems), function ([idx, val])
@@ -371,7 +373,7 @@ var Template = Module("Template", {
                         <td class="indicator">{idx == index ? ">" : ""}</td>
                         <td>{Math.abs(idx - index)}</td>
                         <td style="width: 250px; max-width: 500px; overflow: hidden;">{val.title}</td>
-                        <td><a href={val.URI.spec} highlight="URL jump-list">{val.URI.spec}</a></td>
+                        <td><a href={val.URI.spec} highlight="URL jump-list">{util.losslessDecodeURI(val.URI.spec)}</a></td>
                     </tr>)
                 }
             </table>;
@@ -494,7 +496,7 @@ var Template = Module("Template", {
                             let (name = item.name || item.names[0], frame = item.definedAt)
                                 !frame ? name :
                                     template.helpLink(help(item), name, "Title") +
-                                    <span highlight="LinkInfo" xmlns:dactyl={NS}>Defined at {sourceLink(frame)}</span>
+                                    <span highlight="LinkInfo" xmlns:dactyl={NS}>{_("io.definedAt")} {sourceLink(frame)}</span>
                         }</span>
                     </td>
                     { item.columns ? template.map(item.columns, function (c) <td>{c}</td>) : "" }