Hello,
I'm trying to add Tidy to the HTML export process, so that files are
more easy to read and, possibly, to diff.
The code I wrote seems correct to me in theory:
--8---cut here---start-8---
;; check that `tidy' is in PATH, and that configuration file exists
(when (and (executable-find tidy) (file-exists-p ~/.tidyrc))
(defun sva--export-html-final-filter (contents backend info)
(if (not (eq backend 'html)) contents
(with-output-to-string
(insert contents)
(shell-command-on-region (point-min) (point-max)
tidy -config ~/.tidyrc
t t *Tidy errors* t
(add-to-list 'org-export-filter-final-output-functions
'sva--export-html-final-filter))
--8---cut here---end---8---
In practice, it isn't, as the results of `shell-command-on-region' is
the empty string.
Though, when executed interactively on an HTML buffer, it does work as
expected.
I don't get what's wrong... Maybe one of you can have an idea?
Best regards,
Seb
--
Sebastien Vauban