Add some docstrings
This commit is contained in:
parent
03f74924f1
commit
170f7e9c2e
1 changed files with 16 additions and 0 deletions
16
eliss.el
16
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
|
||||
"<!DOCTYPE html>"
|
||||
(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)
|
||||
|
|
Loading…
Reference in a new issue