[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-drill 5749d5bb7a 057/251: Contents of entry drawers ar
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-drill 5749d5bb7a 057/251: Contents of entry drawers are now hidden while displaying answers. |
Date: |
Mon, 17 Jan 2022 18:59:01 -0500 (EST) |
branch: elpa/org-drill
commit 5749d5bb7a8cf262f0a1790fe52241a98653e2c0
Author: eeeickythump <devnull@localhost>
Commit: eeeickythump <devnull@localhost>
Contents of entry drawers are now hidden while displaying answers.
Added card types for noun declension (similar to verb conjugation).
---
org-drill.el | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/org-drill.el b/org-drill.el
index bfce766ae0..352f298570 100644
--- a/org-drill.el
+++ b/org-drill.el
@@ -226,6 +226,9 @@ the hidden cloze during a test.")
("conjugate"
org-drill-present-verb-conjugation
org-drill-show-answer-verb-conjugation)
+ ("decline_noun"
+ org-drill-present-noun-declension
+ org-drill-show-answer-noun-declension)
("spanish_verb" org-drill-present-spanish-verb)
("translate_number" org-drill-present-translate-number))
"Alist associating card types with presentation functions. Each
@@ -1684,6 +1687,7 @@ Note: does not actually alter the item."
(org-drill-unhide-clozed-text)
(ignore-errors
(org-display-inline-images t))
+ (org-cycle-hide-drawers 'all)
(with-hidden-cloze-hints
(funcall reschedule-fn)))))
@@ -2930,6 +2934,101 @@ returns its return value."
(funcall reschedule-fn))))
+;;; `decline_noun' card type ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(defvar org-drill-noun-gender-alist
+ '(("masculine" "dodgerblue")
+ ("masc" "dodgerblue")
+ ("male" "dodgerblue")
+ ("m" "dodgerblue")
+ ("feminine" "orchid")
+ ("fem" "orchid")
+ ("female" "orchid")
+ ("f" "orchid")
+ ("neuter" "green")
+ ("neutral" "green")
+ ("neut" "green")
+ ("n" "green")
+ ))
+
+
+(defun org-drill-get-noun-info ()
+ "Auxiliary function used by `org-drill-present-noun-declension' and
+`org-drill-show-answer-noun-declension'."
+ (let ((noun (org-entry-get (point) "NOUN" t))
+ (noun-hint (org-entry-get (point) "NOUN_HINT" t))
+ (noun-root (org-entry-get (point) "NOUN_ROOT" t))
+ (noun-gender (org-entry-get (point) "NOUN_GENDER" t))
+ (translation (org-entry-get (point) "NOUN_TRANSLATION" t))
+ (highlight-face nil))
+ (unless (and noun translation)
+ (error "Missing information for `decline_noun' card (%s, %s, %s, %s) at
%s"
+ noun translation noun-hint noun-root (point)))
+ (setq noun-root (if noun-root (car (read-from-string noun-root)))
+ noun (car (read-from-string noun))
+ noun-gender (downcase (car (read-from-string noun-gender)))
+ noun-hint (if noun-hint (car (read-from-string noun-hint)))
+ translation (car (read-from-string translation)))
+ (setq highlight-face
+ (list :foreground
+ (or (second (assoc-string noun-gender
+ org-drill-noun-gender-alist t))
+ "red")))
+ (setq noun (propertize noun 'face highlight-face))
+ (setq translation (propertize translation 'face highlight-face))
+ (list noun noun-root noun-gender noun-hint translation)))
+
+
+(defun org-drill-present-noun-declension ()
+ "Present a drill entry whose card type is 'decline_noun'."
+ (destructuring-bind (noun noun-root noun-gender noun-hint translation)
+ (org-drill-get-noun-info)
+ (let* ((props (org-entry-properties (point)))
+ (definite
+ (cond
+ ((assoc "DECLINE_DEFINITE" props)
+ (propertize (if (org-entry-get (point) "DECLINE_DEFINITE")
+ "definite" "indefinite")
+ 'face 'warning))
+ (t nil)))
+ (plural
+ (cond
+ ((assoc "DECLINE_PLURAL" props)
+ (propertize (if (org-entry-get (point) "DECLINE_PLURAL")
+ "plural" "singular")
+ 'face 'warning))
+ (t nil))))
+ (org-drill-present-card-using-text
+ (cond
+ ((zerop (random* 2))
+ (format "\nTranslate the noun\n\n%s (%s)\n\nand list its
declensions%s.\n\n"
+ noun noun-gender
+ (if (or plural definite)
+ (format " for the %s %s form" definite plural)
+ "")))
+ (t
+ (format "\nGive the noun that means\n\n%s %s\n
+and list its declensions%s.\n\n"
+ translation
+ (if noun-hint (format " [HINT: %s]" noun-hint) "")
+ (if (or plural definite)
+ (format " for the %s %s form" definite plural)
+ ""))))))))
+
+
+(defun org-drill-show-answer-noun-declension (reschedule-fn)
+ "Show the answer for a drill item whose card type is 'decline_noun'.
+RESCHEDULE-FN must be a function that calls `org-drill-reschedule' and
+returns its return value."
+ (destructuring-bind (noun noun-root noun-gender noun-hint translation)
+ (org-drill-get-noun-info)
+ (with-replaced-entry-heading
+ (format "Declensions of %s (%s) ==> %s\n\n"
+ noun noun-gender translation)
+ (funcall reschedule-fn))))
+
+
;;; `translate_number' card type ==============================================
;;; See spanish.org for usage
- [nongnu] elpa/org-drill 0e2040ba7e 013/251: * Documentation added for multicloze cards and cram mode., (continued)
- [nongnu] elpa/org-drill 0e2040ba7e 013/251: * Documentation added for multicloze cards and cram mode., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 5ebfe9c717 017/251: Improved key input during drill sessions. Once the answer is revealed, it is now possible to navigate, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 1c93810202 019/251: Added tag 1.6 for changeset 6ff8dd70c108, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 5d4694dc3b 020/251: - Hide comments (#...) in items during drill sessions., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 4c7669692d 025/251: Added tag 2.1 for changeset da0c515d1d39, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 97aad88728 029/251: - 'multicloze' card type renamed to 'hide1cloze' (though 'multicloze' is, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 02e454f8d0 033/251: Added tag 2.3 for changeset b5d5b9f5c203, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill b69d212068 053/251: Go back to using org-save-outline-visibility instead of org-drill-save-visibility -, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 6dc1b90f21 050/251: Added tag 2.3.5 for changeset 872dde6580f6, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 9cb409a1ba 012/251: * New command: 'M-x org-drill-cram'. "Cram Mode" is the same as an ordinary drill session, except, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 5749d5bb7a 057/251: Contents of entry drawers are now hidden while displaying answers.,
ELPA Syncer <=
- [nongnu] elpa/org-drill 79a0ac93ae 058/251: Hide entry drawers when showing answers for verb conjugation and noun, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 93545edb91 063/251: Added tag 2.3.8 for changeset a8cade42f59c, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 8b6e230886 065/251: Added ability to define arbitrary left and right cloze delimiters (strings),, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill b17bf579bd 039/251: - New card types: show2cloze, hide1_firstmore, show1_firstless, show1_lastmore. See docs for details., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 9487fd21f8 002/251: Added special card type for spanish verbs, to demonstrate custom card types., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 5040d0e6d2 014/251: Added tag 1.4 for changeset 2e4735840112, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill e698616493 026/251: - More robust handling of the situation where we resume a drill session but, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill e7ffd8e6eb 040/251: Renamed documentation file and fixed a few typos., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 063e8035a8 071/251: - Ignore cloze markings if they occur inside Org source blocks, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 663a1ee3f3 079/251: Clarified that org-drill is licensed under GPL v3., ELPA Syncer, 2022/01/17