Mercurial > hg > rsof
diff MHMC/minutes.el @ 533:6b7198aed717
misc
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Thu, 29 Aug 2024 13:42:28 +0100 |
parents | 34129b221ffa |
children | 5def9134830d |
line wrap: on
line diff
--- a/MHMC/minutes.el Thu Aug 29 13:42:04 2024 +0100 +++ b/MHMC/minutes.el Thu Aug 29 13:42:28 2024 +0100 @@ -1,8 +1,5 @@ -;;; sed 's/^ *//' notes.txt|/c/Program\ Files/Pandoc/pandoc --metadata title="MHMC 2024-07-02" -s -f markdown -t html4 > notes.html - -;;; from before pandoc -(defalias 'format-action (read-kbd-macro -"C-s ACTION: SPC RET C-SPC <M-backspace> <p SPC class='a'> C-M-s C-q C-j C-q C-j RET <backspace> C-b </p>")) +;;; /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) @@ -11,8 +8,6 @@ (sgml-forward-element) (forward-char 1) (kill-region (point-min) (point)) - (fix-divs) - (goto-char (point-min)) (fix-dls) (goto-char (point-min)) (insert-file "/home/ht/Documents/RSoF/MHMC/doc-head.ent") @@ -29,7 +24,17 @@ (goto-char (point-min)) (replace-string "strong>" "name>") (goto-char (point-min)) - (search-forward "<title>" nil t) + (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 () @@ -44,9 +49,11 @@ ) (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>\n\\)\\([ ]*\\)\\(<div\\)" "\\1\\2</div>\n\\2\\3") + (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)))