Skip to content

Commit

Permalink
feat: 婺川、桑植、萬年梓埠
Browse files Browse the repository at this point in the history
  • Loading branch information
osfans committed Dec 17, 2024
1 parent 4d3eb09 commit 3c18ded
Show file tree
Hide file tree
Showing 53 changed files with 32,264 additions and 21,482 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
applicationId "com.osfans.mcpdict"
minSdkVersion 24
targetSdkVersion 34
versionCode 94
versionCode 95
versionName "5.7"
}

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/osfans/mcpdict/DisplayHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public String displayOne(String s) {
public static CharSequence getRichText(String richTextString) {
String s = richTextString
.replace("\n", "<br/>")
.replaceAll("\\*(.+?)\\*", "<b>$1</b>")
.replaceAll("\\|(.+?)\\|", "<span style='color: #808080;'>$1</span>");
.replaceAll("\\*\\*(.+?)\\*\\*", "<b>$1</b>")
.replaceAll("`(.+?)`", "<span style='color: #808080;'>$1</span>");
int i = Pref.getDisplayFormat();
if (i == 1) {
s = s.replace("{", "<small><small>").replace("}", "</small></small>");
Expand Down Expand Up @@ -109,8 +109,9 @@ public static CharSequence formatIPA(String lang, String string) {
}

public boolean isIPA(char c) {
int type = Character.getType(c);
if (HanZi.isHz(c)) return false;
if (c == '_' || c == '*' || c == '`') return false;
int type = Character.getType(c);
return Character.isLetterOrDigit(c)
|| type == Character.NON_SPACING_MARK
|| type == Character.MODIFIER_SYMBOL
Expand Down
4 changes: 4 additions & 0 deletions tools/tables/_數據庫.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class 表(_表):
_file = "mcpdict.db"
isYb = False

def format(self, line):
line = line.replace("|", "`").replace("*", "**")
return line

def update(self):
d = defaultdict(list)
conn = sqlite3.connect(self.spath)
Expand Down
12 changes: 9 additions & 3 deletions tools/tables/_縣志.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def format(self, line):
line = re.sub(r"^(.*?) ?\[", "\\1 [", line)
elif name in ("萍鄕","平陽","都昌陽峯"):
line = line.lstrip("∅︀")
elif name in ("遂川","大庸","大庸三眼橋"):
elif name in ("遂川","大庸","大庸三眼橋", "婺川"):
line = re.sub(r"\[(\d+)\]", lambda x:"[%s]"%self.dz2dl(x[1]), line)
elif name in ("奉化",):
line = re.sub(r"(\d+)(?![:\d])", lambda x:"[%s]"%self.dz2dl(x[1]), line)
Expand Down Expand Up @@ -73,8 +73,14 @@ def format(self, line):
line = line.replace(" ", "")
elif name in ("浦城觀前",):
line = line.replace("", "Ø").replace("", "")
line = re.sub("^(.*?)[", "\\1 [", line)
line = re.sub(r"‖(.){", "\\1{(連讀音)", line)
while (newline := re.sub(r"(?<=‖)([^[]]*[^‖]){", "\\1‖{", line)) != line:
line = newline
line = re.sub("‖{", "{(連讀音)", line)
elif name in ("福鼎白琳",):
line = re.sub(r"(‖)(\[\d+\])", "\\2\\1",line)
while (newline := re.sub(r"(?<=‖)([^\[\]]*[^‖]){", "\\1‖{", line)) != line:
line = newline
line = re.sub("‖{", "{(連讀音)", line)
elif name in ("建德"):
line = re.sub(r"\t2\d.*$", "", line)
elif name in ("屯溪船上話"):
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/_表.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def write(self, d):
for py in pys:
if "\t" in py:
yb, js = py.split("\t", 1)
js = js.strip().replace("~", "~")
js = js.strip().replace("~", "~").replace("...", "⋯").replace("∽", "~")
else:
yb, js = py, ""
yb = self.normYb(yb)
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/_跳跳老鼠.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def parse(self, fs):
hzs = self.normS(hzs)
elif name in ("思南塘頭",):
sy, sd, hzs = fs[:3]
hzs = hzs.replace("∽", "~").replace(" ", "")
hzs = hzs.replace(" ", "")
hzs = self.normS(hzs)
elif name in ("桃源薛家沖",):
sy, sd, _, _, hzs = fs[:5]
Expand Down
379 changes: 379 additions & 0 deletions tools/tables/data/务川字表初版.tsv

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 3c18ded

Please sign in to comment.