diff options
author | Arun Isaac | 2021-09-23 01:02:35 +0530 |
---|---|---|
committer | Arun Isaac | 2021-09-23 14:16:47 +0530 |
commit | a38d033f0e3f8b936e450e91afd1736ab263454f (patch) | |
tree | 529d8b43403727625489f7cef88c5b14c24d8a66 /gnbug | |
parent | f7ed0ce8a3c9f23c31c71b47f344c9b90cfc30fb (diff) | |
download | gn-gemtext-a38d033f0e3f8b936e450e91afd1736ab263454f.tar.gz |
gnbug: Abstract out splitting on commas.
* gnbug (comma-split): New function.
(file-details): Use comma-split.
Diffstat (limited to 'gnbug')
-rwxr-xr-x | gnbug | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -90,6 +90,12 @@ it is associated to the empty list." (hashtable-update! hashtable key (cut append <> new-values) '())) +(define (comma-split str) + "Split string at commas, trim whitespace from both ends of the split +strings, and return them as a list." + (map (cut string-trim-both <>) + (string-split str #\,))) + (define (file-details file) "Return a hashtable of details extracted from gemini FILE." (let ((result (make-eq-hashtable))) @@ -101,10 +107,8 @@ it is associated to the empty list." ;; specify assignees. ((string-prefix? "* assigned:" line) (hashtable-append! result 'assigned - (map (cut string-trim-both <>) - (string-split - (substring line (string-length "* assigned:")) - #\,)))))) + (comma-split + (substring line (string-length "* assigned:"))))) ;; The first level one heading is the ;; title. ((string-prefix? "# " line) |