diff options
author | Taylor R Campbell <campbell@mumble.net> | 2013-07-09 14:49:32 +0000 |
---|---|---|
committer | Taylor R Campbell <campbell@mumble.net> | 2013-07-09 14:49:32 +0000 |
commit | 0c805ec381996f02c2be2ebf8a124cf70ca4a2ff (patch) | |
tree | d135c41d26ce4408d49aa380176ba6a5c0fcdebe | |
parent | e775e4346c2e0304733b017025fb292b786b3286 (diff) |
Rework HTML output to simplify and prettify everything.
-rw-r--r-- | paredit.el | 62 |
1 files changed, 20 insertions, 42 deletions
@@ -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 "<table><tr><td><pre>" - (mapconcat 'paredit-html-quote - example - (concat "</pre></td></tr><tr><td>" - " --->" - "</td></tr><tr><td><pre>")) - "</pre></td></tr></table>"))) - (firstp t)) + (lambda (&rest lines) (dolist (line lines) (insert line) (newline))))) (paredit-do-commands (spec keys fn examples) - (progn (if (not firstp) - (insert "</table>\n") - (setq firstp nil)) - (funcall insert-lines - (concat "<h3>" spec "</h3>") - "<table border=\"1\" cellpadding=\"1\">" - " <tr>" - " <th>Command</th>" - " <th>Keys</th>" - " <th>Examples</th>" - " </tr>")) + (funcall insert-lines (concat "<h3>" spec "</h3>")) (let ((name (symbol-name fn))) - (if (string-match (symbol-name 'paredit-) name) - (funcall insert-lines - " <tr>" - (concat " <td><tt>" name "</tt></td>") - (concat " <td align=\"center\">" - (funcall html-keys keys) - "</td>") - (concat " <td>" - (if examples - (mapconcat html-example examples - "<hr>") - "(no examples)") - "</td>") - " </tr>"))))) - (insert "</table>\n")) + (funcall insert-lines (concat "<h4>" name "</h4>")) + (funcall insert-lines + "<p>Keys: " + (mapconcat (lambda (key) + (concat "<tt>" (paredit-html-quote key) "</tt>")) + keys + ", ") + "</p>") + (funcall insert-lines "<table cellpadding=\"10\">") + (dolist (example examples) + (let ((prefix "<tr><td><pre>") + (examples + (mapconcat 'paredit-html-quote + example + (concat "</pre></td><td>→</td><td><pre>"))) + (suffix "</pre></td></tr>")) + (funcall insert-lines (concat prefix examples suffix)))) + (funcall insert-lines "</table>"))))) (defun paredit-html-quote (string) (with-temp-buffer |