From 170f7e9c2ee3c31a525da18c5ab9dacaefe5557b Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 17 May 2013 22:07:37 +0200 Subject: [PATCH] Add some docstrings --- eliss.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eliss.el b/eliss.el index 2338631..cdc039e 100644 --- a/eliss.el +++ b/eliss.el @@ -15,10 +15,15 @@ (defvar eliss-data-directory "~/projects/eliss/projects") (defun project-row (project) + "Print a table row for PROJECT." (let ((pname (substring project 0 -4))) `(tr (td (a (@ (href ,(concat "/" pname "/"))) ,pname))))) (defun eliss-page (title &rest body) + "Create a page with some default necessities. + +Set the page's title and brand to TITLE and add BODY in the +container div." (concat "" (sxml-to-xml @@ -34,6 +39,7 @@ ,@body)))))) (defun eliss-project-list (httpcon) + "Send a list of known projects over HTTPCON." (elnode-http-start httpcon 200 '("Content-Type" . "text/html")) (elnode-http-return httpcon @@ -45,6 +51,11 @@ "\\.org$")))))) (defun eliss-control-group (name label &optional placeholder default) + "Return an often-used common HTML structure. + +Set the name and id attributes of the input to NAME, give it the +label LABEL, optionally add a placeholder PLACEHOLDER and +optionally a value DEFAULT." `(div (@ (class "control-group")) (label (@ (class "control-label") (for ,name)) ,label) @@ -60,6 +71,7 @@ nil)))))) (defun eliss-project-page (httpcon) + "Send a list of issues and an issue-creation form over HTTPCON." (let* ((project (match-string 1 (elnode-http-mapping httpcon))) (filename (concat eliss-data-directory "/" project ".org")) (buffer (find-file-noselect filename))) @@ -109,6 +121,7 @@ (rows "15")) ""))))))))) (defun eliss-issue-page (httpcon) + "Send an issue-detail page over HTTPCON." (let* ((project (match-string 1 (elnode-http-mapping httpcon))) (issue (match-string 2 (elnode-http-mapping httpcon))) (filename (concat eliss-data-directory "/" project ".org")) @@ -174,6 +187,7 @@ (rows "15")) "")))))))))) (defun eliss-new-issue (httpcon) + "Parse data from HTTPCON and write a new issue using it." (elnode-method httpcon (POST (let* ((project (match-string 1 (elnode-http-mapping httpcon))) @@ -202,6 +216,7 @@ (elnode-send-redirect httpcon (concat "/" project "/")))))) (defun eliss-new-comment (httpcon) + "Parse data from HTTPCON and write a new issue comment using it." (elnode-method httpcon (POST (let* ((project (match-string 1 (elnode-http-mapping httpcon))) @@ -229,6 +244,7 @@ (elnode-send-redirect httpcon (concat "/" project "/" issue "/")))))) (defun eliss-handler (httpcon) + "Send the right requests in HTTPCON to the right functions." (elnode-dispatcher httpcon '(("^/$" . eliss-project-list)