From 467e0c0e7d9849f83ebff78f10d1de04445c1852 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 8 Apr 2026 10:09:01 +0300 Subject: refactor(anki): split APKG generator into SQLiteSchemer, ZipPackager, CardTemplate Extract SQLite schema and inserts into SQLiteSchemer, zip creation into ZipPackager, and embedded HTML/CSS templates into CardTemplate with external .html and .css files. APKGGenerator orchestrates copy, media mapping, DB build, and packaging. Made-with: Cursor --- internal/anki/templates/bg_bg_back.html | 13 +++++ internal/anki/templates/bg_bg_front.html | 11 ++++ internal/anki/templates/bg_bg_reverse_back.html | 18 +++++++ internal/anki/templates/bg_bg_reverse_front.html | 6 +++ internal/anki/templates/card.css | 68 ++++++++++++++++++++++++ internal/anki/templates/en_bg_back.html | 13 +++++ internal/anki/templates/en_bg_front.html | 8 +++ internal/anki/templates/en_bg_reverse_back.html | 15 ++++++ internal/anki/templates/en_bg_reverse_front.html | 6 +++ 9 files changed, 158 insertions(+) create mode 100644 internal/anki/templates/bg_bg_back.html create mode 100644 internal/anki/templates/bg_bg_front.html create mode 100644 internal/anki/templates/bg_bg_reverse_back.html create mode 100644 internal/anki/templates/bg_bg_reverse_front.html create mode 100644 internal/anki/templates/card.css create mode 100644 internal/anki/templates/en_bg_back.html create mode 100644 internal/anki/templates/en_bg_front.html create mode 100644 internal/anki/templates/en_bg_reverse_back.html create mode 100644 internal/anki/templates/en_bg_reverse_front.html (limited to 'internal/anki/templates') diff --git a/internal/anki/templates/bg_bg_back.html b/internal/anki/templates/bg_bg_back.html new file mode 100644 index 0000000..b1ae3cc --- /dev/null +++ b/internal/anki/templates/bg_bg_back.html @@ -0,0 +1,13 @@ +{{FrontSide}} + +
+ +
+
{{BulgarianBack}}
+{{#AudioBack}} +
{{AudioBack}}
+{{/AudioBack}} +{{#Notes}} +
{{Notes}}
+{{/Notes}} +
diff --git a/internal/anki/templates/bg_bg_front.html b/internal/anki/templates/bg_bg_front.html new file mode 100644 index 0000000..b1d10ef --- /dev/null +++ b/internal/anki/templates/bg_bg_front.html @@ -0,0 +1,11 @@ +
+{{#Image}} +
+{{Image}} +
+{{/Image}} +
{{BulgarianFront}}
+{{#AudioFront}} +
{{AudioFront}}
+{{/AudioFront}} +
diff --git a/internal/anki/templates/bg_bg_reverse_back.html b/internal/anki/templates/bg_bg_reverse_back.html new file mode 100644 index 0000000..1cf2cbe --- /dev/null +++ b/internal/anki/templates/bg_bg_reverse_back.html @@ -0,0 +1,18 @@ +{{FrontSide}} + +
+ +
+
{{BulgarianFront}}
+{{#AudioFront}} +
{{AudioFront}}
+{{/AudioFront}} +{{#Image}} +
+{{Image}} +
+{{/Image}} +{{#Notes}} +
{{Notes}}
+{{/Notes}} +
diff --git a/internal/anki/templates/bg_bg_reverse_front.html b/internal/anki/templates/bg_bg_reverse_front.html new file mode 100644 index 0000000..4fb04d7 --- /dev/null +++ b/internal/anki/templates/bg_bg_reverse_front.html @@ -0,0 +1,6 @@ +
+
{{BulgarianBack}}
+{{#AudioBack}} +{{AudioBack}} +{{/AudioBack}} +
diff --git a/internal/anki/templates/card.css b/internal/anki/templates/card.css new file mode 100644 index 0000000..acdbffe --- /dev/null +++ b/internal/anki/templates/card.css @@ -0,0 +1,68 @@ +.card { + font-family: Arial, sans-serif; + font-size: 20px; + text-align: center; + color: #333; + background-color: white; +} + +.front, .back { + padding: 20px; +} + +.image-container { + margin: 20px auto; + max-width: 400px; +} + +.image-container img { + max-width: 100%; + height: auto; + border-radius: 8px; + box-shadow: 0 2px 8px rgba(0,0,0,0.1); +} + +.english { + font-size: 28px; + font-weight: bold; + color: #2c3e50; + margin: 20px 0; +} + +.bulgarian { + font-size: 32px; + font-weight: bold; + color: #c0392b; + margin: 20px 0; +} + +.bulgarian-front { + font-size: 32px; + font-weight: bold; + color: #2c3e50; + margin: 20px 0; +} + +.bulgarian-back { + font-size: 28px; + font-weight: bold; + color: #27ae60; + margin: 20px 0; +} + +.audio { + margin: 15px 0; +} + +.notes { + font-size: 16px; + color: #7f8c8d; + margin-top: 20px; + font-style: italic; +} + +hr#answer { + margin: 30px 0; + border: 0; + border-top: 1px solid #ecf0f1; +} diff --git a/internal/anki/templates/en_bg_back.html b/internal/anki/templates/en_bg_back.html new file mode 100644 index 0000000..c8a9379 --- /dev/null +++ b/internal/anki/templates/en_bg_back.html @@ -0,0 +1,13 @@ +{{FrontSide}} + +
+ +
+
{{Bulgarian}}
+{{#Audio}} +
{{Audio}}
+{{/Audio}} +{{#Notes}} +
{{Notes}}
+{{/Notes}} +
diff --git a/internal/anki/templates/en_bg_front.html b/internal/anki/templates/en_bg_front.html new file mode 100644 index 0000000..bbcd45b --- /dev/null +++ b/internal/anki/templates/en_bg_front.html @@ -0,0 +1,8 @@ +
+{{#Image}} +
+{{Image}} +
+{{/Image}} +
{{English}}
+
diff --git a/internal/anki/templates/en_bg_reverse_back.html b/internal/anki/templates/en_bg_reverse_back.html new file mode 100644 index 0000000..c61854d --- /dev/null +++ b/internal/anki/templates/en_bg_reverse_back.html @@ -0,0 +1,15 @@ +{{FrontSide}} + +
+ +
+
{{English}}
+{{#Image}} +
+{{Image}} +
+{{/Image}} +{{#Notes}} +
{{Notes}}
+{{/Notes}} +
diff --git a/internal/anki/templates/en_bg_reverse_front.html b/internal/anki/templates/en_bg_reverse_front.html new file mode 100644 index 0000000..30208c7 --- /dev/null +++ b/internal/anki/templates/en_bg_reverse_front.html @@ -0,0 +1,6 @@ +
+
{{Bulgarian}}
+{{#Audio}} +{{Audio}} +{{/Audio}} +
-- cgit v1.2.3