emacs-diffs
[Top][All Lists]
Advanced

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

master 30b4d902326: In Info-url-alist, add .html extension to %e format-


From: Eli Zaretskii
Subject: master 30b4d902326: In Info-url-alist, add .html extension to %e format-sequence
Date: Sun, 11 Feb 2024 02:26:08 -0500 (EST)

branch: master
commit 30b4d902326546ca2b383d56caadbe0adaf0fe89
Author: Mekeor Melire <mekeor@posteo.de>
Commit: Eli Zaretskii <eliz@gnu.org>

    In Info-url-alist, add .html extension to %e format-sequence
    
    * lisp/info.el (Info-url-for-node): Implement the change. (Bug#68970)
    (Info-url-alist): Document the change.
    * test/lisp/info-tests.el (test-info-urls): Adjust tests to account for
    the change and add a test for the "Top" node.
---
 lisp/info.el            | 31 +++++++++++++++++--------------
 test/lisp/info-tests.el | 16 +++++++++-------
 2 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/lisp/info.el b/lisp/info.el
index d4d9085a787..176bc9c0033 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -231,8 +231,9 @@ Each element of this list has the form (MANUALs . URL-SPEC).
 MANUALs represents the name of one or more manuals.  It can
 either be a string or a list of strings.  URL-SPEC can be a
 string in which the substring \"%m\" will be expanded to the
-manual-name, \"%n\" to the node-name, and \"%e\" to the
-URL-encoded node-name (without a `.html' suffix).  (The
+manual-name and \"%n\" to the node-name.  \"%e\" will expand to
+the URL-encoded node-name, including the `.html' extension; in
+case of the Top node, it will expand to the empty string.  (The
 URL-encoding of the node-name mimics GNU Texinfo, as documented
 at Info node `(texinfo)HTML Xref Node Name Expansion'.)
 Alternatively, URL-SPEC can be a function which is given
@@ -1928,18 +1929,20 @@ NODE should be a string of the form \"(manual)Node\"."
                ;; (info "(texinfo) HTML Xref Node Name Expansion")
                (if (equal node "Top")
                  ""
-                 (url-hexify-string
-                   (string-replace " " "-"
-                     (mapconcat
-                       (lambda (ch)
-                         (if (or (< ch 32)      ; ^@^A-^Z^[^\^]^^^-
-                               (<= 33 ch 47)    ; !"#$%&'()*+,-./
-                               (<= 58 ch 64)    ; :;<=>?@
-                               (<= 91 ch 96)    ; [\]_`
-                               (<= 123 ch 127)) ; {|}~ DEL
-                           (format "_00%x" ch)
-                           (char-to-string ch)))
-                       node ""))))))
+                 (concat
+                   (url-hexify-string
+                     (string-replace " " "-"
+                       (mapconcat
+                         (lambda (ch)
+                           (if (or (< ch 32)      ; ^@^A-^Z^[^\^]^^^-
+                                 (<= 33 ch 47)    ; !"#$%&'()*+,-./
+                                 (<= 58 ch 64)    ; :;<=>?@
+                                 (<= 91 ch 96)    ; [\]_`
+                                 (<= 123 ch 127)) ; {|}~ DEL
+                             (format "_00%x" ch)
+                             (char-to-string ch)))
+                         node "")))
+                   ".html"))))
     (cond
       ((stringp url-spec)
         (format-spec url-spec
diff --git a/test/lisp/info-tests.el b/test/lisp/info-tests.el
index 0dfdbf417e8..8020a7419cf 100644
--- a/test/lisp/info-tests.el
+++ b/test/lisp/info-tests.el
@@ -28,18 +28,20 @@
 (require 'ert-x)
 
 (ert-deftest test-info-urls ()
+  (should (equal (Info-url-for-node "(tramp)Top")
+                 "https://www.gnu.org/software/emacs/manual/html_node/tramp/";))
   (should (equal (Info-url-for-node "(emacs)Minibuffer")
-                 
"https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer";))
+                 
"https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer.html";))
   (should (equal (Info-url-for-node "(emacs)Minibuffer File")
-                 
"https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer-File";))
+                 
"https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer-File.html";))
   (should (equal (Info-url-for-node "(elisp)Backups and Auto-Saving")
-                 
"https://www.gnu.org/software/emacs/manual/html_node/elisp/Backups-and-Auto_002dSaving";))
+                 
"https://www.gnu.org/software/emacs/manual/html_node/elisp/Backups-and-Auto_002dSaving.html";))
   (should (equal (Info-url-for-node "(eintr)car & cdr")
-                 
"https://www.gnu.org/software/emacs/manual/html_node/eintr/car-_0026-cdr";))
+                 
"https://www.gnu.org/software/emacs/manual/html_node/eintr/car-_0026-cdr.html";))
   (should (equal (Info-url-for-node "(emacs-mime)\tIndex")
-                 
"https://www.gnu.org/software/emacs/manual/html_node/emacs-mime/Index";))
-  (should (equal (Info-url-for-node  "(gnus) Don't Panic")
-                 
"https://www.gnu.org/software/emacs/manual/html_node/gnus/Don_0027t-Panic";))
+                 
"https://www.gnu.org/software/emacs/manual/html_node/emacs-mime/Index.html";))
+  (should (equal (Info-url-for-node "(gnus) Don't Panic")
+                 
"https://www.gnu.org/software/emacs/manual/html_node/gnus/Don_0027t-Panic.html";))
   (should-error (Info-url-for-node "(nonexistent)Example")))
 
 ;;; info-tests.el ends here



reply via email to

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