Skip to content

Commit d96dcbe

Browse files
committed
Use delimiters for links with space in HyWiki
1 parent 82f7e0d commit d96dcbe

File tree

4 files changed

+26
-22
lines changed

4 files changed

+26
-22
lines changed

ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2026-01-05 Mats Lidell <matsl@gnu.org>
2+
3+
* test/hywiki-tests.el
4+
(hywiki-tests--action-key-moves-to-word-and-section): Adopt to changed
5+
linked behavior.
6+
7+
* hywiki.el (hywiki-section-to-headline-reference): Remove unused.
8+
9+
* hpath.el (hpath:dashes-to-spaces-markup-anchor): Do not convert in
10+
hywiki pages.
11+
112
2025-12-31 Mats Lidell <matsl@gnu.org>
213

314
* Remove starting asterix from defcustom variable docstrings.

hpath.el

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
;; Author: Bob Weiner
44
;;
55
;; Orig-Date: 1-Nov-91 at 00:44:23
6-
;; Last-Mod: 31-Dec-25 at 16:08:46 by Mats Lidell
6+
;; Last-Mod: 5-Jan-26 at 22:36:32 by Mats Lidell
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
10-
;; Copyright (C) 1991-2025 Free Software Foundation, Inc.
10+
;; Copyright (C) 1991-2026 Free Software Foundation, Inc.
1111
;; See the "HY-COPY" file for license information.
1212
;;
1313
;; This file is part of GNU Hyperbole.
@@ -148,6 +148,8 @@ The format is ${variable}. Match grouping 1 is the name of the variable.")
148148
(declare-function klink:act "klink")
149149
(declare-function mm-mailcap-command "mm-decode")
150150

151+
(declare-function hywiki-in-page-p "hywiki")
152+
151153
;;; ************************************************************************
152154
;;; MS WINDOWS PATH CONVERSIONS
153155
;;; ************************************************************************
@@ -1654,7 +1656,8 @@ but locational suffixes within the file are utilized."
16541656
(defun hpath:dashes-to-spaces-markup-anchor (anchor)
16551657
"Replace dashes with spaces in ANCHOR if not a prog mode and no existing spaces."
16561658
(if (or (derived-mode-p 'prog-mode)
1657-
(string-match-p "-.* \\| .*-" anchor))
1659+
(string-match-p "-.* \\| .*-" anchor)
1660+
(hywiki-in-page-p))
16581661
anchor
16591662
;; In Markdown or outline modes '-' characters in `anchor' are
16601663
;; converted to spaces at the point of definition unless anchor

hywiki.el

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
;; Author: Bob Weiner
44
;;
55
;; Orig-Date: 21-Apr-24 at 22:41:13
6-
;; Last-Mod: 30-Nov-25 at 18:06:52 by Bob Weiner
6+
;; Last-Mod: 5-Jan-26 at 20:09:54 by Mats Lidell
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
10-
;; Copyright (C) 2024-2025 Free Software Foundation, Inc.
10+
;; Copyright (C) 2024-2026 Free Software Foundation, Inc.
1111
;; See the "HY-COPY" file for license information.
1212
;;
1313
;; This file is part of GNU Hyperbole.
@@ -2997,7 +2997,6 @@ variables."
29972997
:complete #'hywiki-org-link-complete
29982998
:export #'hywiki-org-link-export
29992999
:follow #'hywiki-find-referent
3000-
:htmlize-link #'hywiki-section-to-headline-reference
30013000
:store #'hywiki-org-link-store)
30023001
(org-link-set-parameters "hypb-msg"
30033002
:follow (lambda (path) (message "Message: %s" path))
@@ -3065,17 +3064,6 @@ at point must return non-nil or this function will return nil."
30653064
(list word start end)
30663065
word)))
30673066

3068-
(defun hywiki-section-to-headline-reference ()
3069-
"Replace file#section dashes with spaces to match to an Org headline.
3070-
Does replacement only when not in a programming mode and section
3071-
contains no spaces."
3072-
(let ((link (get-text-property (point) 'org-link)))
3073-
(if (and link (string-match "#" link))
3074-
(let* ((file (substring link 0 (match-beginning 0)))
3075-
(section (substring link (match-beginning 0))))
3076-
(concat file (hpath:dashes-to-spaces-markup-anchor section)))
3077-
link)))
3078-
30793067
(defun hywiki-strip-org-link (link-str)
30803068
"Return the hy:HyWikiWord#section part of an Org link string.
30813069
Strip any square bracket delimiters, description and leading or

test/hywiki-tests.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
;; Author: Mats Lidell
44
;;
55
;; Orig-Date: 18-May-24 at 23:59:48
6-
;; Last-Mod: 22-Nov-25 at 13:35:42 by Bob Weiner
6+
;; Last-Mod: 5-Jan-26 at 21:38:04 by Mats Lidell
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
10-
;; Copyright (C) 2024-2025 Free Software Foundation, Inc.
10+
;; Copyright (C) 2024-2026 Free Software Foundation, Inc.
1111
;; See the "HY-COPY" file for license information.
1212
;;
1313
;; This file is part of GNU Hyperbole.
@@ -964,10 +964,10 @@ Both mod-time and checksum must be changed for a test to return true."
964964
("WikiWord#Asection:L1" . "* Asection")
965965
("WikiWord#Asection:L2" . "body A")
966966
("WikiWord#Asection:L2:C2" . "dy A")
967-
("WikiWord#Bsection-subsection" . "** Bsection subsection")
967+
("WikiWord#Bsection-subsection" . "** Bsection-subsection")
968968
("WikiWord#Bsection-subsection:L2" . "body B")
969969
("WikiWord#Bsection-subsection:L2:C2" . "dy B")
970-
("(WikiWord#Bsection subsection)" . "** Bsection subsection")
970+
("(WikiWord#Csection subsection)" . "*** Csection subsection")
971971
("(WikiWord#Asection)" . "* Asection")
972972
)))
973973
(unwind-protect
@@ -978,8 +978,10 @@ Both mod-time and checksum must be changed for a test to return true."
978978
First line
979979
* Asection
980980
body A
981-
** Bsection subsection
981+
** Bsection-subsection
982982
body B
983+
*** Csection subsection
984+
body C
983985
")
984986
(save-buffer))
985987
;; Create temp buffers with WikiWord links to the target

0 commit comments

Comments
 (0)