XahTV 2020-06-16 emacs lisp and html coding. etymology and mythology

XahTV 2020-06-16 emacs lisp and html coding. etymology and mythology

topics talked:

(defun xah-words-word-etymology-linkify ()
  "Make the current word into a etymology reference link.
Version 2020-06-16"
  (interactive)
  (let ($p1 $p2 $word
            ($url "https://www.etymonline.com/word/"))
    (if (use-region-p)
        (setq $p1 (region-beginning) $p2 (region-end))
      (setq $p1 (line-beginning-position) $p2 (line-end-position)))
    (setq $word (buffer-substring-no-properties $p1 $p2))
    (delete-region $p1 $p2)
    (insert (format "[etymology of %s <a href=\"%s%s\" target=\"_blank\">%s%s</a>]" $word $url $word $url $word))))

<a href="https://www.etymonline.com/\([^"]+?\)">https://www.etymonline.com/\1</a>

<a href="https://www.etymonline.com/\1" target="_blank">https://www.etymonline.com/\1</a>

(xah-find-replace-text-regex "<a href=\"https://www.etymonline.com/\\([^\"]+?\\)\">https://www.etymonline.com/\\1</a>" "<a href=\"https://www.etymonline.com/\\1\" target=\"_blank\">https://www.etymonline.com/\\1</a>" "/Users/xah/web/wordyenglish_com/" "\\.html$" t t t t t)

xah_talk_show_2020-06-16.txt

If you have a question, put $5 at patreon and message me.