: run-template ( quot -- string )
with-string-writer [ "\r\n\t" member? ] reject
- "?>" split1 nip ; inline
+ [ CHAR: \s = ] trim ; inline
: test-template ( name -- template )
"vocab:html/templates/chloe/test/"
] with-scope
] unit-test
-{ "<html><head><title>Hello world</title></head><body>Blah blah</body></html>" } [
+{ "<!DOCTYPE html><html><head><title>Hello world</title></head><body>Blah blah</body></html>" } [
[
[
"test2" test-template call-template
{ "<ul><li>1</li><li>2</li><li>3</li></ul>" } [
[
"test7" test-template call-template
- ] run-template [ blank? ] reject
+ ] run-template [ ascii:blank? ] reject
] unit-test
TUPLE: person first-name last-name ;
{ "<table><tr><td>RBaxter</td><td>Unknown</td></tr><tr><td>Doug</td><td>Coleman</td></tr></table>" } [
[
"test8" test-template call-template
- ] run-template [ blank? ] reject
+ ] run-template [ ascii:blank? ] reject
] unit-test
{ } [
{ "<table><tr><td>RBaxter</td><td>Unknown</td></tr><tr><td>Doug</td><td>Coleman</td></tr></table>" } [
[
"test8" test-template call-template
- ] run-template [ blank? ] reject
+ ] run-template [ ascii:blank? ] reject
] unit-test
{ } [ 1 "id" set-value ] unit-test
{ "<table><tr><td>RBaxter</td><td>Unknown</td></tr></table>" } [
[
"test11" test-template call-template
- ] run-template [ blank? ] reject
+ ] run-template [ ascii:blank? ] reject
] unit-test
{ } [
] run-template
] with-scope
] [ error>> tag-not-allowed-here? ] must-fail-with
+
+{ "This is <style type=\"text/css\"> * { font-family: monospace; } </style>" } [
+ V{ } clone style [
+ [ "test16" test-template call-template ] run-template
+ ] with-variable
+] unit-test
+
+{ "<script type=\"text/javascript\">/* <![CDATA[*/function testAlerts() { window.alert(\"Hello, world!\");}/*]]> */</script>" } [
+ V{ } clone script [
+ [ "test17" test-template call-template ] run-template
+ ] with-variable
+] unit-test
+
+{ "<meta name=\"author\" content=\"John Doe\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>" } [
+ V{ } clone meta [
+ [ "test18" test-template call-template ] run-template
+ ] with-variable
+] unit-test