Skip to content

Commit

Permalink
fix: should use builtin Tags (#18)
Browse files Browse the repository at this point in the history
* fix: should use builtin `Tags`

* chore: typo
  • Loading branch information
ikkz authored Nov 25, 2024
1 parent 16f59c0 commit b88f7be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-balloons-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'anki-templates': patch
---

fix: should use builtin `Tags` field (展示内置标签字段)
5 changes: 4 additions & 1 deletion release.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
with open("./release.json") as file:
release_config = json.load(file)

BUILTIN_FIELDS = ["Tags", "Type", "Deck", "Subdeck", "CardFlag", "Card", "FrontSide"]


def gen_apkg(id: str, locale: str):
print(f"generating {id} {locale}")
folder = f"dist/{id}/{locale}"
with open(f"{folder}/front.html") as f:
front = f.read()
with open(f"{folder}/back.html") as f:
back = f.read()
release = release_config[id]
template = templates_config[id]
fields = template["fields"]
fields = list(filter(lambda field: field not in BUILTIN_FIELDS, template["fields"]))
model = genanki.Model(
release_config[id]["id"][locale],
f"IKKZ_{id}_TEMPLATE_{locale}".upper(),
Expand Down
2 changes: 1 addition & 1 deletion src/components/card-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const CardShell: FC<Props> = ({
{tags?.length ? (
<>
<Dot />
{tags.join('@/ ')}
{tags.join(' / ')}
</>
) : null}
</span>
Expand Down

0 comments on commit b88f7be

Please sign in to comment.