chloe/html: switch to HTML5 templates

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.
db4
Benjamin Pollack 2016-03-11 11:16:18 -05:00
parent 512014a436
commit 4ef42357e1
12 changed files with 19 additions and 28 deletions

View 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] ;

View 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/"

View 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] ;

View 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>

View 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>

View 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">

View 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" />

View 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">

View 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>

View 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" />

View 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">

View 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>