- Create Economist SubmissionTracking package correctly: * mainArticle = full blog post content * coverLetter = 216-word SIR— letter * Links to blog post via blogPostId - Archive 'Letter to The Economist' from blog posts (it's the cover letter) - Fix date display on article cards (use published_at) - Target publication already displaying via blue badge Database changes: - Make blogPostId optional in SubmissionTracking model - Economist package ID: 68fa85ae49d4900e7f2ecd83 - Le Monde package ID: 68fa2abd2e6acd5691932150 Next: Enhanced modal with tabs, validation, export 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
def _makeunicodes(f):
|
|
lines = iter(f.readlines())
|
|
unicodes = {}
|
|
for line in lines:
|
|
if not line:
|
|
continue
|
|
num, name = line.split(";")[:2]
|
|
if name[0] == "<":
|
|
continue # "<control>", etc.
|
|
num = int(num, 16)
|
|
unicodes[num] = name
|
|
return unicodes
|
|
|
|
|
|
class _UnicodeCustom(object):
|
|
def __init__(self, f):
|
|
if isinstance(f, str):
|
|
with open(f) as fd:
|
|
codes = _makeunicodes(fd)
|
|
else:
|
|
codes = _makeunicodes(f)
|
|
self.codes = codes
|
|
|
|
def __getitem__(self, charCode):
|
|
try:
|
|
return self.codes[charCode]
|
|
except KeyError:
|
|
return "????"
|
|
|
|
|
|
class _UnicodeBuiltin(object):
|
|
def __getitem__(self, charCode):
|
|
try:
|
|
# use unicodedata backport to python2, if available:
|
|
# https://github.com/mikekap/unicodedata2
|
|
import unicodedata2 as unicodedata
|
|
except ImportError:
|
|
import unicodedata
|
|
try:
|
|
return unicodedata.name(chr(charCode))
|
|
except ValueError:
|
|
return "????"
|
|
|
|
|
|
Unicode = _UnicodeBuiltin()
|
|
|
|
|
|
def setUnicodeData(f):
|
|
global Unicode
|
|
Unicode = _UnicodeCustom(f)
|