Xah Talk Show 2024-05-03 Ep551 Emacs Lisp Coding, html add related box

- Timestamp
- 04:11 task 1, xahhtml-add-related-box
- 14:07 writing html manually
- 16:29 fix linkify path with query string
- 39:38 order of query string and hash fragment
- 46:29 correction. the xah-cite code is correct.
- task 1. emacs lisp, html, write command to warp div.rltd box to current text block.
(defun xx-add-related-box () "add a html div tag with class name rltd, to current text block. Created: 2024-05-03 Version: 2025-03-25" (interactive) (let (xp1 xp2 xtext) (seq-setq (xp1 xp2) (if (region-active-p) (list (region-beginning) (region-end)) (list (save-excursion (if (re-search-backward "\n[ \t]*\n" nil 1) (match-end 0) (point))) (save-excursion (if (re-search-forward "\n[ \t]*\n" nil 1) (match-beginning 0) (point)))))) (setq xtext (buffer-substring-no-properties xp1 xp2)) (delete-region xp1 xp2) (insert "<div class=\"rltd\">\n" xtext "\n</div>")))
task 2. fix this function xah-html-local-file-to-link. When a local file link contains a query string, you need to first remove the query string, then link the file, then add back the query string.
e.g.
file:///C:/Users/xah/web/xahlee_info/comp/unicode_index.html?q=power+-tel