From 72139ef3250f7cad9dad3ccbdc7a829befcb5c5f Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 4 Jan 2025 12:22:33 +1100 Subject: [emacs] Incorporate mariadb kb functions into wiki --- emacs/.emacs.d/lisp/my/my-mariadb.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'emacs/.emacs.d/lisp/my/my-mariadb.el') 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. -- cgit v1.2.3