From f01a7e1f9d48c4f96f85fc3233a52a6a5eabb37d Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Thu, 16 Nov 2023 13:12:24 -0800 Subject: [PATCH] llama-case: lowerllamacase, upperllamacase --- README.md | 6 +++++ ziba.js | 6 +++++ ziba_test.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/README.md b/README.md index bfabbf2..96d89c8 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,12 @@ Here is an example usage of **ziba.js**:

once Twice tHRICE FOURCE should become once Twice tHRICE FOURCE

+

+ once Twice tHRICE FOURCE should become once Twice tHRICE FOURCE +

+

+ once Twice tHRICE FOURCE should become once Twice tHRICE FOURCE +

ziba-link is designed to work for only local links.

diff --git a/ziba.js b/ziba.js index 5f9e062..c598a7d 100644 --- a/ziba.js +++ b/ziba.js @@ -78,12 +78,18 @@ function transform_link(rootElement) { case "lowercase": ref = ref.toLowerCase() break; + case "lowerllamacase": + ref = ref.toLowerCase().replaceAll(" ", "") + break; case "lowersnakecase": ref = ref.toLowerCase().replaceAll(" ", "_") break; case "uppercase": ref = ref.toUpperCase() break; + case "upperllamacase": + ref = ref.toUpperCase().replaceAll(" ", "") + break; case "uppersnakecase": ref = ref.toUpperCase().replaceAll(" ", "_") break; diff --git a/ziba_test.js b/ziba_test.js index d5309da..03749eb 100644 --- a/ziba_test.js +++ b/ziba_test.js @@ -213,6 +213,76 @@ 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:'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', + }, ]