From c4e5c09dbcfa26dde90d9cf8d4e2692e79109d73 Mon Sep 17 00:00:00 2001
From: Alex Xu <alex_y_xu@yahoo.ca>
Date: Wed, 31 Jul 2013 22:39:36 -0400
Subject: fix extend, this time for real

---
 www/js/api.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'www/js')

diff --git a/www/js/api.js b/www/js/api.js
index 4454521..316c9a6 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -324,18 +324,25 @@ window.html5ks.api = {
         w = /{w(=\d*\.\d*)?}/.exec(str);
 
     if (!char) {
-      char = {
-        name: name,
-      };
+      if (name) {
+        char = {
+          name: name,
+        };
+      } else {
+        char = this._lastchar;
+      }
     }
     if (typeof char.what_prefix === "undefined") {
       char.what_prefix = "“";
       char.what_suffix = "”";
     }
+
+    this._lastchar = char;
+
     if (!extend && char.what_prefix) {
       text = char.what_prefix + text;
     }
-    if ((!w || !w[1]) && !extend && char.what_suffix) {
+    if ((!w || !w[1]) && char.what_suffix) {
       text = text + char.what_suffix;
     }
 
-- 
cgit v1.2.3-70-g09d2