Skip to content

Commit

Permalink
feat: support arbitrary subdeck nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff committed Dec 22, 2023
1 parent dda73bd commit 3ba0c90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def to_genanki_note(self) -> genanki.Note:
def deck(self) -> str:
deck_prefix = "anki/deck/"
deck_in_tags = (
tag.replace(deck_prefix, "")
tag.replace(deck_prefix, "").replace("/", "::")
for tag in self.tags
if tag.startswith(deck_prefix)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def test_ankiconnect_push_prompts():
QAWithoutDoc(
question="FakeQuestion",
answer="FakeAnswer",
add_tags=["anki/deck/FakeSubdeck"],
add_tags=[
"anki/deck/FakeSubdeck/FakeSubSubdeck"
],
),
ClozeWithoutDoc(
text="FakeText", add_tags=["FakeTag"]
Expand All @@ -81,7 +83,7 @@ def test_ankiconnect_push_prompts():
)
assert (
import_package_command.package.decks[0].name # type: ignore
== "FakeDeck::FakeSubdeck"
== "FakeDeck::FakeSubdeck::FakeSubSubdeck"
)
assert len(import_package_command.package.decks) == 2 # type: ignore

Expand Down

0 comments on commit 3ba0c90

Please sign in to comment.