[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Tidy automatically HTML files
From: |
Sebastien Vauban |
Subject: |
[O] Tidy automatically HTML files |
Date: |
Thu, 19 Jun 2014 13:34:00 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (windows-nt) |
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
- [O] Tidy automatically HTML files,
Sebastien Vauban <=