custom pronouns

代名詞を自分で定義する機能が(まだ)無いので,最も使用頻度が高いと思われる noun_arb_text を弄って擬似的に実現してみる。

--- nountypes.js	2008-10-19 18:55:40.000000000 +0900
+++ nountypes.js+	2008-11-11 10:19:53.598775700 +0900
@@ -94,8 +94,15 @@
 var noun_arb_text = {
   _name: "text",
   rankLast: true,
+  pronouns: [
+    { r: /\bhere\b/ig,
+      f: function() Application.activeWindow.activeTab.document.URL },
+  ],
   suggest: function( text, html ) {
-    return [ CmdUtils.makeSugg(text, html) ];
+    var sgs = [], p;
+    for each(p in this.pronouns) if(p.r.test(text))
+      sgs.push(CmdUtils.makeSugg(text.replace(p.r, p.f)));
+    return sgs.push(CmdUtils.makeSugg(text, html)), sgs;
   }
 };