From fcf126f8aab283078111f8dac0b589e51f30f0ce Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 20 Jul 2023 21:26:38 +1000 Subject: Adding functions to get html url --- wiki-markup.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'wiki-markup.el') diff --git a/wiki-markup.el b/wiki-markup.el index f29ac52..f0f26cb 100644 --- a/wiki-markup.el +++ b/wiki-markup.el @@ -74,7 +74,9 @@ (defvar wiki-outline-re "=+.*=+\ *$") (defvar-local wiki-site nil - "The identifier of the wiki site") + "The identifier of the site of the current wiki buffer.") +(defvar-local wiki-title nil + "The title of the current wiki buffer.") (defun wiki-follow-wikilink-action (data) "Button action to follow a wikilink" (funcall (wiki-site-fetcher wiki-site) (alist-get 'target data))) @@ -93,6 +95,11 @@ This can be overriden with .dir-locals.el." 'local)))) ) +(defun wiki-guess-title () + "Guess `wiki-title' from the file name." + (unless wiki-title + (setq-local wiki-title (file-name-base (buffer-file-name))))) + (defun wiki-outline-level () (when (looking-at "\\(=+\\).*[^=]\\(=+\\)\\ *$") (min (length (match-string 1)) @@ -261,6 +268,7 @@ This can be overriden with .dir-locals.el." (setq-local wiki-site (intern wiki-site))) (add-hook 'wiki-mode-hook 'wiki-guess-site) +(add-hook 'wiki-mode-hook 'wiki-guess-title) (provide 'wiki-markup) ;;; wiki-markup.el ends here -- cgit v1.2.3