[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gnosis 56f3d11d93 047/110: [fix] cloze-create: Preserve wh
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gnosis 56f3d11d93 047/110: [fix] cloze-create: Preserve white space. |
Date: |
Tue, 17 Jun 2025 10:04:19 -0400 (EDT) |
branch: elpa/gnosis
commit 56f3d11d93828853951e7e1d1ddf6618375a40fe
Author: Thanos Apollo <public@thanosapollo.org>
Commit: Thanos Apollo <public@thanosapollo.org>
[fix] cloze-create: Preserve white space.
+ Preserve white space for clozes
---
gnosis.el | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/gnosis.el b/gnosis.el
index 30ad1eaf27..a2068becee 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -413,16 +413,22 @@ If FILL-PARAGRAPH-P, insert question using
`fill-paragraph'."
(string-remove-prefix "\"" (string-remove-suffix "\"" str)))
(defun gnosis-cloze-create (str clozes &optional cloze-string)
- "Replace CLOZES in STR with CLOZE-STRING."
+ "Replace CLOZES in STR with CLOZE-STRING, preserving whitespace pattern."
(cl-assert (listp clozes) nil "Adding clozes: Clozes need to be a list.")
(let ((cloze-string (or cloze-string gnosis-cloze-string)))
(with-temp-buffer
(insert str)
- (goto-char (point-min))
(dolist (cloze clozes)
- (when (search-forward
- (gnosis-trim-quotes cloze) nil t)
- (replace-match (propertize cloze-string 'face 'gnosis-face-cloze)
nil t)))
+ (let* ((cloze-text (gnosis-trim-quotes cloze))
+ (replacement (concat
+ (and (string-match "^\\s-+" cloze-text)
+ (match-string 0 cloze-text))
+ (propertize cloze-string 'face 'gnosis-face-cloze)
+ (and (string-match "\\s-+$" cloze-text)
+ (match-string 0 cloze-text)))))
+ (goto-char (point-min))
+ (when (search-forward cloze-text nil t)
+ (replace-match replacement t t))))
(buffer-string))))
(defun gnosis-cloze-add-hints (str hints &optional cloze-string)
- [nongnu] elpa/gnosis a697364920 096/110: Center review header appear during review., (continued)
- [nongnu] elpa/gnosis a697364920 096/110: Center review header appear during review., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis c10376c553 090/110: Update tests & makefile., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis c608a0655b 087/110: [fix] compare-strings: refactor adjustments for white space., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis c7c0d6481c 083/110: Feature: cloze: Support flexible order input., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis cd9aabab0b 072/110: Add syntax-delimiters & generate-syntax-highlights., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis eca3e2222f 067/110: [Feature] Add gnosis-review-topic., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 1866834769 071/110: [fix] cloze-create: Use gnosis-center-string to adjust for links., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 5a66ab4cca 062/110: center-string: Adjust for links., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 437bd201b7 063/110: syntax-highlight: Remove link highlight., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 6a52e35deb 057/110: add-note: Use register to save current window configuration., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 56f3d11d93 047/110: [fix] cloze-create: Preserve white space.,
ELPA Syncer <=
- [nongnu] elpa/gnosis 60fc88beea 043/110: Add shell-cmd-with-password, ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 9904210a74 048/110: [fix] display-keimenon: Replace \n with empty space., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 9cd728021c 051/110: dashboard-output-notes: Remove run-with-timer., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis bdadc8828f 036/110: select: Rewrite properly for string literals., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis b85b9b6e27 030/110: compare-strings: Use trim-quotes., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis e9aa007137 028/110: display-parathema: Insert parathema right after the separator., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 42852c75ad 018/110: mc-cloze: Update review function., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 444a18a24e 019/110: cloze-check: Adjust for quoted input, ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 2079373e96 015/110: Remove string-edit., ELPA Syncer, 2025/06/17
- [nongnu] elpa/gnosis 355c5d55b9 025/110: Remove deprecated faces & group definitions., ELPA Syncer, 2025/06/17