summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--issues/allow-checkboxes-without-a-space.gmi2
-rw-r--r--tests/issue.scm5
-rw-r--r--tissue/issue.scm5
3 files changed, 9 insertions, 3 deletions
diff --git a/issues/allow-checkboxes-without-a-space.gmi b/issues/allow-checkboxes-without-a-space.gmi
index c8d93d1..20d016f 100644
--- a/issues/allow-checkboxes-without-a-space.gmi
+++ b/issues/allow-checkboxes-without-a-space.gmi
@@ -10,3 +10,5 @@ In the example below, the first checklist item is not detected correctly.
* [ ] Checkbox with a space
* [x] Completed checkbox
```
+
+* closed
diff --git a/tests/issue.scm b/tests/issue.scm
index 22a04aa..53d908f 100644
--- a/tests/issue.scm
+++ b/tests/issue.scm
@@ -93,4 +93,9 @@ strings."
* [x] bar"
(compose hashtable->alist file-details)))
+(test-equal "Allow checkboxes without a space"
+ '((tasks . 1))
+ (call-with-input-string "* [] foo"
+ (compose hashtable->alist file-details)))
+
(test-end "issue")
diff --git a/tissue/issue.scm b/tissue/issue.scm
index 1953cef..fd4a852 100644
--- a/tissue/issue.scm
+++ b/tissue/issue.scm
@@ -221,11 +221,10 @@ gemtext file."
;; checkbox has any character other
;; than space in it, the task is
;; completed.
- ;; TODO: Allow [] and not just [ ] (that is, without a space).
- ((string-match "^\\* \\[(.)\\]" line)
+ ((string-match "^\\* \\[(.*)\\]" line)
=> (lambda (m)
(hashtable-update! result 'tasks 1+ 0)
- (unless (string=? (match:substring m 1) " ")
+ (unless (string-blank? (match:substring m 1))
(hashtable-update! result 'completed-tasks 1+ 0))))
((list-line->alist line)
=> (lambda (alist)