summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-11-14 10:35:07 +0600
committerunwox <me@unwox.com>2024-11-14 10:38:53 +0600
commitf391e13ddb1fcd8a0a4daf033f341532060f7421 (patch)
treeefb82a9490976c5bc6e81bf3fda64a4e7093315a /lib
parent032e9008f890847bb2a55b73762faaf690e1e154 (diff)
specify canonical URL for SEO
Diffstat (limited to 'lib')
-rw-r--r--lib/string.fnl5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/string.fnl b/lib/string.fnl
index 3e6134e..c722bd3 100644
--- a/lib/string.fnl
+++ b/lib/string.fnl
@@ -32,8 +32,9 @@
(fn ends-with [str end]
(= (string.sub str (- (# end))) end))
-(fn trim [str]
- (str:match "^%s*(.-)%s*$"))
+(fn trim [str pattern]
+ (local pattern (or pattern "%s"))
+ (str:match (.. "^" pattern "*(.-)" pattern "*$")))
(fn truncate [str len ellipsis]
(if (and (= (type str) "string")