= Elwiki =

{{/static/elnode-wiki-logo.png}}

This is an example page showing off Elwiki.  It is based on the {{{creole}}} wiki language and is written completely in Emacs Lisp.

== What does it do? ==

It does syntax coloring:

{{{
##! emacs-lisp
;; This is old code.
(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))))
    (POST
     (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
[[http://github.com/nicferrier/elwikicreole|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:

{{{
##! emacs-lisp
<<(
 (mapconcat
   (lambda (s)
     (format "* %s" s))
   '("which" "eval" "lisp" "and" "render" "the" "results")
   "\n")
)>>
}}}

<<(
 (mapconcat
   (lambda (s)
     (format "* %s" s))
   '("which" "eval" "lisp" "and" "render" "the" "results")
   "\n")
)>>

There is more to do with the Elnode Wiki server because there is so much that Emacs can do.

----

This example creole file is part of Elwiki, © Nic Ferrier and Aidan Gauland, and is available under the AGPLv3+ (see the file {{{COPYING.txt}}} included with this package for details).
