summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-01-29 17:37:37 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-01-29 17:37:37 +0100
commit80ea14aff671b29e34a4653b45d6b7c5598db3bb (patch)
tree19a2b2c131f298fb795e2279029f146dcfc2b660 /functions
parentInitial commit. (diff)
downloadxorg-80ea14aff671b29e34a4653b45d6b7c5598db3bb.tar.gz
xorg-80ea14aff671b29e34a4653b45d6b7c5598db3bb.tar.xz
Initial code add.HEADmaster
Diffstat (limited to 'functions')
-rw-r--r--functions/normalize_filename.pp7
1 files changed, 7 insertions, 0 deletions
diff --git a/functions/normalize_filename.pp b/functions/normalize_filename.pp
new file mode 100644
index 0000000..6910936
--- /dev/null
+++ b/functions/normalize_filename.pp
@@ -0,0 +1,7 @@
+# Should take any string, and replace all non-character letters with
+# dashes, and downcase everything.
+function xorg::normalize_filename (
+ String $name,
+) >> String {
+ $name.downcase().regsubst(/[^a-z0-9]/, '-')
+}