]> gitweb.factorcode.org Git - factor.git/commitdiff
html.templates: reverse order of style and scripts
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 6 Aug 2022 03:29:40 +0000 (20:29 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 6 Aug 2022 03:29:40 +0000 (20:29 -0700)
basis/html/templates/chloe/chloe-tests.factor
basis/html/templates/templates.factor

index 873f5905db4aa098bc25263dfa22989b2ab54132..1ba5aaaa7a005285417dac4a50ecd0efcbd1388d 100644 (file)
@@ -196,13 +196,13 @@ TUPLE: person first-name last-name ;
 ] [ error>> tag-not-allowed-here? ] must-fail-with
 
 { "This is     <style type=\"text/css\"> * { font-family: monospace; } </style>" } [
 ] [ error>> tag-not-allowed-here? ] must-fail-with
 
 { "This is     <style type=\"text/css\"> * { font-family: monospace; } </style>" } [
-    SBUF" " clone 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>" } [
         [ "test16" test-template call-template ] run-template
     ] with-variable
 ] unit-test
 
 { "<script type=\"text/javascript\">/* <![CDATA[*/function testAlerts() {    window.alert(\"Hello, world!\");}/*]]> */</script>" } [
-    SBUF" " clone script [
+    V{ } clone script [
         [ "test17" test-template call-template ] run-template
     ] with-variable
 ] unit-test
         [ "test17" test-template call-template ] run-template
     ] with-variable
 ] unit-test
index 4ffcf8c4f033db778674e4c9dce47a736eae4204..89a9921a54121ce7806acf9da416342dcc5fbfc7 100644 (file)
@@ -50,11 +50,10 @@ SYMBOL: title
 SYMBOL: style
 
 : add-style ( string -- )
 SYMBOL: style
 
 : add-style ( string -- )
-    "\n" style get push-all
-         style get push-all ;
+    style get push ;
 
 : get-style ( -- string )
 
 : get-style ( -- string )
-    style get >string ;
+    style get <reversed> "\n" join ;
 
 : write-style ( -- )
     get-style write ;
 
 : write-style ( -- )
     get-style write ;
@@ -62,11 +61,10 @@ SYMBOL: style
 SYMBOL: script
 
 : add-script ( string -- )
 SYMBOL: script
 
 : add-script ( string -- )
-    "\n" script get push-all
-         script get push-all ;
+    script get push ;
 
 : get-script ( -- string )
 
 : get-script ( -- string )
-    script get >string ;
+    script get <reversed> "\n" join ;
 
 : write-script ( -- )
     get-script write ;
 
 : write-script ( -- )
     get-script write ;
@@ -115,8 +113,8 @@ M: f call-template* drop call-next-template ;
 : with-boilerplate ( child master -- )
     [
         title [ [ <box> ] unless* ] change
 : with-boilerplate ( child master -- )
     [
         title [ [ <box> ] unless* ] change
-        style [ [ SBUF" " clone ] unless* ] change
-        script [ [ SBUF" " clone ] unless* ] change
+        style [ [ V{ } clone ] unless* ] change
+        script [ [ V{ } clone ] unless* ] change
         meta [ [ V{ } clone ] unless* ] change
         atom-feeds [ V{ } like ] change
 
         meta [ [ V{ } clone ] unless* ] change
         atom-feeds [ V{ } like ] change