diff options
author | Arun Isaac | 2022-03-15 16:46:02 +0530 |
---|---|---|
committer | Arun Isaac | 2022-03-16 10:34:44 +0530 |
commit | eedd8f9f0b69a8d1a7a6d96cd028b2ecc4c92ed5 (patch) | |
tree | c32a37ff8000242946f324d876a1f76addb01a3f | |
parent | 7a8aaacf35bfc32e8f22cd24a34bb5955d7c2383 (diff) | |
download | tissue-eedd8f9f0b69a8d1a7a6d96cd028b2ecc4c92ed5.tar.gz tissue-eedd8f9f0b69a8d1a7a6d96cd028b2ecc4c92ed5.tar.lz tissue-eedd8f9f0b69a8d1a7a6d96cd028b2ecc4c92ed5.zip |
tissue: Sanitize tag names in file paths.
* tissue/web.scm (sanitize-string): New function.
(issue-list-item-markup-writer-action, build-website): Use
sanitize-string.
-rw-r--r-- | tissue/web.scm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tissue/web.scm b/tissue/web.scm index 92d33a6..9f86cdb 100644 --- a/tissue/web.scm +++ b/tissue/web.scm @@ -97,6 +97,14 @@ NEW-EXTENSION." #:posts))) (body (the-body opts)))) +(define (sanitize-string str) + "Downcase STR and replace spaces with hyphens." + (string-map (lambda (c) + (case c + ((#\space) #\-) + (else c))) + (string-downcase str))) + (define (issue-list-item-markup-writer-action markup engine) (sxml->xml `(li (@ (class "issue-list-item")) @@ -106,7 +114,8 @@ NEW-EXTENSION." ,(markup-option markup #:title)) ,@(map (lambda (tag) (let ((words (string-split tag (char-set #\- #\space)))) - `(a (@ (href ,(string-append (%tags-path) "/" tag ".html")) + `(a (@ (href ,(string-append (%tags-path) "/" + (sanitize-string tag) ".html")) (class ,(string-append "tag" (if (not (null? (lset-intersection string=? words @@ -209,7 +218,8 @@ issue listings are not generated." (when tags-path (for-each (lambda (tag) (let ((output-file (string-append output-directory - tags-path "/" tag ".html"))) + tags-path "/" + (sanitize-string tag) ".html"))) (display (format "tag: ~a -> ~a~%" tag output-file)) (build-issue-listing (reverse (filter (lambda (issue) (member tag (issue-keywords issue))) |