Skip to content

Commit

Permalink
Merge pull request #953 from xxyzz/zh
Browse files Browse the repository at this point in the history
[zh] fix TypeError exception and silence Lua errors in "rfdef" template
  • Loading branch information
xxyzz authored Dec 23, 2024
2 parents d8cb2f3 + 6095746 commit bb1d1ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/wiktextract/extractor/zh/gloss.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def extract_gloss(
gloss_data = parent_gloss_data.model_copy(deep=True)
for node in list_item_node.children:
if isinstance(node, TemplateNode):
if node.template_name == "rfdef":
continue
raw_tag = clean_node(wxr, gloss_data, node)
if node.template_name in LABEL_TEMPLATES:
raw_tags.extend(raw_tag.strip("()").split(","))
Expand Down
5 changes: 1 addition & 4 deletions src/wiktextract/extractor/zh/section_titles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

POS_TITLES: dict[str, POSSubtitleData] = {
"不及物动词": {"pos": "verb", "tags": ["intransitive"]},
"不及物動詞": {
"pos": "verb",
"tags": ["intransitive"]
},
"不及物動詞": {"pos": "verb", "tags": ["intransitive"]},
"不定代词": {"pos": "pron"},
"不定冠詞": {"pos": "article"},
"不定冠词": {"pos": "article"},
Expand Down
6 changes: 5 additions & 1 deletion src/wiktextract/extractor/zh/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ def translation_subpage(
target_section = None
if template_node.template_name == "see translation subpage":
target_section = template_node.template_parameters.get(1)
page_title = template_node.template_parameters.get(2, wxr.wtp.title)
page_title = clean_node(
wxr, None, template_node.template_parameters.get(2, wxr.wtp.title)
)
if "#" in page_title:
page_title = page_title[:page_title.index("#")]

translation_subpage_title = page_title
if page_title == wxr.wtp.title:
Expand Down

0 comments on commit bb1d1ea

Please sign in to comment.