emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/paredit 0c805ec 188/224: Rework HTML output to simplify an


From: ELPA Syncer
Subject: [nongnu] elpa/paredit 0c805ec 188/224: Rework HTML output to simplify and prettify everything.
Date: Sat, 7 Aug 2021 09:22:47 -0400 (EDT)

branch: elpa/paredit
commit 0c805ec381996f02c2be2ebf8a124cf70ca4a2ff
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>

    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 "<table><tr><td><pre>"
-                   (mapconcat 'paredit-html-quote
-                              example
-                              (concat "</pre></td></tr><tr><td>"
-                                      "&nbsp;&nbsp;&nbsp;&nbsp;---&gt;"
-                                      "</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>&rarr;</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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]