make sure you can define words in fhtml templates
parent
4489346f69
commit
5fd50a4592
|
@ -1,5 +1,5 @@
|
||||||
USING: io io.files io.streams.string io.encodings.utf8
|
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 ;
|
tools.test sequences parser splitting prettyprint ;
|
||||||
IN: html.templates.fhtml.tests
|
IN: html.templates.fhtml.tests
|
||||||
|
|
||||||
|
@ -17,3 +17,14 @@ IN: html.templates.fhtml.tests
|
||||||
[
|
[
|
||||||
[ ] [ "<%\n%>" parse-template drop ] unit-test
|
[ ] [ "<%\n%>" parse-template drop ] unit-test
|
||||||
] with-file-vocabs
|
] with-file-vocabs
|
||||||
|
|
||||||
|
[
|
||||||
|
[ ] [
|
||||||
|
<"
|
||||||
|
<%
|
||||||
|
IN: html.templates.fhtml.tests
|
||||||
|
: test-word ( -- ) ;
|
||||||
|
%>
|
||||||
|
"> parse-template drop
|
||||||
|
] unit-test
|
||||||
|
] with-file-vocabs
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
USING: continuations sequences kernel namespaces debugger
|
USING: continuations sequences kernel namespaces debugger
|
||||||
combinators math quotations generic strings splitting accessors
|
combinators math quotations generic strings splitting accessors
|
||||||
assocs fry vocabs.parser parser parser.notes lexer io io.files
|
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
|
IN: html.templates.fhtml
|
||||||
|
|
||||||
! We use a custom lexer so that %> ends a token even if not
|
! We use a custom lexer so that %> ends a token even if not
|
||||||
|
@ -58,11 +58,13 @@ SYNTAX: %> lexer get parse-%> ;
|
||||||
|
|
||||||
: parse-template ( string -- quot )
|
: parse-template ( string -- quot )
|
||||||
[
|
[
|
||||||
|
[
|
||||||
"quiet" on
|
"quiet" on
|
||||||
parser-notes off
|
parser-notes off
|
||||||
"html.templates.fhtml" use-vocab
|
"html.templates.fhtml" use-vocab
|
||||||
string-lines parse-template-lines
|
string-lines parse-template-lines
|
||||||
] with-file-vocabs ;
|
] with-file-vocabs
|
||||||
|
] with-compilation-unit ;
|
||||||
|
|
||||||
: eval-template ( string -- )
|
: eval-template ( string -- )
|
||||||
parse-template call( -- ) ;
|
parse-template call( -- ) ;
|
||||||
|
|
Loading…
Reference in New Issue