From: Benjamin Pollack Date: Fri, 11 Mar 2016 16:16:18 +0000 (-0500) Subject: chloe/html: switch to HTML5 templates X-Git-Tag: unmaintained~1554 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=4ef42357e13ebe6debb2a3072f096c496ba27a38 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. --- diff --git a/basis/html/html.factor b/basis/html/html.factor index 7f1184c2f9..1ad6627307 100644 --- a/basis/html/html.factor +++ b/basis/html/html.factor @@ -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 ; +: ( -- prolog ) \ empty-prolog new ; + : simple-page ( title head body -- xml ) - + <-> @@ -15,7 +19,7 @@ IN: html <-> - XML> ; + XML> >>prolog ; : render-error ( message -- xml ) [XML <-> XML] ; diff --git a/basis/html/templates/chloe/chloe-tests.factor b/basis/html/templates/chloe/chloe-tests.factor index 891e32826a..b9144f0815 100644 --- a/basis/html/templates/chloe/chloe-tests.factor +++ b/basis/html/templates/chloe/chloe-tests.factor @@ -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/" diff --git a/basis/html/templates/chloe/compiler/compiler.factor b/basis/html/templates/chloe/compiler/compiler.factor index d18255e2fe..9a0704d453 100644 --- a/basis/html/templates/chloe/compiler/compiler.factor +++ b/basis/html/templates/chloe/compiler/compiler.factor @@ -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] ; diff --git a/extra/webapps/calculator/calculator.xml b/extra/webapps/calculator/calculator.xml index 4dcf5d563a..240ea840f4 100644 --- a/extra/webapps/calculator/calculator.xml +++ b/extra/webapps/calculator/calculator.xml @@ -1,7 +1,6 @@ - + - Calculator diff --git a/extra/webapps/counter/counter.xml b/extra/webapps/counter/counter.xml index 88154438f1..a87791bb51 100644 --- a/extra/webapps/counter/counter.xml +++ b/extra/webapps/counter/counter.xml @@ -1,7 +1,6 @@ - + -

diff --git a/extra/webapps/help/search.xml b/extra/webapps/help/search.xml index 89add7a0bb..35a9d1ef1e 100644 --- a/extra/webapps/help/search.xml +++ b/extra/webapps/help/search.xml @@ -1,7 +1,5 @@ - - - + diff --git a/extra/webapps/ip/ip.xml b/extra/webapps/ip/ip.xml index c8529c27ce..5217273066 100644 --- a/extra/webapps/ip/ip.xml +++ b/extra/webapps/ip/ip.xml @@ -1,4 +1,5 @@ + Your IP address is: diff --git a/extra/webapps/mason/download-package.xml b/extra/webapps/mason/download-package.xml index 428f1f600e..00800ab6fb 100644 --- a/extra/webapps/mason/download-package.xml +++ b/extra/webapps/mason/download-package.xml @@ -1,7 +1,5 @@ - - + diff --git a/extra/webapps/mason/download-release.xml b/extra/webapps/mason/download-release.xml index e520d7abd4..a8f8e94a4f 100644 --- a/extra/webapps/mason/download-release.xml +++ b/extra/webapps/mason/download-release.xml @@ -1,8 +1,5 @@ - - - + Factor binary package for diff --git a/extra/webapps/todo/todo.xml b/extra/webapps/todo/todo.xml index 00ed63560c..146e8258ff 100644 --- a/extra/webapps/todo/todo.xml +++ b/extra/webapps/todo/todo.xml @@ -1,7 +1,6 @@ - + - diff --git a/extra/websites/concatenative/page.xml b/extra/websites/concatenative/page.xml index 2a5cbf7024..5f9611c21b 100644 --- a/extra/websites/concatenative/page.xml +++ b/extra/websites/concatenative/page.xml @@ -1,7 +1,5 @@ - - - + diff --git a/extra/websites/factorcode/index.fhtml b/extra/websites/factorcode/index.fhtml index 8061308e9c..08537e7a17 100644 --- a/extra/websites/factorcode/index.fhtml +++ b/extra/websites/factorcode/index.fhtml @@ -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 ; %> - +