branch: elpa/gnosis commit bac8abb207b53b122b11d061fde20c53c00e2005 Author: Thanos Apollo <pub...@thanosapollo.org> Commit: Thanos Apollo <pub...@thanosapollo.org>
[fix] cloze-mark-answers: Adjust for new cloze format. + Add support for quotes + Do not apply custom faces on empty space. --- gnosis.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gnosis.el b/gnosis.el index a4caaace92..43abcdf14e 100644 --- a/gnosis.el +++ b/gnosis.el @@ -467,8 +467,17 @@ This will not be applied to sentences that start with double space." (insert str) (goto-char (point-min)) (dolist (answer answers) - (when (search-forward answer nil t) - (replace-match (propertize answer 'face face) nil t))) + (let ((answer-text (gnosis-trim-quotes answer))) + (while (search-forward answer-text nil t) + (replace-match + (mapconcat + (lambda (char) + (if (not (memq char '(?\s ?\t ?\n))) + (propertize (char-to-string char) 'face face) + (char-to-string char))) + answer-text + "") + nil t)))) (buffer-string))) (defun gnosis-cloze-mark-false (str answers)