branch: externals/hyperbole
commit c3ff71d9ce31a333470ab8d73fe13ab84ad8af66
Author: Mats Lidell <mats.lid...@lidells.se>
Commit: GitHub <nore...@github.com>

    Fix hywiki publishing (#667)
    
    Highlight wiki page names before looking for overlays to turn into
    org-links. Let org handle the sitemap file.
---
 ChangeLog |  8 ++++++++
 hywiki.el | 10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index aa5dee1109..5c0ed49ae6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-02-08  Mats Lidell  <ma...@gnu.org>
+
+* hywiki.el (hywiki--sitemap-file): Helper function for getting the sitemap
+    file-name.
+    (hywiki-org-export-function): Only use org publishing for the sitemap file.
+    (hywiki-convert-words-to-org-links): Highlight wiki page names so overlays
+    are defined before looking for them.
+
 2025-02-07  Mats Lidell  <ma...@gnu.org>
 
 * test/hywiki-tests.el (hywiki-tests--save-referent)
diff --git a/hywiki.el b/hywiki.el
index 094a05fedb..04190ac5fc 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Acpr-24 at 22:41:13
-;; Last-Mod:      6-Feb-25 at 23:35:41 by Mats Lidell
+;; Last-Mod:      8-Feb-25 at 22:56:32 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1409,6 +1409,7 @@ per file to the absolute value of MAX-MATCHES, if given 
and not 0.  If
 (defun hywiki-convert-words-to-org-links ()
   "Convert all highlighted HyWiki words in current buffer to Org links."
   (barf-if-buffer-read-only)
+  (hywiki-maybe-highlight-page-names)
   (let ((make-index (hywiki-org-get-publish-property :makeindex))
        wiki-word)
     (hywiki-map-words (lambda (overlay)
@@ -2482,11 +2483,18 @@ save and potentially set `hywiki--directory-mod-time' 
and
 (defun hywiki-non-page-elt (val-key)
   (unless (eq (caar val-key) 'page) val-key))
 
+(defun hywiki--sitemap-file ()
+  "Return file name for the sitemap file."
+  (expand-file-name
+   (org-publish-property :sitemap-filename (hywiki-org-get-publish-project))
+   (org-publish-property :base-directory (hywiki-org-get-publish-project))))
+
 (defun hywiki-org-export-function (&rest _)
   "Add to `write-contents-functions' to convert HyWikiWord links to Org links.
 This is done automatically by loading HyWiki."
   (require 'org-element)
   (when (and (derived-mode-p 'org-mode)
+             (not (string= (hywiki--sitemap-file) (buffer-file-name)))
             (hyperb:stack-frame '(org-export-copy-buffer)))
     (hywiki-convert-words-to-org-links)
     (hywiki-org-maybe-add-title)))

Reply via email to