]> git.neil.brown.name Git - edlib.git/commitdiff
notmuch/w3m: add more html entities
authorNeilBrown <neil@brown.name>
Mon, 8 May 2023 11:43:15 +0000 (21:43 +1000)
committerNeilBrown <neil@brown.name>
Sat, 20 May 2023 00:10:49 +0000 (10:10 +1000)
Also ensure they get displayed...

Signed-off-by: NeilBrown <neil@brown.name>
lib-markup.c
python/lib-html-w3m.py
python/module-notmuch.py

index 1cb8fac557e79c730375c02890151d1a109249f1..36b3400a3137a9fad8ce99acd03953b40958eed6 100644 (file)
@@ -258,9 +258,8 @@ DEF_CB(text_attr_callback)
        struct attr_return *ar = container_of(ci->comm, struct attr_return,
                                              rtn);
        if (ci->num >= 0) {
-               if (!ci->str)
-                       return Enoarg;
-               as_add(ar, ci->num, ci->num2, ci->str);
+               if (ci->str)
+                       as_add(ar, ci->num, ci->num2, ci->str);
        } else
                as_clear(ar, ci->num2, ci->str);
        if (ci->str2)
index 0e629bbfbd019b0a9167126d95c06eb92668a395..f5a5c2f7c2687c98d934594b2a9269b70986eef8 100644 (file)
@@ -165,7 +165,17 @@ def parse_halfdump(doc):
         elif char == "emsp":
             char = " "
         elif char == "rsquo":
-            char = chr(8217)
+            char = chr(8217) # ’
+        elif char == "lsquo":
+            char = chr(8216) # ‘
+        elif char == "rdquo":
+            char = chr(8221) # ”
+        elif char == "ldquo":
+            char = chr(8220) # “
+        elif char == "copy":
+            char = chr(169) # ©
+        elif char == "reg":
+            char = chr(174) # ®
         else:
             char = "!" + char
         doc.call('doc:set-attr', 1, st, "render:char", "%d:%s" % (len,char))
index 769415c2194a489d0eaf13354e377dcdfca13236..6e58442a075a90065cf8d82cc7bafa99ddd960d5 100644 (file)
@@ -3502,12 +3502,12 @@ class notmuch_message_view(edlib.Pane):
         if str == "render:char":
             w = str2.split(':')
             attr = None
-            if w[1][0] == '!' and w[1] != '!':
+            if w[1] and  w[1][0] == '!' and w[1] != '!':
                 # not recognised, so highlight the name
                 attr = "fg:magenta-60,bold"
             comm2("attr:callback", focus, int(w[0]), mark,
-                  attr, 120, w[1])
-            # Don't show the htm entity description, just the rendering.
+                  attr, 120, str2=w[1])
+            # Don't show the html entity description, just the rendering.
             comm2("attr:callback", focus, int(w[0]), mark,
                   "hide", 60000)
         if str == 'start-of-line':