From b0d7084a74d68106b0119c5dc2bfc8c860e45173 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Wed, 3 Apr 2024 10:34:08 +0200 Subject: [PATCH] Rename functions --- src/main.lisp | 28 ++++++++++++++-------------- tests/main.lisp | 12 ++++++------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main.lisp b/src/main.lisp index fa87d25..f790da4 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -20,11 +20,11 @@ :with-page :remove-special-chars :clean-form-str - :build-name-str - :build-value-str - :build-value-prop-str - :build-class-str - :build-id-str)) + :build-str-name + :build-str-value + :build-str-value-prop + :build-str-class + :build-str-id)) (in-package :dev.metalisp.sbt) @@ -173,7 +173,7 @@ Returns: A new string which can be used as HTML class." (string-downcase (substitute #\- #\Space (string-trim '(#\Space) str)))) -(defun build-name-str (name) +(defun build-str-name (name) "Builds a standardized string by adding a 'group-' prefix and applying cleaning functions. @@ -183,7 +183,7 @@ Returns: A new standardized string." (concatenate 'string "group-" (clean-form-str name))) -(defun build-value-str (value) +(defun build-str-value (value) "Trims leading and trailing spaces from the given value string. VALUE: The string to be cleaned. @@ -192,16 +192,16 @@ Returns: A new string without leading and trailing spaces." (string-trim '(#\Space) value)) -(defun build-value-prop-str (value) +(defun build-str-value-prop (value) "Builds a value property string by applying various cleaning functions. VALUE: The initial value string. Returns: A new value property string." - (clean-form-str (build-value-str value))) + (clean-form-str (build-str-value value))) -(defun build-class-str (class name) +(defun build-str-class (class name) "Builds a class string by concatenating 'form-check-label' and a standardized name string. @@ -211,9 +211,9 @@ NAME: The initial name string. Returns: A new class string." - (concatenate 'string class " " (build-name-str name))) + (concatenate 'string class " " (build-str-name name))) -(defun build-id-str (name value) +(defun build-str-id (name value) "Builds an ID string by concatenating a standardized name string and a sanitized value property string. @@ -224,6 +224,6 @@ VALUE: The initial value string. Returns: A new ID string." (concatenate 'string - (build-name-str name) + (build-str-name name) "-" - (remove-special-chars (build-value-prop-str value)))) + (remove-special-chars (build-str-value-prop value)))) diff --git a/tests/main.lisp b/tests/main.lisp index b2174a4..ebe0962 100644 --- a/tests/main.lisp +++ b/tests/main.lisp @@ -23,14 +23,14 @@ (testing "Cleans a form string for use as a name or identifier." (ok (string= (clean-form-str " hello WORLD") "hello-world")))) -(deftest test-build-name-str +(deftest test-build-str-name (testing "Builds a standardized string by adding a 'group-' prefix and applying cleaning functions." - (ok (string= (build-name-str "somename") "group-somename")))) + (ok (string= (build-str-name "somename") "group-somename")))) -(deftest test-build-value-str +(deftest test-build-str-value (testing "Trims leading and trailing spaces from the given value string." - (ok (string= (build-value-str " hello-world ") "hello-world")))) + (ok (string= (build-str-value " hello-world ") "hello-world")))) -(deftest test-build-value-prop-str +(deftest test-build-str-value-prop (testing "Builds a value property string by applying various cleaning functions." - (ok (string= (build-value-prop-str " hello world ") "hello-world")))) + (ok (string= (build-str-value-prop " hello world ") "hello-world"))))