diff --git a/README.md b/README.md
index edbe63e..c649aab 100644
--- a/README.md
+++ b/README.md
@@ -69,7 +69,7 @@ Here is an example usage of **ziba.js**:
* attributes:
* `dir`
* `name`
- * `transform` — possible values: `"lowercase"`, `"uppercase"`, `"lowerllamacase"`, `"upperllamacase"`, `"lowersnakecase"`, `"uppersnakecase"`
+ * `transform` — possible values: `"lowercase"`, `"uppercase"`, `"lowerllamacase"`, `"upperllamacase"`, `"lowersnakecase"`, `"uppersnakecase"`, `"lowerslugcase"`, `"upperslugcase"`
## Import
diff --git a/ziba.js b/ziba.js
index 39e4a99..1b92f4a 100644
--- a/ziba.js
+++ b/ziba.js
@@ -84,6 +84,9 @@ function transform_link(rootElement) {
case "lowersnakecase":
ref = ref.toLowerCase().replaceAll(" ", "_")
break;
+ case "lowerslugcase":
+ ref = ref.toLowerCase().replaceAll(" ", "-")
+ break;
case "uppercase":
ref = ref.toUpperCase()
break;
@@ -93,6 +96,9 @@ function transform_link(rootElement) {
case "uppersnakecase":
ref = ref.toUpperCase().replaceAll(" ", "_")
break;
+ case "upperslugcase":
+ ref = ref.toUpperCase().replaceAll(" ", "-")
+ break;
default:
logerror("unknown transform:", transform)
// Nothing here.
diff --git a/ziba_test.js b/ziba_test.js
index 3876cd8..19113f1 100644
--- a/ziba_test.js
+++ b/ziba_test.js
@@ -307,6 +307,84 @@ function testTransform() {
html:'apple Banana CHERRY',
expected:'apple Banana CHERRY',
},
+
+
+
+ {
+ html:'e',
+ expected:'e',
+ },
+ {
+ html:'E',
+ expected:'E',
+ },
+ {
+ html:'example',
+ expected:'example',
+ },
+ {
+ html:'Example',
+ expected:'Example',
+ },
+ {
+ html:'eXAMPLE',
+ expected:'eXAMPLE',
+ },
+ {
+ html:'EXAMPLE',
+ expected:'EXAMPLE',
+ },
+ {
+ html:'Hello world',
+ expected:'Hello world',
+ },
+ {
+ html:'apple Banana CHERRY',
+ expected:'apple Banana CHERRY',
+ },
+ {
+ html:'apple Banana CHERRY',
+ expected:'apple Banana CHERRY',
+ },
+
+
+
+ {
+ html:'e',
+ expected:'e',
+ },
+ {
+ html:'E',
+ expected:'E',
+ },
+ {
+ html:'example',
+ expected:'example',
+ },
+ {
+ html:'Example',
+ expected:'Example',
+ },
+ {
+ html:'eXAMPLE',
+ expected:'eXAMPLE',
+ },
+ {
+ html:'EXAMPLE',
+ expected:'EXAMPLE',
+ },
+ {
+ html:'Hello world',
+ expected:'Hello world',
+ },
+ {
+ html:'apple Banana CHERRY',
+ expected:'apple Banana CHERRY',
+ },
+ {
+ html:'apple Banana CHERRY',
+ expected:'apple Banana CHERRY',
+ },
]
tests.forEach(function(test, testNumber){