llama-case: lowerllamacase, upperllamacase
parent
f57cde9121
commit
f01a7e1f9d
|
@ -38,6 +38,12 @@ Here is an example usage of **ziba.js**:
|
||||||
<p>
|
<p>
|
||||||
<ziba-link tramsform="uppersnakecase">once Twice tHRICE FOURCE</ziba-link> should become <a href="./ONCE_TWICE_THRICE_FOURCE">once Twice tHRICE FOURCE</a>
|
<ziba-link tramsform="uppersnakecase">once Twice tHRICE FOURCE</ziba-link> should become <a href="./ONCE_TWICE_THRICE_FOURCE">once Twice tHRICE FOURCE</a>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<ziba-link tramsform="lowerllamacase">once Twice tHRICE FOURCE</ziba-link> should become <a href="./oncetwicethricefource">once Twice tHRICE FOURCE</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<ziba-link tramsform="upperllamacase">once Twice tHRICE FOURCE</ziba-link> should become <a href="./ONCETWICETHRICEFOURCE">once Twice tHRICE FOURCE</a>
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
ziba-link is designed to work for only local links.
|
ziba-link is designed to work for only local links.
|
||||||
</p>
|
</p>
|
||||||
|
|
6
ziba.js
6
ziba.js
|
@ -78,12 +78,18 @@ function transform_link(rootElement) {
|
||||||
case "lowercase":
|
case "lowercase":
|
||||||
ref = ref.toLowerCase()
|
ref = ref.toLowerCase()
|
||||||
break;
|
break;
|
||||||
|
case "lowerllamacase":
|
||||||
|
ref = ref.toLowerCase().replaceAll(" ", "")
|
||||||
|
break;
|
||||||
case "lowersnakecase":
|
case "lowersnakecase":
|
||||||
ref = ref.toLowerCase().replaceAll(" ", "_")
|
ref = ref.toLowerCase().replaceAll(" ", "_")
|
||||||
break;
|
break;
|
||||||
case "uppercase":
|
case "uppercase":
|
||||||
ref = ref.toUpperCase()
|
ref = ref.toUpperCase()
|
||||||
break;
|
break;
|
||||||
|
case "upperllamacase":
|
||||||
|
ref = ref.toUpperCase().replaceAll(" ", "")
|
||||||
|
break;
|
||||||
case "uppersnakecase":
|
case "uppersnakecase":
|
||||||
ref = ref.toUpperCase().replaceAll(" ", "_")
|
ref = ref.toUpperCase().replaceAll(" ", "_")
|
||||||
break;
|
break;
|
||||||
|
|
70
ziba_test.js
70
ziba_test.js
|
@ -213,6 +213,76 @@ function testTransform() {
|
||||||
html:'<ziba-link transform="uppersnakecase">apple Banana CHERRY</ziba-link>',
|
html:'<ziba-link transform="uppersnakecase">apple Banana CHERRY</ziba-link>',
|
||||||
expected:'<a href="./APPLE_BANANA_CHERRY">apple Banana CHERRY</a>',
|
expected:'<a href="./APPLE_BANANA_CHERRY">apple Banana CHERRY</a>',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="lowerllamacase">e</ziba-link>',
|
||||||
|
expected:'<a href="./e">e</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="lowerllamacase">E</ziba-link>',
|
||||||
|
expected:'<a href="./e">E</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="lowerllamacase">example</ziba-link>',
|
||||||
|
expected:'<a href="./example">example</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="lowerllamacase">Example</ziba-link>',
|
||||||
|
expected:'<a href="./example">Example</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="lowerllamacase">eXAMPLE</ziba-link>',
|
||||||
|
expected:'<a href="./example">eXAMPLE</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="lowerllamacase">EXAMPLE</ziba-link>',
|
||||||
|
expected:'<a href="./example">EXAMPLE</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="lowerllamacase">Hello world</ziba-link>',
|
||||||
|
expected:'<a href="./helloworld">Hello world</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="lowerllamacase">apple Banana CHERRY</ziba-link>',
|
||||||
|
expected:'<a href="./applebananacherry">apple Banana CHERRY</a>',
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="upperllamacase">e</ziba-link>',
|
||||||
|
expected:'<a href="./E">e</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="upperllamacase">E</ziba-link>',
|
||||||
|
expected:'<a href="./E">E</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="upperllamacase">example</ziba-link>',
|
||||||
|
expected:'<a href="./EXAMPLE">example</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="upperllamacase">Example</ziba-link>',
|
||||||
|
expected:'<a href="./EXAMPLE">Example</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="upperllamacase">eXAMPLE</ziba-link>',
|
||||||
|
expected:'<a href="./EXAMPLE">eXAMPLE</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="upperllamacase">EXAMPLE</ziba-link>',
|
||||||
|
expected:'<a href="./EXAMPLE">EXAMPLE</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="upperllamacase">Hello world</ziba-link>',
|
||||||
|
expected:'<a href="./HELLOWORLD">Hello world</a>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
html:'<ziba-link transform="upperllamacase">apple Banana CHERRY</ziba-link>',
|
||||||
|
expected:'<a href="./APPLEBANANACHERRY">apple Banana CHERRY</a>',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue