make sure you can define words in fhtml templates

db4
Doug Coleman 2009-05-19 18:53:12 -05:00
parent 4489346f69
commit 5fd50a4592
2 changed files with 16 additions and 3 deletions

View File

@ -1,5 +1,5 @@
USING: io io.files io.streams.string io.encodings.utf8
html.templates html.templates.fhtml kernel
html.templates html.templates.fhtml kernel multiline
tools.test sequences parser splitting prettyprint ;
IN: html.templates.fhtml.tests
@ -17,3 +17,14 @@ IN: html.templates.fhtml.tests
[
[ ] [ "<%\n%>" parse-template drop ] unit-test
] with-file-vocabs
[
[ ] [
<"
<%
IN: html.templates.fhtml.tests
: test-word ( -- ) ;
%>
"> parse-template drop
] unit-test
] with-file-vocabs

View File

@ -4,7 +4,7 @@
USING: continuations sequences kernel namespaces debugger
combinators math quotations generic strings splitting accessors
assocs fry vocabs.parser parser parser.notes lexer io io.files
io.streams.string io.encodings.utf8 html.templates ;
io.streams.string io.encodings.utf8 html.templates compiler.units ;
IN: html.templates.fhtml
! We use a custom lexer so that %> ends a token even if not
@ -57,12 +57,14 @@ SYNTAX: %> lexer get parse-%> ;
] with-lexer ;
: parse-template ( string -- quot )
[
[
"quiet" on
parser-notes off
"html.templates.fhtml" use-vocab
string-lines parse-template-lines
] with-file-vocabs ;
] with-file-vocabs
] with-compilation-unit ;
: eval-template ( string -- )
parse-template call( -- ) ;