diff options
author | Yuchen Pei <id@ypei.org> | 2023-07-20 21:26:38 +1000 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2023-07-20 21:26:38 +1000 |
commit | fcf126f8aab283078111f8dac0b589e51f30f0ce (patch) | |
tree | 47aebf5c531ad8d57b0925d369a8a7048dac46d9 /wiki-markup.el | |
parent | d94ab3b180c974682b90bd6587547b87d2da301d (diff) |
Adding functions to get html url
Diffstat (limited to 'wiki-markup.el')
-rw-r--r-- | wiki-markup.el | 10 |
1 files changed, 9 insertions, 1 deletions
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 |