aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2025-01-04 12:22:33 +1100
committerYuchen Pei <id@ypei.org>2025-01-04 12:22:33 +1100
commit72139ef3250f7cad9dad3ccbdc7a829befcb5c5f (patch)
tree29b1124e66424f1c2fec86104dd09faac6bb3db9 /emacs
parent0ba0c7cd35c8c011ac1329fe41b2d9722089409a (diff)
[emacs] Incorporate mariadb kb functions into wiki
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/ycp-web.el2
-rw-r--r--emacs/.emacs.d/lisp/my/my-mariadb.el15
m---------emacs/.emacs.d/lisp/wiki.el0
3 files changed, 15 insertions, 2 deletions
diff --git a/emacs/.emacs.d/init/ycp-web.el b/emacs/.emacs.d/init/ycp-web.el
index ffdb83d..c50cc46 100644
--- a/emacs/.emacs.d/init/ycp-web.el
+++ b/emacs/.emacs.d/init/ycp-web.el
@@ -254,8 +254,6 @@
. ,(lambda (url &rest _) (exitter-open-post url)))
(my-hacker-news-url-p
. ,(lambda (url &rest _) (hnreader-comment url)))
- (my-mariadb-kb-url-p
- . ,(lambda (url &rest _) (my-mariadb-fetch-kb-source url)))
(my-mastodon-url-p
. ,(lambda (url &rest _) (mastorg-open url)))
(my-newscorp-au-url-p
diff --git a/emacs/.emacs.d/lisp/my/my-mariadb.el b/emacs/.emacs.d/lisp/my/my-mariadb.el
index 01bc063..bdb1c60 100644
--- a/emacs/.emacs.d/lisp/my/my-mariadb.el
+++ b/emacs/.emacs.d/lisp/my/my-mariadb.el
@@ -254,6 +254,21 @@ enum spider_malloc_id {
(defun my-mariadb-kb-url-p (url)
(string-match-p "https://mariadb.com/kb/en/\\([^/]+\\)/" url))
+(defun my-wiki-mariadb-extract-kb-source ()
+ "Extract the kb source from the current buffer.
+
+Used for wiki mode as a post-processor."
+ (let ((source
+ (dom-text
+ (dom-by-id
+ (libxml-parse-html-region (point-min) (point-max))
+ "answer_source"))))
+ (erase-buffer)
+ (insert source))
+ (goto-char (point-min))
+ (save-buffer)
+ )
+
(defun my-mariadb-fetch-kb-source (url)
"Fetches the source to an maridb kb entry at URL.
diff --git a/emacs/.emacs.d/lisp/wiki.el b/emacs/.emacs.d/lisp/wiki.el
-Subproject 7c90e1c35abb0a8eb25bcb5f3b5d8676dc13fc5
+Subproject 3bb836e703480e23b3eee8fdb369dacb294dc46