Skip to content

Commit

Permalink
Minor changes to the generator code (to work for 1 3 on PLaneT); prep…
Browse files Browse the repository at this point in the history
…ping for submission to PLaneT; updated the docs
  • Loading branch information
rob7hunter committed Sep 26, 2008
1 parent 960eb7b commit 21f4482
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 210 deletions.
5 changes: 5 additions & 0 deletions doc.html

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions doc.scrbl
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
#lang scribble/doc
@(require scribble/manual)

@title{LeftParen 1.3 Documentation}
@title{LeftParen 0.3 Documentation}

Website: @link["http://leftparen.com"]{http://leftparen.com}

LeftParen is a framework for quickly creating web apps. It runs on
PLT Scheme v4.1 or greater.
PLT Scheme v4.1 or greater. LeftParen is released under an @link["http://github.com/vegashacker/leftparen/tree/master/MIT-LICENSE.txt"]{MIT License}. The source is available on @link["http://github.com/vegashacker/leftparen/tree/master"]{github}.

@section{Installing LeftParen}

You'll need PLT Scheme v4.1 or greater installed. Note that this
version is not officially released yet, so you you'll need to get it from
the @link["http://pre.plt-scheme.org/installers/"]{pre-release
download page}.
You'll need PLT Scheme v4.1 or greater installed.

Make sure that @scheme[mzscheme] is in your path. You should be ready
to go if you can do this:

@verbatim{
% mzscheme
Welcome to MzScheme v3.99...
Welcome to MzScheme v4.1...
>
}

Installing LeftParen is done behind the scenese with a @link["http://planet.plt-scheme.org/"]{PLaneT} @scheme[require]. See @secref{tutorials} for an example of this. When you
Installing LeftParen is done behind the scenes with a @link["http://planet.plt-scheme.org/"]{PLaneT} @scheme[require]. See @secref{tutorials} for an example of this. When you
first issue one of these @scheme[require] commands, you'll automatically download the LeftParen files to your local PLaneT cache. This can sometimes take a few moments, so be prepared to wait a bit.

@section[#:tag "tutorials"]{Tutorials}
Expand All @@ -33,7 +30,7 @@ first issue one of these @scheme[require] commands, you'll automatically downloa

We're going to make a project called @tt{hello-world}. Change to the directory that you'd like to make the project in. Then issue

@verbatim{% mzscheme -e '(require (planet "bootstrap.scm" ("vegashacker" "leftparen.plt" 1 2)))' project hello-world}
@verbatim{% mzscheme -e '(require (planet "bootstrap.scm" ("vegashacker" "leftparen.plt" 1 3)))' project hello-world}

This will create a @tt{hello-world} project directory for you. In this directory you'll find the @tt{script} directory, which contains some useful scripts. All paths are relative to this project directory, so when calling scripts, you always want to be at the project root.

Expand Down Expand Up @@ -62,7 +59,7 @@ Point your browser to @link["http://localhost:8765"]{http://localhost:8765} and
Now let's try implementing the true "hello world" of web apps---a blog. First, execute the following commands from the directory in which you want to create your project directory:

@verbatim{
% mzscheme -e '(require (planet "bootstrap.scm" ("vegashacker" "leftparen.plt" 1 2)))' project blogerton
% mzscheme -e '(require (planet "bootstrap.scm" ("vegashacker" "leftparen.plt" 1 3)))' project blogerton
% cd blogerton
% chmod u+x script/*
}
Expand All @@ -84,11 +81,11 @@ Now we need to define those pages that we declared in @tt{app.scm}.

@schemeblock[
(define-page (index-page req)
`(h1 "Blogerton")
`(p ,(web-link "Create a new post" (page-url create-post-page)))
`(ul ,@(map (lambda (p) `(li ,(paint-blog-post p)))
(load-where '((type . blog-post))
#:sort-by 'created_at #:compare >))))
(** `(h1 "Blogerton")
`(p ,(web-link "Create a new post" (page-url create-post-page)))
`(ul ,@(map (lambda (p) `(li ,(paint-blog-post p)))
(load-where '((type . blog-post))
#:sort-by 'created-at #:compare >)))))

(define-page (create-post-page req)
(form '((title "Title" text) (body "Body" long-text))
Expand All @@ -111,6 +108,10 @@ You're ready for launch. Start the server with

and you should have a basic blogging app, with persistent data, in 19 lines of code.

@section{More Documentation to Come}

We need to get a full LeftParen reference up (not just simple tutorials). There's lots more cool stuff in LeftParen that this document doesn't yet address.

@section{About/Acknowledgements}

LeftParen was written by @link["http://robhunter.org"]{Rob Hunter}, but it builds heavily on (and, in fact, often directly incorporates) the work of @link["http://untyped.com/"]{Untyped} (@link["http://planet.plt-scheme.org/display.ss?package=instaservlet.plt&owner=untyped"]{instaservlet} and @link["http://planet.plt-scheme.org/display.ss?package=dispatch.plt&owner=untyped"]{dispatch}), @link["http://scheme.dk/blog/"]{Jens Axel Soegaard} (@link["http://planet.plt-scheme.org/display.ss?package=web.plt&owner=soegaard"]{web.plt}), and of course, @link["http://www.plt-scheme.org/"]{PLT Scheme}.
127 changes: 0 additions & 127 deletions doc.txt

This file was deleted.

2 changes: 1 addition & 1 deletion generate-lib.scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(provide generate generate-from-path)

(define PLANET_MAJOR_VERISON 1)
(define PLANET_MINOR_VERSION 2)
(define PLANET_MINOR_VERSION 3)

(define (generate args-vec)
(generate-from-args-list (vector->list args-vec)))
Expand Down
9 changes: 5 additions & 4 deletions info.ss
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#lang setup/infotab
(define name "LeftParen")
(define blurb '("LeftParen lets you make web apps quickly."))
(define release-notes '("This is still early stage software, so be warned. That said, feel free to contact me with any issues you encounter. I'm happy to help out."))
(define blurb '((p "LeftParen lets you make web apps quickly.")))
(define release-notes '((p "This is a major upgrade that is now compatible with PLT 4.1. There are many other miscellaneous improvements too.")))
(define primary-file "leftparen.scm")
(define version "0.3")
(define doc.txt "doc.txt")
(define scribblings '(("doc.scrbl" ())))
(define required-core-version "4.1")
(define repositories '("4.x"))
(define categories '(devtools net))
67 changes: 67 additions & 0 deletions scribble-common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Common functionality for PLT documentation pages

function GetCookie(key, def) {
if (document.cookie.length <= 0) return def;
var i, cookiestrs = document.cookie.split(/; */);
for (i = 0; i < cookiestrs.length; i++) {
var cur = cookiestrs[i];
var eql = cur.indexOf('=');
if (eql >= 0 && cur.substring(0,eql) == key)
return unescape(cur.substring(eql+1));
}
return def;
}

function SetCookie(key, val) {
var d = new Date();
d.setTime(d.getTime()+(365*24*60*60*1000));
document.cookie =
key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/";
}

// note that this always stores a directory name, ending with a "/"
function SetPLTRoot(ver, relative) {
var root = location.protocol + "//" + location.host
+ NormalizePath(location.pathname.replace(/[^\/]*$/, relative));
SetCookie("PLT_Root."+ver, root);
}

// adding index.html works because of the above
function GotoPLTRoot(ver, relative) {
var u = GetCookie("PLT_Root."+ver, null);
if (u == null) return true; // no cookie: use plain up link
// the relative path is optional, default goes to the toplevel start page
if (!relative) relative = "index.html";
location = u + relative;
return false;
}

normalize_rxs = [/\/\/+/g, /\/\.(\/|$)/, /\/[^\/]*\/\.\.(\/|$)/];
function NormalizePath(path) {
var tmp, i;
for (i = 0; i < normalize_rxs.length; i++)
while ((tmp = path.replace(normalize_rxs[i], "/")) != path) path = tmp;
return path;
}

function DoSearchKey(event, field, ver, top_path) {
var val = field.value;
if (event && event.keyCode == 13) {
var u = GetCookie("PLT_Root."+ver, null);
if (u == null) u = top_path; // default: go to the top path
location = u + "search/index.html" + "?q=" + escape(val);
return false;
}
return true;
}

function TocviewToggle(glyph,id) {
var s = document.getElementById(id).style;
var expand = s.display == "none";
s.display = expand ? "block" : "none";
glyph.innerHTML = expand ? "&#9660;" : "&#9658;";
}

// `noscript' is problematic in some browsers (always renders as a
// block), use this hack instead (does not always work!)
// document.write("<style>mynoscript { display:none; }</style>");
Loading

0 comments on commit 21f4482

Please sign in to comment.