view MHMC/minutes.el @ 542:53a504a7c31b

with results
author Henry Thompson <ht@markup.co.uk>
date Wed, 18 Sep 2024 09:33:55 +0100
parents 6b7198aed717
children 5def9134830d
line wrap: on
line source

;;; /c/Program\ Files/Pandoc/pandoc --metadata title="MHMC 2024-07-02" -N -f markdown -t html4 > notes.html
;;; Use -s if you want to just see the pandoc html as such, e.g. for an agenda to be emailed verbatim

(defun fix-html ()
  (interactive)
  (goto-char (point-min))
  (forward-line 2)
  (sgml-forward-element)
  (forward-char 1)
  (kill-region (point-min) (point))
  (fix-dls)
  (goto-char (point-min))
  (insert-file "/home/ht/Documents/RSoF/MHMC/doc-head.ent")
  (goto-char (point-max))
  (forward-line -2)
  (beginning-of-line)
  (insert "</div>\n")
  (forward-line 1)
  (beginning-of-line)
  (kill-line)
  (insert "</doc>")
  (goto-char (point-min))
  (replace-string "em>" "emph>")
  (goto-char (point-min))
  (replace-string "strong>" "name>")
  (goto-char (point-min))
  (let* ((hb (search-forward "<title>" nil t))
	 (tb (search-forward "<title>" nil t))
	 (te (- (search-forward "</title>") 8))
	 (tt (buffer-substring tb te)))
    (goto-char hb)
    (insert tt))
  (search-forward "<div id=\"header\"" nil t)
  (beginning-of-line)
  (kill-line)
  (forward-line 2)
  (kill-line 2)
  1)

(defun fix-dls ()
  (interactive)
  (replace-string "dl>" "list>")
  (goto-char (point-min))
  (replace-regexp "<dt>\\([^<]*\\)</dt>\n" "<item term='\\1'>")
  (goto-char (point-min))
  (replace-string "<dd>\n" "")
  (goto-char (point-min))
  (replace-string "</dd>" "</item>")
  )
(defun fix-divs ()
  (interactive)
  (let ((top (point)))
    (replace-string "<h1 " "</div>
  (replace-regexp "^<h.[^>]*>\\([^<]*\\)</h.>" "<div>\n <title>\\1</title>")
  (goto-char (point-min))
  (replace-regexp "\\(</\\(p\\|\\title\\)>\n\\)\\([ ]*\\)\\(<div\\)" "\\1\\3</div>\n\\3\\4")
  (goto-char (point-min))
  (replace-string "<p>ACTION: " "<p class='a'>")
  (goto-char (point-min)))