diff options
author | Thanos Apollo <[email protected]> | 2023-12-27 06:39:25 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-12-27 06:39:25 +0200 |
commit | db95f09fd7d9a3cc1fa260b7167922d3bde5b41a (patch) | |
tree | 0cd1180b4f466aa6347efd15ba16c3a39fc23b70 | |
parent | a70e10741c6fda5dd0316617d876988e06a6226b (diff) |
Add gnosis-add-note-cloze
Function to add cloze type notes
-rw-r--r-- | gnosis.el | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -217,17 +217,26 @@ choice in the `CHOICES' list. Each note must correspond to one `DECK'. (error "Correct answer value must be the index number of the correct answer")) ((null tags) (setf tags 'untagged))) - (gnosis--insert-into 'notes `([nil "mcq" ,question ,choices ,correct-answer ,tags ,(gnosis--get-deck-id deck)])) - (gnosis--insert-into 'review `([nil ,gnosis-algorithm-ef ,gnosis-algorithm-ff ,gnosis-algorithm-interval])) - (gnosis--insert-into 'review-log `([nil ,(gnosis-algorithm-date) ,(gnosis-algorithm-date) 0 ,suspend 0])) - (gnosis--insert-into 'extras `([nil ,extra ,image]))) + (gnosis-add-note-fields deck "mcq" question choices correct-answer extra tags suspend image)) + +(cl-defun gnosis-add-note-cloze (&key deck note tags (suspend 0) extra (image nil)) + "Add cloze type note." + (interactive (list :deck (gnosis--get-deck-name) + :note (read-string "Cloze note: ") + :extra (read-string "Extra: ") + :tags (gnosis--prompt "Tags" t t))) + (let ((notags-note (gnosis-cloze-remove-tags note)) + (clozes (gnosis-cloze-get-clozes note))) + (cl-loop for cloze in clozes + ;; TODO: OPTIONS need to be hints + do (gnosis-add-note-fields deck "cloze" notags-note "" cloze extra tags suspend image)))) (defun gnosis-add-note (type) "Create note as TYPE." (interactive (list (completing-read "Type: " '(MCQ Cloze Basic) nil t))) (pcase type ("MCQ" (call-interactively 'gnosis-add-note-mcq)) - ("Cloze" (message "Not ready yet.")) + ("Cloze" (call-interactively 'gnosis-add-note-cloze)) ("Basic" (message "Not ready yet.")) (_ (message "No such type.")))) |