From 0c805ec381996f02c2be2ebf8a124cf70ca4a2ff Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Tue, 9 Jul 2013 14:49:32 +0000 Subject: Rework HTML output to simplify and prettify everything. --- paredit.el | 62 ++++++++++++++++++++------------------------------------------ 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/paredit.el b/paredit.el index 0f7a990..57d7dd8 100644 --- a/paredit.el +++ b/paredit.el @@ -534,50 +534,28 @@ Paredit behaves badly if parentheses are unbalanced, so exercise "Insert HTML for a paredit quick reference table." (interactive) (let ((insert-lines - (lambda (&rest lines) - (mapc (lambda (line) (insert line) (newline)) - lines))) - (html-keys - (lambda (keys) - (mapconcat 'paredit-html-quote keys ", "))) - (html-example - (lambda (example) - (concat "
"
-                   (mapconcat 'paredit-html-quote
-                              example
-                              (concat "
" - "    --->" - "
"))
-                   "
"))) - (firstp t)) + (lambda (&rest lines) (dolist (line lines) (insert line) (newline))))) (paredit-do-commands (spec keys fn examples) - (progn (if (not firstp) - (insert "\n") - (setq firstp nil)) - (funcall insert-lines - (concat "

" spec "

") - "" - " " - " " - " " - " " - " ")) + (funcall insert-lines (concat "

" spec "

")) (let ((name (symbol-name fn))) - (if (string-match (symbol-name 'paredit-) name) - (funcall insert-lines - " " - (concat " ") - (concat " ") - (concat " ") - " "))))) - (insert "
CommandKeysExamples
" name "" - (funcall html-keys keys) - "" - (if examples - (mapconcat html-example examples - "
") - "(no examples)") - "
\n")) + (funcall insert-lines (concat "

" name "

")) + (funcall insert-lines + "

Keys: " + (mapconcat (lambda (key) + (concat "" (paredit-html-quote key) "")) + keys + ", ") + "

") + (funcall insert-lines "") + (dolist (example examples) + (let ((prefix "")) + (funcall insert-lines (concat prefix examples suffix)))) + (funcall insert-lines "
")
+                (examples
+                 (mapconcat 'paredit-html-quote
+                            example
+                            (concat "
")))
+                (suffix "
"))))) (defun paredit-html-quote (string) (with-temp-buffer -- cgit v1.2.1