diff --git a/.gitignore b/.gitignore
index a7e297a..d1c41a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
srv/*
bin/web
.nfs*
+.htaccess
+src/config.d
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..bd0dab3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,53 @@
+dweb - A simple website written in D
+=====
+dweb is a simple website framework based off the [werc][werc] software.
+
+Its principles are:
+
+- Database free, uses files and directories instead.
+- Written using the D programming language.
+- Minimize tedious work: eg., no need to ever write HTML, use markdown instead.
+- Very minimalist yet extensible codebase. Handlers for special things should be easy to add.
+
+It was created because werc was annoying to deploy on UW Computer Science Club's Apache setup and because [Not Invented Here](http://en.wikipedia.org/wiki/Not_Invented_Here).
+
+[werc]:http://werc.cat-v.org/
+[md]:http://daringfireball.net/projects/markdown
+
+Install Guide
+------
+You will need:
+- An HTTP server with CGI support.
+- The D compiler.
+
+Extract the contents into the location you want to serve webpages from. Create $DWEB\_ROOT/.htaccess
and $DWEB\_ROOT/src/config.d
by copying the provided sample files. Then edit the following files:
+
+- $DWEB_ROOT/.htaccess
: make the paths work for your setup.
+- $DWEB_ROOT/src/config.d
: change these strings as necessary.
+- $DWEB_ROOT/src/web.d
: this is the main web code.
+- $DWEB_ROOT/pub/
: static content goes here.
+- $DWEB_ROOT/srv/
: directories, markdown webpages etc. go in here.
+- $DWEB_ROOT/bin/
: custom handlers go here.
+
+Run build
in $DWEB_ROOT/src
to recompile the website software.
+
+Source
+--------
+
+You can get the source code on [github](https://github.com/j3parker/dweb) or by running
+
+ git clone git://github.com/j3parker/dweb.git
+
+Contact
+--------
+For questions, suggestions, bug reports and contributing patches email [j3parker](mailto:j3parker@csclub.uwaterloo.ca)
+
+License
+-------
+Public domain.
+
+Credits
+-------
+The idea and css stolen from [werc][werc]. This page itself also plagarised.
+
+Thanks to John Gruber for the [Markdown.pl][md] script.
diff --git a/htaccess-sample b/htaccess-sample
new file mode 100644
index 0000000..23c9137
--- /dev/null
+++ b/htaccess-sample
@@ -0,0 +1,4 @@
+RewriteEngine on
+RewriteBase /
+RewriteRule ^pub/(.*) - [L]
+RewriteRule ^(.*) bin/web [L]
diff --git a/src/build b/src/build
index 0f837d1..ea85a52 100755
--- a/src/build
+++ b/src/build
@@ -1 +1,2 @@
+cd "$(dirname $0)"
dmd config.d web.d -ofweb && rm web.o && mv web ../bin/
diff --git a/src/config.d b/src/config.d
deleted file mode 100644
index 348caa1..0000000
--- a/src/config.d
+++ /dev/null
@@ -1,18 +0,0 @@
-const string url_root = "/~j3parker/pub/csc/";
-
-const string site_title = "CSC";
-const string site_subtitle = "UW Computer Science Club";
-
-const bool nav_tree_vert = false;
-const bool nav_tree_chev = false;
-const bool page_container = true;
-
-string[string] handlers;
-
-void init_handlers() {
- handlers["*.md"] = "contrib/Markdown.pl";
- handlers["changelog"] = "changelog.sh";
- handlers["About/Members/"] = "members.py";
- handlers["About/Members/?*"] = "member_info.py";
- handlers["About/Executive/"] = "exec_positions.py";
-}
diff --git a/src/web.d b/src/web.d
index 288c662..efc7040 100755
--- a/src/web.d
+++ b/src/web.d
@@ -108,7 +108,7 @@ void do_content(string url) {
}
}
// if that failed, see if we can handle the file
- if (url == "" ? false : url[$-1] == '/') url ~= "index";
+ if (url == "" ? true : url[$-1] == '/') url ~= "index";
foreach (f; array(map!"a.name"(dirEntries(dirName(dweb_root ~ "/srv/" ~ url), SpanMode.shallow)))) {
if (isDir(f)) continue;
string name = baseName(f); name = name[0] == '@' ? name[1..$] : name;
@@ -153,7 +153,7 @@ void main(string[] args) {
html("");
html_push("\n");
- string url = getenv("SCRIPT_URL")[url_root.length..$];
+ string url = getenv("REQUEST_URI")[url_root.length..$];
if (evil(url)) { html ("bad url."); return; }
string pagename = baseName(url);
diff --git a/srv/@dweb.md b/srv/@dweb.md
index 5a392e4..eb2722a 100644
--- a/srv/@dweb.md
+++ b/srv/@dweb.md
@@ -1,6 +1,6 @@
dweb - A simple website written in D
=====
-dweb is a simple website framework based off the [werc][werc] software.
+dweb is a simple website framework inspired by the [werc][werc] software.
Its principles are:
@@ -22,14 +22,14 @@ You will need:
Extract the contents into the location you want to serve webpages from. Edit the following files:
-- $DWEB_ROOT/.htaccess
: make the paths work for your setup.
-- $DWEB_ROOT/src/config.d
: change these strings as necessary.
-- $DWEB_ROOT/src/web.d
: this is the main web code.
-- $DWEB_ROOT/pub/
: static content goes here.
-- $DWEB_ROOT/srv/
: directories, markdown webpages etc. go in here.
-- $DWEB_ROOT/bin/
: custom handlers go here.
+- `$DWEB_ROOT/.htaccess`: make the rewrite path work for your setup.
+- `$DWEB_ROOT/src/config.d`: change these things as desired. Custom handlers are added in init_handlers. The key is the glob to activate the handler, and the value is the `bin/` relative path of the handler.
+- `$DWEB_ROOT/src/web.d`: this is the core code.
+- `$DWEB_ROOT/pub/`: static content goes here.
+- `$DWEB_ROOT/srv/`: directories, markdown webpages etc. go in here.
+- `$DWEB_ROOT/bin/`: custom handlers go here.
-Run build
in $DWEB_ROOT/src
to recompile the website software.
+Run `./build` in `$DWEB_ROOT/src` to recompile the website software.
Source
--------