This commit is contained in:
2026-01-24 23:40:22 +01:00
parent 1a0f7f51a1
commit 8c1a721c4c
105 changed files with 23275 additions and 94 deletions
+12
View File
@@ -0,0 +1,12 @@
// retoor <retoor@molodetz.nl>
import "html" for Html
var encoded = Html.encodeParams({"name": "John Doe", "age": 30})
System.print(encoded.contains("name=John+Doe")) // expect: true
System.print(encoded.contains("age=30")) // expect: true
System.print(encoded.contains("&")) // expect: true
var decoded = Html.decodeParams("name=John+Doe&age=30")
System.print(decoded["name"]) // expect: John Doe
System.print(decoded["age"]) // expect: 30
+13
View File
@@ -0,0 +1,13 @@
// retoor <retoor@molodetz.nl>
import "html" for Html
System.print(Html.quote("<script>")) // expect: &lt;script&gt;
System.print(Html.quote("a & b")) // expect: a &amp; b
System.print(Html.quote("\"quoted\"")) // expect: &quot;quoted&quot;
System.print(Html.quote("it's")) // expect: it&#39;s
System.print(Html.quote("normal text")) // expect: normal text
System.print(Html.unquote("&lt;script&gt;")) // expect: <script>
System.print(Html.unquote("a &amp; b")) // expect: a & b
System.print(Html.unquote("&quot;quoted&quot;")) // expect: "quoted"
+10
View File
@@ -0,0 +1,10 @@
// retoor <retoor@molodetz.nl>
import "html" for Html
System.print(Html.slugify("Hello World")) // expect: hello-world
System.print(Html.slugify("This is a TEST")) // expect: this-is-a-test
System.print(Html.slugify("foo---bar")) // expect: foo-bar
System.print(Html.slugify(" spaces ")) // expect: spaces
System.print(Html.slugify("test123")) // expect: test123
System.print(Html.slugify("UPPERCASE")) // expect: uppercase
+14
View File
@@ -0,0 +1,14 @@
// retoor <retoor@molodetz.nl>
import "html" for Html
System.print(Html.urldecode("hello+world")) // expect: hello world
var encoded1 = "foo" + "\%3D" + "bar"
System.print(Html.urldecode(encoded1)) // expect: foo=bar
var encoded2 = "a" + "\%26" + "b"
System.print(Html.urldecode(encoded2)) // expect: a&b
System.print(Html.urldecode("test")) // expect: test
System.print(Html.urldecode("")) // expect:
+9
View File
@@ -0,0 +1,9 @@
// retoor <retoor@molodetz.nl>
import "html" for Html
System.print(Html.urlencode("hello world")) // expect: hello+world
System.print(Html.urlencode("foo=bar")) // expect: foo%3Dbar
System.print(Html.urlencode("a&b")) // expect: a%26b
System.print(Html.urlencode("test")) // expect: test
System.print(Html.urlencode("")) // expect: