Skip to content

Commit

Permalink
Add basic traditional support
Browse files Browse the repository at this point in the history
  • Loading branch information
autoelk committed Sep 28, 2023
1 parent 74835f3 commit 41ef6d1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ Just run `ankichinese -x anki` again with new characters in `input.txt` and impo

| Field Name | Description |
| --- | --- |
| Hanzi | Character (**REQUIRED**) |
| Hanzi | Simplified character (**REQUIRED**) |
| Traditional | Traditional form |
| Definition | Meaning of character |
| Pinyin | Most common pinyin |
| Pinyin 2 | Other possible pinyin |
Expand Down
2 changes: 1 addition & 1 deletion card_template/back.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h1 class="pinyin">{{Pinyin}}</h1>
</svg>
</a>

<div class="meta">HSK: {{HSK}}</div>
<div class="meta">{{Hanzi}} {{Traditional}} HSK: {{HSK}}</div>

<div class="example-container">
<p class="notes ruby-text">{{furigana:Examples}}</p>
Expand Down
3 changes: 2 additions & 1 deletion card_template/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

.meta {
margin: 8px 0;
font-size: 1.3rem;
}

.ruby-text {
Expand All @@ -61,5 +62,5 @@
}

#hint-button {
margin: 0 0 16px 0;
margin: 0;
}
3 changes: 3 additions & 0 deletions src/AnkiChinese/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def gen_model():
"AnkiChinese",
fields=[
{"name": "Hanzi"},
{"name": "Traditional"},
{"name": "Definition"},
{"name": "Pinyin"},
{"name": "Pinyin 2"},
Expand All @@ -51,6 +52,7 @@ def gen_note(model, data):
model=model,
fields=[
data["Hanzi"],
data["Traditional"],
data["Definition"],
data["Pinyin"],
data["Pinyin 2"],
Expand Down Expand Up @@ -136,6 +138,7 @@ def update_anki(results, col, deck_name, model_name, notes_in_deck):
audio_data.append(
{
"Hanzi": "",
"Traditional": "",
"Definition": "",
"Pinyin": "",
"Pinyin 2": "",
Expand Down
1 change: 1 addition & 0 deletions src/AnkiChinese/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def cli():

scraped_fields = [
"Hanzi",
"Traditional",
"Definition",
"Pinyin",
"Pinyin 2",
Expand Down
1 change: 1 addition & 0 deletions src/AnkiChinese/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def scrape_basic_info(soup, args):

pinyin_list = details.get("Pinyin", "").split(", ")
info = {
"Traditional": clean_string(details.get("Traditional Form", "")),
"Definition": clean_string(
", ".join(details.get("Definition", "").split(", ")[: args.examples])
),
Expand Down

0 comments on commit 41ef6d1

Please sign in to comment.