summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2013-07-09 14:59:11 +0000
committerTaylor R Campbell <campbell@mumble.net>2013-07-09 14:59:11 +0000
commit66d637451e2fa063b5c5e8f26f5df020f1bceb76 (patch)
treefe97c78f0eceae8a7e523cb5f729ea0db6f0283b
parent0c805ec381996f02c2be2ebf8a124cf70ca4a2ff (diff)
Tweak HTML output a little more.
-rw-r--r--paredit.el32
1 files changed, 20 insertions, 12 deletions
diff --git a/paredit.el b/paredit.el
index 57d7dd8..2083066 100644
--- a/paredit.el
+++ b/paredit.el
@@ -534,19 +534,26 @@ Paredit behaves badly if parentheses are unbalanced, so exercise
"Insert HTML for a paredit quick reference table."
(interactive)
(let ((insert-lines
- (lambda (&rest lines) (dolist (line lines) (insert line) (newline)))))
+ (lambda (&rest lines) (dolist (line lines) (insert line) (newline))))
+ (initp nil))
(paredit-do-commands (spec keys fn examples)
- (funcall insert-lines (concat "<h3>" spec "</h3>"))
- (let ((name (symbol-name fn)))
- (funcall insert-lines (concat "<h4>" name "</h4>"))
+ (progn (if initp
+ (funcall insert-lines "</table>")
+ (setq initp t))
+ (funcall insert-lines (concat "<h3>" spec "</h3>"))
+ (funcall insert-lines "<table>"))
+ (let ((name (symbol-name fn))
+ (keys
+ (mapconcat (lambda (key)
+ (concat "<tt>" (paredit-html-quote key) "</tt>"))
+ keys
+ ", ")))
+ (funcall insert-lines "<tr>")
+ (funcall insert-lines (concat " <th>" name "</th>"))
+ (funcall insert-lines (concat " <th>" keys "</th>"))
+ (funcall insert-lines "</tr>")
(funcall insert-lines
- "<p>Keys: "
- (mapconcat (lambda (key)
- (concat "<tt>" (paredit-html-quote key) "</tt>"))
- keys
- ", ")
- "</p>")
- (funcall insert-lines "<table cellpadding=\"10\">")
+ "<tr><td colspan=\"2\"><table cellpadding=\"10\">")
(dolist (example examples)
(let ((prefix "<tr><td><pre>")
(examples
@@ -555,7 +562,8 @@ Paredit behaves badly if parentheses are unbalanced, so exercise
(concat "</pre></td><td>&rarr;</td><td><pre>")))
(suffix "</pre></td></tr>"))
(funcall insert-lines (concat prefix examples suffix))))
- (funcall insert-lines "</table>")))))
+ (funcall insert-lines "</table></td></tr>")))
+ (funcall insert-lines "</table>")))
(defun paredit-html-quote (string)
(with-temp-buffer