diff options
author | Thanos Apollo <[email protected]> | 2024-10-09 18:54:41 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-10-09 18:54:41 +0300 |
commit | e7184dadfd9a8c49e4ce7749a8fd98eec2908c89 (patch) | |
tree | da1eb85ad0ab244c2177fa794f28a0e712f4f731 /gnosis.el | |
parent | 68ec07aa6fce9e128dde85bcecfb81e07695d34c (diff) |
[fix] cloze-remove-tags: Remove tags & hints as well.
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1173,13 +1173,15 @@ TYPE: Type of gnosis note, must be one of `gnosis-note-types'" (unless (string-match-p cloze sentence) (throw 'not-found nil))) t)) - +;; TODO: use a better name to indicate that it also removes hints from STRING. (defun gnosis-cloze-remove-tags (string) "Replace cloze tags and hints in STRING. Works with both single (:), double colons (::), single braces ({}) and -double braces ({{}})." - (let* ((regex "{\\{1,2\\}c[0-9]+:\\{1,2\\}\\([^{}]*?\\)}\\{1,2\\}") +double braces ({{}}). + +Also removes content after a double semicolon (::), which indicate a hint." + (let* ((regex "{\\{1,2\\}c[0-9]+:\\{1,2\\}\\([^:{}]*?\\)\\(::[^{}]*\\)?}\\{1,2\\}") (result (replace-regexp-in-string regex "\\1" string))) result)) |