webapps.help: remove frames. Fixes #242.

db4
John Benediktsson 2011-10-13 22:09:30 -07:00
parent f20e5df501
commit 0965d9be41
6 changed files with 119 additions and 109 deletions

View File

@ -60,14 +60,28 @@ M: f topic>filename* drop \ f topic>filename* ;
M: topic url-of topic>filename ;
: help-stylesheet ( -- string )
: help-stylesheet ( -- xml )
"vocab:help/html/stylesheet.css" ascii file-contents
[XML <style><-></style> XML] ;
: help-navbar ( -- xml )
[XML
<div class="navbar">
<b> Factor Documentation </b> |
<a href="/">Home</a> |
<a href="article-conventions.html">Glossary</a> |
<form method="post" action="/search" style="display:inline;">
<input name="search" type="text"/>
<button type="submit">Search</button>
</form>
<a href="http://factorcode.org" style="float:right; padding: 4px;">factorcode.org</a>
</div>
XML] ;
: help>html ( topic -- xml )
[ article-title ]
[ article-title " - Factor Documentation" append ]
[ drop help-stylesheet ]
[ [ print-topic ] with-html-writer ]
[ [ print-topic ] with-html-writer help-navbar prepend ]
tri simple-page ;
: generate-help-file ( topic -- )

View File

@ -2,3 +2,11 @@ a:link { text-decoration: none; color: #104e8b; }
a:visited { text-decoration: none; color: #104e8b; }
a:active { text-decoration: none; color: #104e8b; }
a:hover { text-decoration: underline; color: #104e8b; }
.navbar {
background-color: #eeeee0;
padding: 5px;
border: 1px solid #ccc;
font:9pt "Lucida Grande", "Lucida Sans Unicode", verdana, geneva, sans-serif;
margin-bottom: 10px;
}

View File

@ -1,9 +1,11 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors db.sqlite furnace.actions furnace.alloy kernel
http.server.dispatchers http.server.static furnace.redirection
urls validators locals io.files io.directories help.html
html.forms html.components http.server namespaces ;
USING: accessors db.sqlite furnace.actions furnace.alloy
furnace.redirection help.html help.topics html.components
html.forms html.templates.chloe http.server
http.server.dispatchers http.server.static io.directories
io.files kernel locals namespaces sequences unicode.categories
urls ;
IN: webapps.help
TUPLE: help-webapp < dispatcher ;
@ -15,36 +17,34 @@ M: result link-href href>> ;
:: <search-action> ( help-dir -- action )
<page-action>
{ help-webapp "search" } >>template
[
{
{ "search" [ 1 v-min-length 50 v-max-length v-one-line ] }
} validate-params
help-dir [
"search" value article-apropos "articles" set-value
"search" value word-apropos "words" set-value
"search" value vocab-apropos "vocabs" set-value
] with-directory
"search" param [ blank? ] trim [
help-dir [
[ article-apropos "articles" set-value ]
[ word-apropos "words" set-value ]
[ vocab-apropos "vocabs" set-value ] tri
] with-directory
] unless-empty
{ help-webapp "search" } <chloe-content>
] >>submit ;
: <main-action> ( -- action )
<page-action>
{ help-webapp "help" } >>template ;
: help-url ( topic -- url )
topic>filename "$help-webapp/content/" prepend >url ;
:: <help-webapp> ( help-dir help-db -- webapp )
: <main-action> ( -- action )
<action>
[ "handbook" >link help-url <redirect> ] >>display ;
:: <help-webapp> ( help-dir -- webapp )
help-webapp new-dispatcher
<main-action> "" add-responder
help-dir <search-action> help-db [ <alloy> ] when* "search" add-responder
help-dir <search-action> "search" add-responder
help-dir <static> "content" add-responder
"resource:basis/definitions/icons/" <static> "icons" add-responder ;
: run-help-webapp ( -- )
"resource:temp/docs"
"resource:help.db" <sqlite-db>
<help-webapp>
"resource:temp/docs" <help-webapp>
main-responder set-global
8080 httpd drop ;

View File

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Factor Documentation</title>
<t:base t:href="$help-webapp" />
</head>
<frameset cols="30%, 70%">
<frame src="search" name="search" />
<frame src="content/article-handbook.html" name="content" />
</frameset>
</html>
</t:chloe>

View File

@ -5,72 +5,80 @@
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<t:base t:href="$help-webapp/content/" />
<head>
<style>
body { font-family: sans-serif; font-size: 85%; }
a:link { text-decoration: none; color: #00004c; }
a:visited { text-decoration: none; color: #00004c; }
a:active { text-decoration: none; color: #00004c; }
a:hover { text-decoration: underline; color: #00004c; }
span.error { display: block; color: red; }
</style>
</head>
<t:base t:href="$help-webapp/content/" />
<title>Search - Factor Documentation</title>
<style>
a:link { text-decoration: none; color: #104e8b; }
a:visited { text-decoration: none; color: #104e8b; }
a:active { text-decoration: none; color: #104e8b; }
a:hover { text-decoration: underline; color: #104e8b; }
<body>
<h1><t:a t:href="$help-webapp/content/article-handbook.html"
target="content">Factor documentation</t:a></h1>
body {
font-family: sans-serif; font-style: normal
font-size: 12pt;
}
<p>This is the <a href="http://factorcode.org" target="_top">Factor</a>
documentation, generated offline from a
<code>load-all</code> image. If you want, you can also browse the
documentation from within the <a href="http://factorcode.org" target="_top">Factor</a> UI.</p>
<p>You may search article titles below; for example, try searching for "HTTP".</p>
<t:form t:action="$help-webapp/search">
<t:field t:name="search" />
<button type="submit">Search</button>
</t:form>
<t:if t:value="articles">
<hr/>
<h2>Articles</h2>
<ul>
<t:each t:name="articles">
<li> <t:link t:name="value" t:target="content" /> </li>
</t:each>
</ul>
</t:if>
<t:if t:value="vocabs">
<hr/>
<h2>Vocabularies</h2>
<ul>
<t:each t:name="vocabs">
<li> <t:link t:name="value" t:target="content" /> </li>
</t:each>
</ul>
</t:if>
<t:if t:value="words">
<hr/>
<h2>Words</h2>
<ul>
<t:each t:name="words">
<li> <t:link t:name="value" t:target="content" /> </li>
</t:each>
</ul>
</t:if>
.navbar {
background-color: #eeeee0;
padding: 5px;
border: 1px solid #ccc;
font:9pt "Lucida Grande", "Lucida Sans Unicode", verdana, geneva, sans-serif;
margin-bottom: 10px;
}
</body>
h2 { background-color: #f5f5f5; color: #222; }
hr { border: 0; background-color: #ccc; color: #ccc; height: 1px; }
</style>
</head>
<body>
<div class="navbar">
<b> Factor Documentation </b> |
<a href="/">Home</a> |
<a href="article-conventions.html">Glossary</a> |
<t:form t:action="$help-webapp/search" style="display:inline;">
<t:field t:name="search" />
<button type="submit">Search</button>
</t:form>
<a href="http://factorcode.org" style="float:right; padding: 4px;" >factorcode.org</a>
</div>
<t:if t:value="articles">
<h2>Articles</h2>
<ul>
<t:each t:name="articles">
<li> <t:link t:name="value" /> </li>
</t:each>
</ul>
</t:if>
<t:if t:value="vocabs">
<h2>Vocabularies</h2>
<ul>
<t:each t:name="vocabs">
<li> <t:link t:name="value" /> </li>
</t:each>
</ul>
</t:if>
<t:if t:value="words">
<h2>Words</h2>
<ul>
<t:each t:name="words">
<li> <t:link t:name="value" /> </li>
</t:each>
</ul>
</t:if>
<hr />
<p>This is the <a href="http://factorcode.org" target="_top">Factor</a>
documentation, generated offline from a
<code>load-all</code> image. If you want, you can also browse the
documentation from within the <a href="http://factorcode.org" target="_top">Factor</a> UI.</p>
</body>
</html>
</t:chloe>

View File

@ -89,7 +89,7 @@ SYMBOLS: key-password key-file dh-file ;
<pastebin> <factor-recaptcha> <login-config> <factor-boilerplate> "pastebin" add-responder
<planet> <login-config> <factor-boilerplate> "planet" add-responder
<mason-app> <login-config> <factor-boilerplate> "mason" add-responder
"/tmp/docs/" f <help-webapp> "docs" add-responder
"/tmp/docs/" <help-webapp> "docs" add-responder
website-db <alloy>
main-responder set-global ;
@ -108,7 +108,7 @@ SYMBOLS: key-password key-file dh-file ;
<pastebin> <factor-recaptcha> <login-config> <factor-boilerplate> website-db <alloy> "paste.factorcode.org" add-responder
<planet> <login-config> <factor-boilerplate> website-db <alloy> "planet.factorcode.org" add-responder
<mason-app> <login-config> <factor-boilerplate> website-db <alloy> "builds.factorcode.org" add-responder
home "docs" append-path website-db <help-webapp> "docs.factorcode.org" add-responder
home "docs" append-path <help-webapp> "docs.factorcode.org" add-responder
home "cgi" append-path <gitweb> "gitweb.factorcode.org" add-responder
main-responder set-global ;