(defun cleanup-me2html () "Misc hacking to make generated html look good." (interactive) (setq case-fold-search nil) (let ((save-version-control version-control)) (setq version-control 'never) ;(setq kept-old-versions 50) ;(setq kept-new-versions 50) (replace-regexp "[ \t]*\\(</a>\\)" "\\1") (beginning-of-buffer) (delete-blank-lines) (delete-blank-lines) (setq d (point)) (search-forward "No such file or directory" nil t) (kill-region d (point)) (end-of-buffer) (delete-blank-lines) (delete-blank-lines) (fix-html-table-refs) ; One more time -- we cannot untabify until after tbl is done. This means we ; wait to untabify in a different .el file. ; Ignore next old message -- we now want to untabify. I think what was ; happening was that .ad was on and untabifying then was yucky. Now that .ad ; is globally off, untabifying appears to be fine. ; OLD MESSAGE: Forgot why this was here, but it mucks some stuff up ; (beginning-of-buffer) ; (setq d (point)) ; (end-of-buffer) ; (untabify d (point)) (save-buffer) (setq version-control save-version-control) ) ) (defun fix-html-table-refs () "As strictly a special-purpose hack, replace ``\n</a>'' with just ``</a>''. This makes table entries with shortish hrefs look nicer, since it eliminates the extra underlined space after the href." (interactive) (setq case-fold-search nil) (beginning-of-buffer) (while (search-forward-regexp "^<table" nil t) (setq d (point)) (search-forward "</table>") (backward-char 8) (if (not (bolp)) (newline 1) ) (narrow-to-region d (point)) (beginning-of-buffer) (replace-string "\n</a>" "</a>") (widen) ) )