Adds a full flashcards system: FSRS-based scheduling, cloze/basic card types, CSV import/export, media storage, and study UI, wired into navigation and the dashboard alongside existing question flows.
33 lines
1.1 KiB
GDScript
33 lines
1.1 KiB
GDScript
extends SceneTree
|
|
|
|
const Cloze := preload("res://scripts/ui/flashcard_cloze.gd")
|
|
|
|
var failures := 0
|
|
|
|
|
|
func _initialize() -> void:
|
|
var text := "The capital of {{c1::France}} is {{c2::Paris::city}}."
|
|
|
|
_assert(Cloze.render_front(text, 1) == "The capital of [...] is Paris.",
|
|
"front should hide the target cloze number and reveal the rest")
|
|
_assert(Cloze.render_front(text, 2) == "The capital of France is [city].",
|
|
"front should show the hint in brackets when one is provided")
|
|
_assert(Cloze.render_back(text) == "The capital of France is Paris.",
|
|
"back should reveal every cloze answer regardless of variant")
|
|
|
|
var multiline := "Line one\n{{c1::multi\nline\nanswer}}\nLine two"
|
|
_assert(Cloze.render_back(multiline) == "Line one\nmulti\nline\nanswer\nLine two",
|
|
"cloze content spanning multiple lines should still parse as one deletion")
|
|
|
|
_assert(Cloze.render_front("no markers here", 1) == "no markers here",
|
|
"text without cloze markers should render unchanged")
|
|
|
|
quit(1 if failures > 0 else 0)
|
|
|
|
|
|
func _assert(condition: bool, message: String) -> void:
|
|
if condition:
|
|
return
|
|
failures += 1
|
|
push_error(message)
|