diff options
author | David Thompson <dthompson2@worcester.edu> | 2016-04-02 15:56:19 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2016-04-02 15:56:19 -0400 |
commit | a37c3cd58525be76705ea930551f3935a232790e (patch) | |
tree | 90c4a1a120e70f3180b44c23431312ca6f85fcc9 | |
parent | 796cb05b57039a4e9c71fb71d98377446b269ad6 (diff) |
post: Allow dashes in slugs.
* haunt/post.scm (char-set:slug): New variable.
(post-slug): Use slug char set.
-rw-r--r-- | haunt/post.scm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/haunt/post.scm b/haunt/post.scm index 47aaa55..90a397c 100644 --- a/haunt/post.scm +++ b/haunt/post.scm @@ -56,10 +56,13 @@ "Return the metadata corresponding to KEY within POST." (assq-ref (post-metadata post) key)) +(define char-set:slug + (char-set-union char-set:letter+digit (char-set #\-))) + (define (post-slug post) "Transform the title of POST into a URL slug." (string-join (map (lambda (s) - (string-filter char-set:letter+digit s)) + (string-filter char-set:slug s)) (string-split (string-downcase (post-ref post 'title)) char-set:whitespace)) "-")) |