From f59163e9f81c0e92c8d6879f91df938cff30019a Mon Sep 17 00:00:00 2001 From: Yao Wei Date: Mon, 6 Nov 2017 20:00:32 +0800 Subject: [PATCH] fix: use close neighbors in openClosedUniGenerator.py This is to address part of the problems in #140 that some open parentheses does not match the closed ones. These would only leave special exceptions and ornate parentheses (which is because of reversed order in the data) needed to be appended. --- tools/openClosedUniGenerator.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tools/openClosedUniGenerator.py b/tools/openClosedUniGenerator.py index 9efa739b..44377afe 100644 --- a/tools/openClosedUniGenerator.py +++ b/tools/openClosedUniGenerator.py @@ -13,19 +13,13 @@ for line in text.splitlines(): line = line.split(";") value, name, category = line[:3] - if category in ("Ps", "Pe", "Pi", "Pf"): - if openValue is None: + if category in ("Ps", "Pi"): #assert category in ("Ps", "Pi") openValue = (value, name, category) - else: - #assert category in ("Pe", "Pf") - if category not in ("Pe", "Pf"): - result.append("#%s;%s;%s" % (value, name, category)) - result.append("") - else: - result.append("%s;%s;%s" % openValue) - result.append("%s;%s;%s" % (value, name, category)) - result.append("") - openValue = None + elif category in ("Pe", "Pf") and openValue is not None: + result.append("%s;%s;%s" % openValue) + result.append("%s;%s;%s" % (value, name, category)) + result.append("") + openValue = None print("\n".join(result))