! 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>
</head>
<body><-></body>
</html>
- XML> ;
+ XML> <empty-prolog> >>prolog ;
: render-error ( message -- xml )
[XML <span class="error"><-></span> XML] ;
: 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/"
: compile-prologue ( xml -- )
[
- [ prolog>> [ write-xml ] [code-with] ]
- [ before>> compile-chunk ]
- bi
+ before>> compile-chunk
] compile-quot
[ if-not-nested ] [code] ;
<?xml version='1.0' ?>
-
+<!DOCTYPE html>
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
-
<html>
<head> <title>Calculator</title> </head>
<?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>
<?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">
<?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" />
<?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">
<?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>
<?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" />
<?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">
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>