Merge branch 'master' of git://factorcode.org/git/factor
commit
37c8d6c7f5
|
@ -21,8 +21,8 @@ HELP: <date>
|
||||||
{ $description "Returns a timestamp object representing the start of the specified day in your current timezone." }
|
{ $description "Returns a timestamp object representing the start of the specified day in your current timezone." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: calendar prettyprint ;"
|
{ $example "USING: calendar prettyprint ;"
|
||||||
"2010 12 25 <date> ."
|
"2010 12 25 <date> >gmt midnight ."
|
||||||
"T{ timestamp\n { year 2010 }\n { month 12 }\n { day 25 }\n { gmt-offset T{ duration { hour -5 } } }\n}"
|
"T{ timestamp { year 2010 } { month 12 } { day 25 } }"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@ namespaces xml html.components html.forms
|
||||||
splitting unicode.categories furnace accessors ;
|
splitting unicode.categories furnace accessors ;
|
||||||
IN: html.templates.chloe.tests
|
IN: html.templates.chloe.tests
|
||||||
|
|
||||||
reset-templates
|
|
||||||
|
|
||||||
: run-template
|
: run-template
|
||||||
with-string-writer [ "\r\n\t" member? not ] filter
|
with-string-writer [ "\r\n\t" member? not ] filter
|
||||||
"?>" split1 nip ; inline
|
"?>" split1 nip ; inline
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel sequences combinators kernel fry
|
USING: accessors kernel sequences combinators kernel fry
|
||||||
namespaces make classes.tuple assocs splitting words arrays
|
namespaces make classes.tuple assocs splitting words arrays io
|
||||||
memoize io io.files io.encodings.utf8 io.streams.string
|
io.files io.encodings.utf8 io.streams.string unicode.case
|
||||||
unicode.case mirrors math urls present multiline quotations xml
|
mirrors math urls present multiline quotations xml logging
|
||||||
xml.data
|
xml.data
|
||||||
html.forms
|
html.forms
|
||||||
html.elements
|
html.elements
|
||||||
|
@ -89,21 +89,40 @@ CHLOE-TUPLE: choice
|
||||||
CHLOE-TUPLE: checkbox
|
CHLOE-TUPLE: checkbox
|
||||||
CHLOE-TUPLE: code
|
CHLOE-TUPLE: code
|
||||||
|
|
||||||
: read-template ( chloe -- xml )
|
SYMBOL: template-cache
|
||||||
path>> ".xml" append utf8 <file-reader> read-xml ;
|
|
||||||
|
|
||||||
MEMO: template-quot ( chloe -- quot )
|
H{ } template-cache set-global
|
||||||
read-template compile-template ;
|
|
||||||
|
|
||||||
MEMO: nested-template-quot ( chloe -- quot )
|
TUPLE: cached-template path last-modified quot ;
|
||||||
read-template compile-nested-template ;
|
|
||||||
|
|
||||||
: reset-templates ( -- )
|
: load-template ( chloe -- cached-template )
|
||||||
{ template-quot nested-template-quot } [ reset-memoized ] each ;
|
path>> ".xml" append
|
||||||
|
[ ]
|
||||||
|
[ file-info modified>> ]
|
||||||
|
[ utf8 <file-reader> read-xml compile-template ] tri
|
||||||
|
\ cached-template boa ;
|
||||||
|
|
||||||
|
\ load-template DEBUG add-input-logging
|
||||||
|
|
||||||
|
: cached-template ( chloe -- cached-template/f )
|
||||||
|
template-cache get at* [
|
||||||
|
[
|
||||||
|
[ path>> file-info modified>> ]
|
||||||
|
[ last-modified>> ]
|
||||||
|
bi =
|
||||||
|
] keep and
|
||||||
|
] when ;
|
||||||
|
|
||||||
|
: template-quot ( chloe -- quot )
|
||||||
|
dup cached-template [ ] [
|
||||||
|
[ load-template dup ] keep
|
||||||
|
template-cache get set-at
|
||||||
|
] ?if quot>> ;
|
||||||
|
|
||||||
|
: reset-cache ( -- )
|
||||||
|
template-cache get clear-assoc ;
|
||||||
|
|
||||||
M: chloe call-template*
|
M: chloe call-template*
|
||||||
nested-template? get
|
template-quot assert-depth ;
|
||||||
[ nested-template-quot ] [ template-quot ] if
|
|
||||||
assert-depth ;
|
|
||||||
|
|
||||||
INSTANCE: chloe template
|
INSTANCE: chloe template
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: assocs namespaces make kernel sequences accessors
|
USING: assocs namespaces make kernel sequences accessors
|
||||||
combinators strings splitting io io.streams.string present
|
combinators strings splitting io io.streams.string present
|
||||||
xml.writer xml.data xml.entities html.forms
|
xml.writer xml.data xml.entities html.forms
|
||||||
html.templates.chloe.syntax ;
|
html.templates html.templates.chloe.syntax ;
|
||||||
IN: html.templates.chloe.compiler
|
IN: html.templates.chloe.compiler
|
||||||
|
|
||||||
: chloe-attrs-only ( assoc -- assoc' )
|
: chloe-attrs-only ( assoc -- assoc' )
|
||||||
|
@ -98,9 +98,6 @@ DEFER: compile-element
|
||||||
reset-buffer
|
reset-buffer
|
||||||
] [ ] make ; inline
|
] [ ] make ; inline
|
||||||
|
|
||||||
: compile-nested-template ( xml -- quot )
|
|
||||||
[ compile-element ] with-compiler ;
|
|
||||||
|
|
||||||
: compile-chunk ( seq -- )
|
: compile-chunk ( seq -- )
|
||||||
[ compile-element ] each ;
|
[ compile-element ] each ;
|
||||||
|
|
||||||
|
@ -121,12 +118,25 @@ DEFER: compile-element
|
||||||
: compile-with-scope ( quot -- )
|
: compile-with-scope ( quot -- )
|
||||||
compile-quot [ with-scope ] [code] ; inline
|
compile-quot [ with-scope ] [code] ; inline
|
||||||
|
|
||||||
|
: if-not-nested ( quot -- )
|
||||||
|
nested-template? get swap unless ; inline
|
||||||
|
|
||||||
|
: compile-prologue ( xml -- )
|
||||||
|
[
|
||||||
|
[ before>> compile-chunk ]
|
||||||
|
[ prolog>> [ write-prolog ] [code-with] ]
|
||||||
|
bi
|
||||||
|
] compile-quot
|
||||||
|
[ if-not-nested ] [code] ;
|
||||||
|
|
||||||
|
: compile-epilogue ( xml -- )
|
||||||
|
[ after>> compile-chunk ] compile-quot
|
||||||
|
[ if-not-nested ] [code] ;
|
||||||
|
|
||||||
: compile-template ( xml -- quot )
|
: compile-template ( xml -- quot )
|
||||||
[
|
[
|
||||||
{
|
[ compile-prologue ]
|
||||||
[ prolog>> [ write-prolog ] [code-with] ]
|
[ compile-element ]
|
||||||
[ before>> compile-chunk ]
|
[ compile-epilogue ]
|
||||||
[ compile-element ]
|
tri
|
||||||
[ after>> compile-chunk ]
|
|
||||||
} cleave
|
|
||||||
] with-compiler ;
|
] with-compiler ;
|
||||||
|
|
|
@ -216,9 +216,8 @@ intel_macosx_word_size() {
|
||||||
$ECHO -n "Testing if your Intel Mac supports 64bit binaries..."
|
$ECHO -n "Testing if your Intel Mac supports 64bit binaries..."
|
||||||
sysctl machdep.cpu.extfeatures | grep EM64T >/dev/null
|
sysctl machdep.cpu.extfeatures | grep EM64T >/dev/null
|
||||||
if [[ $? -eq 0 ]] ; then
|
if [[ $? -eq 0 ]] ; then
|
||||||
WORD=32
|
WORD=64
|
||||||
$ECHO "yes!"
|
$ECHO "yes!"
|
||||||
$ECHO "Defaulting to 32bit for now though..."
|
|
||||||
else
|
else
|
||||||
WORD=32
|
WORD=32
|
||||||
$ECHO "no."
|
$ECHO "no."
|
||||||
|
|
|
@ -41,8 +41,8 @@ unit-test
|
||||||
[ "-1.0e-2" string>number number>string ]
|
[ "-1.0e-2" string>number number>string ]
|
||||||
unit-test
|
unit-test
|
||||||
|
|
||||||
[ "-1.0e-12" ]
|
[ t ]
|
||||||
[ "-1.0e-12" string>number number>string ]
|
[ "-1.0e-12" string>number number>string { "-1.0e-12" "-1.0e-012" } member? ]
|
||||||
unit-test
|
unit-test
|
||||||
|
|
||||||
[ f ]
|
[ f ]
|
||||||
|
|
|
@ -69,7 +69,6 @@ SYMBOL: key-file
|
||||||
SYMBOL: dh-file
|
SYMBOL: dh-file
|
||||||
|
|
||||||
: common-configuration ( -- )
|
: common-configuration ( -- )
|
||||||
reset-templates
|
|
||||||
"concatenative.org" 25 <inet> smtp-server set-global
|
"concatenative.org" 25 <inet> smtp-server set-global
|
||||||
"noreply@concatenative.org" lost-password-from set-global
|
"noreply@concatenative.org" lost-password-from set-global
|
||||||
"website@concatenative.org" insomniac-sender set-global
|
"website@concatenative.org" insomniac-sender set-global
|
||||||
|
|
Loading…
Reference in New Issue