forked from repeat-space/anki-apkg-export
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
pear die Birne food fruit | ||
lemon die Zitrone food fruit | ||
banana die Banane food fruit | ||
tomato die Tomate food vegetable | ||
carrot die Karotte food vegetable | ||
onion die Zwiebel food vegetable | ||
rice der Reis food | ||
salt das Salz food | ||
oil das Öl food | ||
flour das Mehl food | ||
water das Wasser food | ||
a tree ein Baum nature | ||
a river ein Fluss nature | ||
the sun die Sonne nature sky | ||
the moon der Mond nature sky | ||
one star ein Stern nature sky | ||
two stars zwei Sterne nature sky | ||
three stars drei Sterne nature sky | ||
lion der Löwe animal | ||
hyena die Hyäne animal | ||
goat die Ziege animal | ||
cow die Kuh animal | ||
cock der Hahn animal | ||
hen das Henne animal | ||
dog der Hund animal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const AnkiExport = require('../../dist/index').default; | ||
|
||
const apkg = new AnkiExport('deck-name-node'); | ||
|
||
apkg.addMedia('anki.png', fs.readFileSync('../assets/anki.png')); | ||
|
||
apkg.addCard('pear','die Birne', {"tags":["food","fruit"]}); | ||
apkg.addCard('lemon','die Zitrone', {"tags":["food","fruit"]}); | ||
apkg.addCard('banana','die Banane', {"tags":["food","fruit"]}); | ||
apkg.addCard('tomato','die Tomate', {"tags":["food","vegetable"]}); | ||
apkg.addCard('carrot','die Karotte', {"tags":["food","vegetable"]}); | ||
apkg.addCard('onion','die Zwiebel', {"tags":["food","vegetable"]}); | ||
apkg.addCard('rice','der Reis', {"tags":["food"]}); | ||
apkg.addCard('salt','das Salz', {"tags":["food"]}); | ||
apkg.addCard('oil','das Öl', {"tags":["food"]}); | ||
apkg.addCard('flour','das Mehl', {"tags":["food"]}); | ||
apkg.addCard('water','das Wasser', {"tags":["food"]}); | ||
apkg.addCard('a tree','ein Baum', {"tags":["nature"]}); | ||
apkg.addCard('a river','ein Fluss', {"tags":["nature"]}); | ||
apkg.addCard('the sun','die Sonne', {"tags":["nature","sky"]}); | ||
apkg.addCard('the moon','der Mond', {"tags":["nature","sky"]}); | ||
apkg.addCard('one star','ein Stern', {"tags":["nature","sky"]}); | ||
apkg.addCard('two stars','zwei Sterne', {"tags":["nature","sky"]}); | ||
apkg.addCard('three stars','drei Sterne', {"tags":["nature","sky"]}); | ||
apkg.addCard('lion','der Löwe', {"tags":["animal"]}); | ||
apkg.addCard('hyena','die Hyäne', {"tags":["animal"]}); | ||
apkg.addCard('goat','die Ziege', {"tags":["animal"]}); | ||
apkg.addCard('cow','die Kuh', {"tags":["animal"]}); | ||
apkg.addCard('cock','der Hahn', {"tags":["animal"]}); | ||
apkg.addCard('hen','das Henne', {"tags":["animal"]}); | ||
apkg.addCard('dog','der Hund', {"tags":["animal"]}); | ||
|
||
apkg | ||
.save() | ||
.then(zip => { | ||
fs.writeFileSync('./output.apkg', zip, 'binary'); | ||
console.log(`Package has been generated: output.pkg`); | ||
}) | ||
.catch(err => console.log(err.stack || err)); |