]> gitweb.factorcode.org Git - factor.git/commitdiff
chloe/html: switch to HTML5 templates
authorBenjamin Pollack <benjamin@bitquabit.com>
Fri, 11 Mar 2016 16:16:18 +0000 (11:16 -0500)
committerBenjamin Pollack <benjamin@bitquabit.com>
Fri, 11 Mar 2016 23:20:55 +0000 (18:20 -0500)
Since XHTML is dead, and HTML5 isn't, switch to HTML5 templates for Chloe and
other key parts of our HTML subsystems. As part of this, I went through and
added DOCTYPE declarations to some of our examples as well.

12 files changed:
basis/html/html.factor
basis/html/templates/chloe/chloe-tests.factor
basis/html/templates/chloe/compiler/compiler.factor
extra/webapps/calculator/calculator.xml
extra/webapps/counter/counter.xml
extra/webapps/help/search.xml
extra/webapps/ip/ip.xml
extra/webapps/mason/download-package.xml
extra/webapps/mason/download-release.xml
extra/webapps/todo/todo.xml
extra/websites/concatenative/page.xml
extra/websites/factorcode/index.fhtml

index 7f1184c2f9803ec59fd9a16084abd9ed6f603d0a..1ad66273075bc9d547a65bbf12f58ebaa7bd06fe 100644 (file)
@@ -1,13 +1,17 @@
 ! Copyright (C) 2004, 2009 Chris Double, Daniel Ehrenberg,
 ! Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel xml.data xml.writer xml.syntax urls.encoding ;
+USING: accessors kernel xml.data xml.writer xml.syntax 
+urls.encoding ;
 IN: html
 
+TUPLE: empty-prolog < prolog ;
+M: empty-prolog write-xml drop ;
+: <empty-prolog> ( -- prolog ) \ empty-prolog new ;
+
 : simple-page ( title head body -- xml )
     <XML
-        <?xml version="1.0"?>
-        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+        <!DOCTYPE html>
         <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
             <head>
                 <title><-></title>
@@ -15,7 +19,7 @@ IN: html
             </head>
             <body><-></body>
         </html>
-    XML> ;
+    XML> <empty-prolog> >>prolog ;
 
 : render-error ( message -- xml )
     [XML <span class="error"><-></span> XML] ;
index 891e32826a0c8f8442b82de20905c95183c0fc1e..b9144f081508a92993be8f63e1fab282b4798be1 100644 (file)
@@ -10,7 +10,7 @@ IN: html.templates.chloe.tests
 
 : 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/"
index d18255e2fea01c4d8580a90cd059b69870245bc1..9a0704d453a9ded93fb869764c9baba1ee402da9 100644 (file)
@@ -176,9 +176,7 @@ ERROR: unknown-chloe-tag tag ;
 
 : compile-prologue ( xml -- )
     [
-        [ prolog>> [ write-xml ] [code-with] ]
-        [ before>> compile-chunk ]
-        bi
+        before>> compile-chunk
     ] compile-quot
     [ if-not-nested ] [code] ;
 
index 4dcf5d563afdc99155a8d5bbce9f4d8ed8a7ebbf..240ea840f40c3a5f42a49a0631b00127ed4cb85d 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version='1.0' ?>
-
+<!DOCTYPE html>
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
-
 <html>
        <head> <title>Calculator</title> </head>
 
index 88154438f12718da3d3ec0194282e02886d428f3..a87791bb5111b3e6dc89c112aa369f3a4ea0d9cd 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version='1.0' ?>
-
+<!DOCTYPE html>
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
-
 <html>
        <body>
                <h1><t:label t:name="counter" /></h1>
index 89add7a0bb64dafcdea3d1d7f26e00f2f926cc20..35a9d1ef1ebb4d72afc8bce611ecb1553ef35566 100644 (file)
@@ -1,7 +1,5 @@
 <?xml version='1.0' ?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-
+<!DOCTYPE html>
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
 
 <html xmlns="http://www.w3.org/1999/xhtml">
index c8529c27ceedf859baa478d29b10537600aa746d..5217273066ac9e7353933fd26cd7436fe7ff9565 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version='1.0' ?>
+<!DOCTYPE html>
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
 <html>
        <body>Your IP address is: <t:label t:name="ip" />
index 428f1f600ea2c2e68f68ffe0bdb82a070e6dd62c..00800ab6fbacdef5c9cbefbc901b623c158442f4 100644 (file)
@@ -1,7 +1,5 @@
 <?xml version='1.0' ?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html>
 
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
 
index e520d7abd42b582d0249f18f772d31f88d0e50dc..a8f8e94a4f89fa59127f014e9af694ee0ebd8720 100644 (file)
@@ -1,8 +1,5 @@
 <?xml version='1.0' ?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
+<!DOCTYPE html>
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
 
        <t:title>Factor binary package for <t:label t:name="platform" /></t:title>
index 00ed63560c1c2083a2412108d3a4c9713801b68b..146e8258ff9288b3eca29404f909ba90e9eb9017 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version='1.0' ?>
-
+<!DOCTYPE html>
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
-
 <html>
 
        <t:style t:include="resource:extra/webapps/todo/todo.css" />
index 2a5cbf7024e5ca265cc063f51e38239239fb9f39..5f9611c21badcd2b65cfae8f07564dccf7b19ea4 100644 (file)
@@ -1,7 +1,5 @@
 <?xml version='1.0' ?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-
+<!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
 
        <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
index 8061308e9ce55bc5467701bac9fce4a4d57d334a..08537e7a170fc209ce1df5e3adc9777c61352d04 100644 (file)
@@ -3,7 +3,7 @@ webapps.mason.version.data webapps.mason.backend webapps.mason.grids webapps.mas
 webapps.mason.utils html.elements html.streams accessors
 xml.writer xmode.highlight ; %>
 
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html>
 
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>