More web framework work
parent
4ad555eb29
commit
21e4d08362
|
@ -1,5 +1,4 @@
|
||||||
- live search: timer delay would be nice
|
- live search: timer delay would be nice
|
||||||
- httpd search tools
|
|
||||||
- hashed generic method dispatch
|
- hashed generic method dispatch
|
||||||
- fix this:
|
- fix this:
|
||||||
[ 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 11 11 11 113 ] .
|
[ 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 11 11 11 113 ] .
|
||||||
|
|
|
@ -29,14 +29,12 @@ C: pastebin ( -- pastebin )
|
||||||
pastebin get pastebin-pastes nth ;
|
pastebin get pastebin-pastes nth ;
|
||||||
|
|
||||||
: show-paste ( n -- )
|
: show-paste ( n -- )
|
||||||
"Paste"
|
get-paste "show-paste" "Paste" render-page ;
|
||||||
swap get-paste
|
|
||||||
"show-paste" render-page ;
|
|
||||||
|
|
||||||
\ show-paste { { "n" v-number } } define-action
|
\ show-paste { { "n" v-number } } define-action
|
||||||
|
|
||||||
: new-paste ( -- )
|
: new-paste ( -- )
|
||||||
"New paste" f "new-paste" render-page ;
|
f "new-paste" "New paste" render-page ;
|
||||||
|
|
||||||
\ new-paste { } define-action
|
\ new-paste { } define-action
|
||||||
|
|
||||||
|
@ -55,9 +53,7 @@ C: pastebin ( -- pastebin )
|
||||||
[ show-paste ] "show-paste-quot" set
|
[ show-paste ] "show-paste-quot" set
|
||||||
[ new-paste ] "new-paste-quot" set
|
[ new-paste ] "new-paste-quot" set
|
||||||
|
|
||||||
"Pastebin"
|
pastebin get "paste-list" "Pastebin" render-page
|
||||||
pastebin get
|
|
||||||
"paste-list" render-page
|
|
||||||
] with-scope ;
|
] with-scope ;
|
||||||
|
|
||||||
\ paste-list { } define-action
|
\ paste-list { } define-action
|
||||||
|
|
|
@ -98,20 +98,12 @@ SYMBOL: model
|
||||||
".fhtml" append resource-path run-embedded-file
|
".fhtml" append resource-path run-embedded-file
|
||||||
] with-scope ;
|
] with-scope ;
|
||||||
|
|
||||||
TUPLE: component model template ;
|
|
||||||
|
|
||||||
TUPLE: page title root ;
|
|
||||||
|
|
||||||
C: page ( title model template -- page )
|
|
||||||
[ >r <component> r> set-page-root ] keep
|
|
||||||
[ set-page-title ] keep ;
|
|
||||||
|
|
||||||
: render-template ( model template -- )
|
: render-template ( model template -- )
|
||||||
template-path get swap path+ call-template ;
|
template-path get swap path+ call-template ;
|
||||||
|
|
||||||
: render-page ( title model template -- )
|
: render-page ( model template title -- )
|
||||||
|
[
|
||||||
[
|
[
|
||||||
rot [
|
|
||||||
render-template
|
render-template
|
||||||
] html-document
|
] html-document
|
||||||
] with-html-stream ;
|
] with-html-stream ;
|
||||||
|
|
|
@ -20,20 +20,19 @@ TUPLE: list current options name ;
|
||||||
2dup lookup dup
|
2dup lookup dup
|
||||||
[ 2nip summary ] [ drop nip "IN: " swap append ] if ;
|
[ 2nip summary ] [ drop nip "IN: " swap append ] if ;
|
||||||
|
|
||||||
TUPLE: browser word vocab ;
|
TUPLE: browser word vocab apropos ;
|
||||||
|
|
||||||
: browse ( word vocab -- )
|
: browse ( word vocab apropos -- )
|
||||||
2dup browser-title
|
pick pick browser-title >r <browser> "browser" r> render-page ;
|
||||||
-rot <browser>
|
|
||||||
"browser" render-page ;
|
|
||||||
|
|
||||||
\ browse {
|
\ browse {
|
||||||
{ "word" }
|
{ "word" }
|
||||||
{ "vocab" "kernel" v-default }
|
{ "vocab" "kernel" v-default }
|
||||||
|
{ "apropos" }
|
||||||
} define-action
|
} define-action
|
||||||
|
|
||||||
"browser" "browse" "contrib/furnace/tools" web-app
|
"browser" "browse" "contrib/furnace/tools" web-app
|
||||||
|
|
||||||
M: word browser-link-href
|
M: word browser-link-href
|
||||||
dup word-name swap word-vocabulary \ browse
|
dup word-name swap word-vocabulary f \ browse
|
||||||
3array >quotation quot-link ;
|
4array >quotation quot-link ;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<% USING: namespaces furnace:browser words help kernel ; %>
|
<% USING: namespaces furnace:browser words help kernel tools sequences io
|
||||||
|
html ; %>
|
||||||
|
|
||||||
<form id="main" action="browse" method="get">
|
<form id="main" action="browse" method="get">
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Vocabularies</th>
|
<th align="left">Vocabularies</th>
|
||||||
<th>Words</th>
|
<th align="left">Words</th>
|
||||||
<th>Documentation</th>
|
<th align="left">Documentation</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top" style="width: 200px;">
|
<td valign="top" style="width: 200px;">
|
||||||
|
@ -19,4 +20,14 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<h2>Apropos</h2>
|
||||||
|
<input type="field" name="apropos" /><br/>
|
||||||
|
<%
|
||||||
|
"apropos" get dup empty? [
|
||||||
|
drop
|
||||||
|
] [
|
||||||
|
<b> "Results for " write dup write ":" write </b> <br/>
|
||||||
|
apropos
|
||||||
|
] if
|
||||||
|
%>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,22 +1,19 @@
|
||||||
! Copyright (C) 2005, 2006 Slava Pestov.
|
! Copyright (C) 2005, 2006 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
IN: furnace:help
|
IN: furnace:help
|
||||||
USING: furnace help html kernel sequences words strings ;
|
USING: furnace help html kernel sequences words strings io ;
|
||||||
|
|
||||||
: string>topic ( string -- topic )
|
|
||||||
" " split dup length 1 = [ first ] when ;
|
|
||||||
|
|
||||||
: show-help ( topic -- )
|
: show-help ( topic -- )
|
||||||
dup article-title [
|
dup article-title [
|
||||||
[ help ] with-html-stream
|
[ help ] with-html-stream
|
||||||
|
<br/>
|
||||||
|
<a "search" =href a> "Search" write </a>
|
||||||
] html-document ;
|
] html-document ;
|
||||||
|
|
||||||
\ show-help {
|
\ show-help {
|
||||||
{ "topic" "handbook" v-default string>topic }
|
{ "topic" "handbook" v-default string>topic }
|
||||||
} define-action
|
} define-action
|
||||||
|
|
||||||
"help" "show-help" "contrib/furnace/tools" web-app
|
|
||||||
|
|
||||||
M: link browser-link-href
|
M: link browser-link-href
|
||||||
link-name [ \ f ] unless* dup word? [
|
link-name [ \ f ] unless* dup word? [
|
||||||
browser-link-href
|
browser-link-href
|
||||||
|
@ -24,3 +21,14 @@ M: link browser-link-href
|
||||||
dup [ string? ] all? [ " " join ] when
|
dup [ string? ] all? [ " " join ] when
|
||||||
[ show-help ] curry quot-link
|
[ show-help ] curry quot-link
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
|
TUPLE: search terms ;
|
||||||
|
|
||||||
|
: search ( terms -- )
|
||||||
|
<search> "search" "Search" render-page ;
|
||||||
|
|
||||||
|
\ search {
|
||||||
|
{ "terms" }
|
||||||
|
} define-action
|
||||||
|
|
||||||
|
"help" "show-help" "contrib/furnace/tools" web-app
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<% USING: help kernel sequences html namespaces io ; %>
|
||||||
|
|
||||||
|
<form action="search" method="get">
|
||||||
|
<h1>Search help</h1>
|
||||||
|
<input type="field" name="terms" />
|
||||||
|
<%
|
||||||
|
"terms" get dup empty? [
|
||||||
|
drop
|
||||||
|
] [
|
||||||
|
<b> "Results for " write dup write ":" write </b> <br/>
|
||||||
|
search-help.
|
||||||
|
] if
|
||||||
|
%>
|
||||||
|
<input type="submit" />
|
||||||
|
</form>
|
Loading…
Reference in New Issue