Commits

Eric Fredricksen committed a0f451a

Get all emoji working at last

Comments (0)

Files changed (2)

   for rec in d['CVCategoryData']['Data'].split(','):
     if rec[:2] == '0x':
       rec = (r'\U' + rec[2:].zfill(8)).decode('unicode-escape')
-    ntt = re.sub(r"u'\\[uU]0*(.*)'", r"&#x\1;", repr(rec))
-    if ntt[0] != '&':
-      ntt = ''
-      for c in rec:
-        ntt += r"&#x" + hex(ord(c))[2:] + ';'
-      #print ntt, len(ntt), rec, len(rec), hex(ord(rec[0])), hex(ord(rec[1]))
-      #ntt = (ord(rec[0]) << 10) + ord(rec[1]) + 0x10000
-      #ntt = r"&#x" + hex(ord(rec[0]))[2:] + ";" + r"&#x" + hex(ord(rec[1]))[2:] + ";"
-      #print ntt
+    ntt = re.sub(r"u'(.*)'", r"\1", repr(rec))
+    ntt = re.sub(r"\\[xuU]0*([0-9a-fA-F]*)", r"&#x\1;", ntt)
+    if cdb[rec].find('REGIONAL') > -1: print rec, repr(rec), ntt
     emoji[category].append((ntt, cdb[rec]))
     if VERBOSE: print rec + '  ' + cdb[rec], ntt
   if VERBOSE: print
+<!DOCTYPE html>
+<head>
+<title>iOS Emoji</title>
 <style>
-* { 
-  font-family: AppleColorEmoji;
-  text-align: left;
-}
-td { white-space: nowrap }
+* { font-family: Menlo, sans serif; }
+td { white-space: nowrap; }
+th { font-family: AppleColorEmoji; }
+h2 { margin: 1ex 0 0 0 }
+table { border-spacing: 1em 0 }
 </style>
-
 <script src='emoji.js'></script>
+</head>
 
 <body>
+<h1>iOS Emoji</h1>
 <table></table>
-</body>
 
 <script>
 
 var body = document.getElementsByTagName('table')[0];
 categories.forEach(function (cat) {
     var tr = document.createElement('tr');
-    tr.innerHTML = '<th colspan=4><h2>' + cat + '<h2>';
+    tr.innerHTML = '<td colspan=4><h2>' + cat + '<h2>';
     body.appendChild(tr);
 
     emoji[cat].forEach(function (v) {
         var ntt = v[0], name = v[1];
         var tr = document.createElement('tr');
-        tr.innerHTML = ('<td>' + ntt + 
-                        '<td>' + ntt.replace('&','&amp;') + 
+        var esc = ntt.replace(/&/g,'&amp;');
+        var title = ntt + '  ' + esc + '\n' + name;
+        tr.innerHTML = ('<th title="' + title + '">' + ntt + 
+                        '<td class=ntt>' + esc + 
                         '<td>' + name);
+        if (name.indexOf('REGIONAL') > -1) console.log(tr.innerHTML)
         body.appendChild(tr);
       });
   });
 
 </script>
+
+</body>