From f79fe343bb768c9fd0275e773d91235fb634278a Mon Sep 17 00:00:00 2001 From: Philipp Stadler <hello@phstadler.com> Date: Sun, 21 Jul 2024 18:44:42 +0200 Subject: [PATCH] feat(starter): add Anki example --- .gitignore | 2 -- README.md | 5 ++-- content/Vocabulary-from-Anki/.apkg-spec.yaml | 31 ++++++++++++++++++++ content/Vocabulary-from-Anki/Chinesisch.txt | 8 +++++ content/Vocabulary-from-Anki/README.md | 17 +++++++++++ package.json | 2 +- 6 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 content/Vocabulary-from-Anki/.apkg-spec.yaml create mode 100644 content/Vocabulary-from-Anki/Chinesisch.txt create mode 100644 content/Vocabulary-from-Anki/README.md diff --git a/.gitignore b/.gitignore index 30dfc56..92e77cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ CHANGELOG.md hanzi-data templates -LICENSE -NOTICE out diff --git a/README.md b/README.md index 8402f01..bf7c841 100644 --- a/README.md +++ b/README.md @@ -40,13 +40,14 @@ or To add new content to this pack, either add `.apkg` files in the root next to `content` to include them unchanged, OR add subfolders to `content/` with data in the form of CSV, images or APKGs and an `.apkg-spec.yaml` file that -configures which HTML too use for the cards and how your data is laid out. +configures which HTML to use for the cards and how your data is laid out. You can use the content in the starter template as your basis or just have a look to see how it works: * [content/Facts-from-CSV](https://gitlab.phaidra.org/kartenaale/templates/anki-pack/-/tree/main/content/Facts-from-CSV) for Q/A cards imported from a CSV file, * [content/Bijection-from-CSV](https://gitlab.phaidra.org/kartenaale/templates/anki-pack/-/tree/main/content/Bijection-from-CSV) for cards that work both ways, where the answer is also a question, -* [content/Bijection-from-Images](https://gitlab.phaidra.org/kartenaale/templates/anki-pack/-/tree/main/content/Bijection-from-Images) for two cards, one to remember the image and one to remember the label in the filename. +* [content/Bijection-from-Images](https://gitlab.phaidra.org/kartenaale/templates/anki-pack/-/tree/main/content/Bijection-from-Images) for two cards, one to remember the image and one to remember the label in the filename, +* [content/Vocabulary-from-Anki](https://gitlab.phaidra.org/kartenaale/templates/anki-pack/-/tree/main/content/Vocabulary-from-Anki) for vocabulary cards, with an Anki text export of simple notes as the data source. To get your changes back into the repository and test them, create a new branch with your changes and open a merge request. Check the APKGs in the CI/CD build diff --git a/content/Vocabulary-from-Anki/.apkg-spec.yaml b/content/Vocabulary-from-Anki/.apkg-spec.yaml new file mode 100644 index 0000000..751e5f0 --- /dev/null +++ b/content/Vocabulary-from-Anki/.apkg-spec.yaml @@ -0,0 +1,31 @@ +content_version: 1.0.0 + +templates: +- molaoshi + +content: +- import_csv: + content_version: 2024-01-19 19:00:00+00:00 + note_type: Vokabeln + file_patterns: + - '*.txt' + delimiter: "\t" + # Not needed because the CSV contains the deck name + deck_name_pattern: 'UNUSED' + fields_mapping: + - guid + # ignoriere den Kartentyp + - '' + # Dritte Spalte ist Deckname + - deck + - Deutsch + - 简体字 + fields_static: + Schreiben anlegen: 'true' + # Mehr optionale Kartentypen aktivieren: + # Radikal finden anlegen: 'true' + # Radikal finden (繁體字) anlegen: 'true' + # Lesen (繁體字) anlegen: 'true' + tags: [] + +resource_paths: [] diff --git a/content/Vocabulary-from-Anki/Chinesisch.txt b/content/Vocabulary-from-Anki/Chinesisch.txt new file mode 100644 index 0000000..179e133 --- /dev/null +++ b/content/Vocabulary-from-Anki/Chinesisch.txt @@ -0,0 +1,8 @@ +#separator:tab +#html:true +#guid column:1 +#notetype column:2 +#deck column:3 +#tags column:6 +sA:>|UEhWR Basic Chinesisch::Teil 1 Tapir 貘 +fVVAK}&Gs~ Basic Chinesisch::Teil 1 gut 好 diff --git a/content/Vocabulary-from-Anki/README.md b/content/Vocabulary-from-Anki/README.md new file mode 100644 index 0000000..5eb25e4 --- /dev/null +++ b/content/Vocabulary-from-Anki/README.md @@ -0,0 +1,17 @@ +# Vocabulary from Anki +This example builds Vocabulary cards from simple Front/Back cards that were +exported from Anki. + +To generate the .txt file, click the wheel when hovering the root of thr deck +you want to export and hit _Export…_ and select _Notes in Plain Text (.txt)_ as +the format. Check everything, e.g. the deck name and unique identifier. + +See [.apkg-spec.yaml](.apkg-spec.yaml) for an example of how to handle such a +file. + +## Images +If you use images, put them into a directory and add that to the resource path. + +See for example +[sinology-1](https://gitlab.phaidra.org/kartenaale/packs/sinology-1/-/blob/main/content/Einf%C3%BChrung-in-die-politische-Geschichte-Chinas/.apkg-spec.yaml) +as an example of how to do this. diff --git a/package.json b/package.json index e7451c7..afba5c5 100644 --- a/package.json +++ b/package.json @@ -1,3 +1,3 @@ { - "version": "1.0.0-starter6" + "version": "1.0.0-starter7" } -- GitLab