branch: externals/hyperbole
commit 45caa062ce6723beb4acdfaf7084317c1077d4f9
Merge: a9ccfa94b6 45759cfe89
Author: Robert Weiner <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #805 from rswgnu/rsw
    
    - hpath:call - Handle #anchor refs and file:// urls
    
    - hywiki-publish-to-html - Rewrite to use standard Org html ids
---
 ChangeLog |  9 +++++++++
 hpath.el  | 16 +++++++++++++---
 hywiki.el |  7 ++++---
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0d1d26828f..ea77db3367 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-10-26  Bob Weiner  <[email protected]>
+
+* hywiki.el (hywiki-publish-to-html): Rewrite to use standard Org html ids, not
+    HyWiki-specific ones.
+
+* hpath.el (hpath:call): Fix conditional at end to handle empty string for 
'expanded-path'.
+    This fixes handling of "#anchor" only references.
+           (hpath:find): Handle encoded file:// URLs.
+
 2025-10-18  Bob Weiner  <[email protected]>
 
 * hypb.el (hypb:in-string-modes-regexps): Change to support Python delimiters 
in
diff --git a/hpath.el b/hpath.el
index faaa8ae997..b6b1473b7f 100644
--- a/hpath.el
+++ b/hpath.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-Nov-91 at 00:44:23
-;; Last-Mod:     12-Oct-25 at 12:22:05 by Bob Weiner
+;; Last-Mod:     26-Oct-25 at 13:15:29 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1100,7 +1100,9 @@ Make any existing path within a file buffer absolute 
before returning."
                           (string-match-p "\\`([^\):]+)" expanded-path)))) ;; 
Info node
          (when (or non-exist (file-exists-p expanded-path)
                    (string-match-p ".+\\.info\\([.#]\\|\\'\\)" expanded-path))
-           (concat prefix mode-prefix expanded-path suffix)))))))
+           (if (string-empty-p expanded-path)
+               (concat prefix expanded-path suffix)
+             (concat prefix mode-prefix expanded-path suffix))))))))
 
 (defun hpath:is-path-variable-p (path-var)
   "Return a colon or semicolon-delimited set in PATH-VAR or nil if not a 
match."
@@ -1503,9 +1505,13 @@ but locational suffixes within the file are utilized."
                                (if (stringp loc)
                                    (file-name-directory loc)
                                  default-directory)))
+    ;; Parse Hyperbole action prefix char
     (when (string-match hpath:prefix-regexp pathname)
       (setq modifier (aref pathname 0)
            pathname (substring pathname (match-end 0))))
+    ;; Remove http file:// url prefix and decode the url
+    (when (string-match "\\`file://" pathname)
+      (setq pathname (hypb:decode-url (substring pathname (match-end 0)))))
     (setq path pathname) ;; default
     (cond ((string-match hpath:instance-line-column-regexp path)
           (setq instance-num (string-to-number (match-string 1 path))
@@ -1539,7 +1545,11 @@ but locational suffixes within the file are utilized."
       (if modifier
          (setq path (hpath:resolve path))
        (setq path (hpath:expand path)
-             pathname (hpath:absolute-to path default-directory))))
+             pathname (hpath:absolute-to path default-directory))
+       ;; Remove http file:// url prefix that`hpath:absolute-to' may have
+       ;; added and decode the url
+       (when (string-match "\\`file://" pathname)
+         (setq pathname (hypb:decode-url (substring pathname (match-end 
0)))))))
     (let ((remote-pathname (hpath:remote-p path)))
       (or modifier remote-pathname
          (file-exists-p pathname)
diff --git a/hywiki.el b/hywiki.el
index ca60c71916..06030fc0cf 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Apr-24 at 22:41:13
-;; Last-Mod:     18-Oct-25 at 11:56:19 by Bob Weiner
+;; Last-Mod:     26-Oct-25 at 11:48:45 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -2985,9 +2985,10 @@ Customize this directory with:
   ;; spaces replaced with dashes, made unique when necessary.
   (unwind-protect
       (progn
-       (advice-add #'org-export-get-reference :override 
#'hywiki--org-export-get-reference)
+       ;; (advice-add #'org-export-get-reference :override 
#'hywiki--org-export-get-reference)
        (org-publish-project "hywiki" all-pages-flag))
-    (advice-remove #'org-export-get-reference 
#'hywiki--org-export-get-reference)))
+    ;; (advice-remove #'org-export-get-reference 
#'hywiki--org-export-get-reference)
+    nil))
 
 (defun hywiki-referent-exists-p (&optional word start end)
   "Return the HyWikiWord at point or optional HyWiki WORD, if has a referent.

Reply via email to