Add some word handling utilities
These are useful for constructing HTML ids and similar things.
This commit is contained in:
parent
f2e123b7ac
commit
53665daee7
1 changed files with 14 additions and 1 deletions
|
|
@ -24,7 +24,10 @@
|
||||||
#:use-module (web uri)
|
#:use-module (web uri)
|
||||||
#:export (request-path-components
|
#:export (request-path-components
|
||||||
file-extension
|
file-extension
|
||||||
directory?))
|
directory?
|
||||||
|
|
||||||
|
hyphenate-words
|
||||||
|
underscore-join-words))
|
||||||
|
|
||||||
(define (request-path-components request)
|
(define (request-path-components request)
|
||||||
(split-and-decode-uri-path (uri-path (request-uri request))))
|
(split-and-decode-uri-path (uri-path (request-uri request))))
|
||||||
|
|
@ -34,3 +37,13 @@
|
||||||
|
|
||||||
(define (directory? filename)
|
(define (directory? filename)
|
||||||
(string=? filename (dirname filename)))
|
(string=? filename (dirname filename)))
|
||||||
|
|
||||||
|
(define (hyphenate-words words)
|
||||||
|
(string-join
|
||||||
|
(string-split words #\space)
|
||||||
|
"-"))
|
||||||
|
|
||||||
|
(define (underscore-join-words words)
|
||||||
|
(string-join
|
||||||
|
(string-split words #\space)
|
||||||
|
"_"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue