Browse files

improved default pages and config

  • Loading branch information...
1 parent 0328d54 commit bca3da1cda39dbea5e7832cee5080cdbf401a8c1 @nicferrier nicferrier committed Aug 7, 2012
Showing with 130 additions and 3 deletions.
  1. BIN default-webserver-image.png
  2. +7 −2 default-webserver-test.html
  3. +106 −0 default-wiki-index.creole
  4. +17 −1 elnode.el
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -3,13 +3,18 @@
<h1>This is Elnode's Test HTML file</h1>
<p>If you are reading this then most likely Elnode is working ok.</p>
-<p>This file is normally stored in the package directory which can be found in</p>
+<p>This file is normally stored in the user's directory. It can
+normally be found in:</p>
<p>To learn more about Elnode visit <a href="">the website</a>.</p>
+<p>Just to show that Elnode will serve anything, here's a png:</p>
+<img src="emacs.png"/>
@@ -3,3 +3,109 @@
This is Elnode's Wiki. It is based on the {{{creole}}} wiki language
and is written completely in EmacsLisp.
+== What does it do? ==
+It does syntax coloring:
+##! emacs-lisp
+(defun elnode-wiki-handler (httpcon wikiroot)
+ "A low level handler for Wiki operations.
+Send the Wiki page requested, which must be a file existing under
+the WIKIROOT, back to the HTTPCON.
+Update operations are protected by authentication."
+ (elnode-method httpcon
+ (GET
+ (elnode-docroot-for wikiroot
+ with target-path
+ on httpcon
+ do
+ (if (equal target-path (expand-file-name (concat wikiroot "/")))
+ (elnode-wiki-page httpcon (concat wikiroot "/index.creole"))
+ (elnode-wiki-page httpcon target-path))))
+ (elnode-with-auth httpcon 'elnode-wiki-auth
+ (let* ((path (elnode-http-pathinfo httpcon))
+ (text (elnode-wiki--text-param httpcon)))
+ (if (not (elnode-http-param httpcon "preview"))
+ ;; A save request in which case save the new text and then
+ ;; send the wiki text.
+ (elnode-wiki--save-request httpcon wikiroot path text)
+ ;; Might be a preview request in which case send back the WIKI
+ ;; text that's been sent.
+ (with-temp-file "/tmp/preview"
+ (insert text))
+ (elnode-wiki-send httpcon "/tmp/preview" path)))))))
+It does links, for example to
+[[|Emacs Creole]] which is
+the Wiki render engine used to display pages.
+It does all the normal Wiki things like headings and lists.
+You can also do some special Emacs things, like org-mode tables:
+| Date | Amount | Description |
+| 2011-11-15 | 100.15 | Expensive lunch out |
+| 2011-11-18 | 7.30 | Dry cleaning |
+| 2011-11-21 | 22.50 | Takeaway curry |
+| | 129.95 | |
+#+TBLFM: @5$2=vsum(@I..@II)
+and lisp callouts:
+ (mapconcat
+ (lambda (s)
+ (format "* %s" s))
+ '("which" "eval" "lisp" "and" "render" "the" "results")
+ "\n")
+== Authentication ==
+By default, the Wiki uses an authentication database in the Emacs
+instance running Elnode and the Wiki server.
+If you want to add a user to the Wiki so you can edit pages you can do this in Emacs:
+M-x elnode-auth-user-add
+and it will ask you for a username and a password. The user will be
+stored in a persistent database.
+== Where the Wiki pages are ==
+By default the Elnode Wiki stores files in your {{{~/.emacs.d}}}
+directory which is actually defined by the variable
+{{{user-emacs-directory}}} in Emacs.
+There is normally a directory {{{elnode}}} in that directory which
+contains directories for the Web server document root and the Wiki.
+The location of the Wiki files can be configured though, try:
+M-x customize-variable [RET] elnode-wikiserver-wikiroot
+== More customization ==
+There are many other things in Elnode's Wiki that can be customized,
+including the header and footer. Use:
+M-x customize-group [RET] elnode-wikiserver [RET]
+There is more to do with the Elnode Wiki server because there is so
+much that Emacs can do.
@@ -76,6 +76,18 @@ This is an alist of proc->server-process:
(port . process)")
+(defconst elnode-config-directory
+ (expand-file-name (concat user-emacs-directory "elnode/"))
+ "The config directory for elnode to store peripheral files.
+This is used as a base for other constant directory or file
+names (the elnode auth database is a file in this directory, the
+elnode webserver has a docroot directory in this directory).
+It is based on the `user-emacs-directory' which always seems to
+be set, even when emacs is started with -Q.")
;; Error log handling
@@ -2333,7 +2345,11 @@ off the standard webserver indexing in elnode's webserver."
(elnode--dir-setup elnode-webserver-docroot
- "test.html"))
+ "test.html")
+ (elnode--dir-setup elnode-webserver-docroot
+ elnode-webserver-docroot-default
+ "default-webserver-image.png"
+ "emacs.png"))
(defun elnode-url-encode-path (path)
"Return a url encoded version of PATH.

0 comments on commit bca3da1

Please sign in to comment.