file-responder now supports .fhtml files, which are piped through contrib/embedded.factor
parent
81a9a2f977
commit
6e112b6ef8
|
@ -9,7 +9,6 @@
|
|||
- multiple listener-run-files is broken
|
||||
- roundoff is still not quite right with tracks
|
||||
- httpd search tools
|
||||
- get embedded factor templates in httpd working better
|
||||
- docs: slice: if sequence or seq start is changed, abstraction violation
|
||||
tathi: hrm. wish I knew more about OpenGL.
|
||||
[2:45pm] tathi: Factor's text display is a bit odd sometimes, until you mouse over (or click, if there's no "live" text)
|
||||
|
@ -28,7 +27,6 @@ tathi: hrm. wish I knew more about OpenGL.
|
|||
|
||||
+ ui:
|
||||
|
||||
- xref f and \ f together
|
||||
- grid slows down with 2000 lines
|
||||
- f should be clickable
|
||||
- clickable vocabs
|
||||
|
|
|
@ -49,7 +49,7 @@ USING: sequences kernel parser math namespaces io ;
|
|||
: parse-embedded ( string -- quot )
|
||||
#! simple example: "numbers: <% 3 [ 1 + pprint ] each %>"
|
||||
#! => "\"numbers: \" write 3 [ 1 + pprint ] each"
|
||||
[ embedded>factor ] f make ;
|
||||
[ embedded>factor ] [ ] make ;
|
||||
|
||||
: eval-embedded ( string -- ) parse-embedded call ;
|
||||
|
||||
|
@ -66,8 +66,6 @@ USING: sequences kernel parser math namespaces io ;
|
|||
[ eval-embedded ] with-embedded-file ;
|
||||
|
||||
: embedded-convert ( infile outfile -- )
|
||||
<file-writer> [
|
||||
run-embedded-file
|
||||
] with-stream ;
|
||||
<file-writer> [ run-embedded-file ] with-stream ;
|
||||
|
||||
PROVIDE: embedded ;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2004, 2006 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
IN: file-responder
|
||||
USING: html httpd io kernel math namespaces
|
||||
parser sequences strings ;
|
||||
USING: embedded html httpd io kernel math namespaces parser
|
||||
sequences strings ;
|
||||
|
||||
: serving-path ( filename -- filename )
|
||||
[ "" ] unless* "doc-root" get swap append ;
|
||||
|
@ -20,12 +20,17 @@ parser sequences strings ;
|
|||
<file-reader> stdio get stream-copy
|
||||
] if ;
|
||||
|
||||
SYMBOL: page
|
||||
|
||||
: run-page ( filename -- )
|
||||
[ dup page set run-embedded-file ] with-scope ;
|
||||
|
||||
: include-page ( filename -- )
|
||||
"doc-root" get swap path+ run-page ;
|
||||
|
||||
: serve-file ( filename -- )
|
||||
dup mime-type dup "application/x-factor-server-page" = [
|
||||
drop run-file
|
||||
] [
|
||||
serve-static
|
||||
] if ;
|
||||
dup mime-type dup "application/x-factor-server-page" =
|
||||
[ drop serving-html run-page ] [ serve-static ] if ;
|
||||
|
||||
: list-directory ( directory -- )
|
||||
serving-html
|
||||
|
@ -35,13 +40,15 @@ parser sequences strings ;
|
|||
"request" get [ dup log-message directory. ] simple-html-document
|
||||
] if ;
|
||||
|
||||
: find-index ( filename -- path )
|
||||
{ "index.html" "index.fhtml" }
|
||||
[ dupd path+ exists? ] find nip
|
||||
dup [ path+ ] [ nip ] if ;
|
||||
|
||||
: serve-directory ( filename -- )
|
||||
dup "/" tail? [
|
||||
dup "index.html" append dup exists? [
|
||||
nip serve-file
|
||||
] [
|
||||
drop list-directory
|
||||
] if
|
||||
dup find-index
|
||||
[ serve-file ] [ list-directory ] ?if
|
||||
] [
|
||||
drop directory-no/
|
||||
] if ;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
USING: io ;
|
||||
|
||||
REQUIRES: embedded ;
|
||||
|
||||
PROVIDE: httpd {
|
||||
"mime.factor"
|
||||
"xml.factor"
|
||||
|
|
|
@ -28,7 +28,7 @@ H{
|
|||
{ "gz" "application/octet-stream" }
|
||||
|
||||
{ "pdf" "application/pdf" }
|
||||
|
||||
|
||||
{ "factor" "text/plain" }
|
||||
{ "factsp" "application/x-factor-server-page" }
|
||||
{ "fhtml" "application/x-factor-server-page" }
|
||||
} "mime-types" global set-hash
|
||||
|
|
Loading…
Reference in New Issue