Mercurial > hg > rsof
changeset 495:b3cffcadc1c2
for fixup of pandoc output
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Tue, 16 Jul 2024 16:38:03 +0100 |
parents | 7341dbbeaf28 |
children | 34129b221ffa |
files | MHMC/minutes.el |
diffstat | 1 files changed, 48 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MHMC/minutes.el Tue Jul 16 16:38:03 2024 +0100 @@ -0,0 +1,48 @@ +;;; 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>")) + +(defun fix-html () + (interactive) + (goto-char (point-min)) + (forward-line 2) + (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") + (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)) + (search-forward "<title>" nil t) + ) + +(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) + (replace-regexp "^<h.[^>]*>\\([^<]*\\)</h.>" "<div>\n <title>\\1</title>") + (goto-char (point-min)) + (replace-regexp "\\(</p>\n\\)\\([ ]*\\)\\(<div\\)" "\\1\\2</div>\n\\2\\3") + (goto-char (point-min)) + (replace-string "<p>ACTION: " "<p class='a'>") + (goto-char (point-min)))