Here's a patch that adds the admin settings form.

Comments

sanduhrs’s picture

StatusFileSize
new1.54 KB

Additionally there's a htmltidy.info file needed.
Attached patch is against htmltidy HEAD and adds the menu_hook and the .info file.
vg

karens’s picture

StatusFileSize
new7.26 KB

I found some additional changes needed in 5.x. Changing the value of $node->body in the validate operation won't work in 5.x, you have to use form_set_value(). I'm not sure the teaser is getting set right yet, and I can't confirm that this won't interfere with other filters, so those things need investigation.

The form_set_error() on warnings made it impossible to save any code that generated warnings (which is most of them), so I changed it to drupal_set_message on warnings and only set an error on errors.

The hook_init() and hook_exit() code makes it impossible to use aggressive caching in 5.x and unnecessarily runs on cached pages, so I removed that code and put it in a separate module, htmltidy_output, that can optionally be enabled. I also cleaned it up so it wouldn't try to run htmltidy on cached pages.

I shouldn't be adding new features, but I needed an option to clean up Microsoft Word input, so I also added a variable for that option.

My patch program won't allow me to add in new files, so this patch is missing the .info file and the new module files I added. I'll add another comment with my proposed new module that would run htmltidy on the entire site output.

karens’s picture

StatusFileSize
new1.93 KB

And here's the new separate module for running htmltidy on the entire site.

drewish’s picture

Status: Needs review » Fixed

committed to head

karens’s picture

Status: Fixed » Active
StatusFileSize
new891 bytes

The code I submitted works, but throws an error. Here is a tiny fix that will get rid of the error. With that, I think you could safely create a 5x branch since this seems to work OK in 5x.

drewish’s picture

Status: Active » Fixed

created the branch. removed the files from head. i'll create a new release as soon as d.o stops being so slow.

Anonymous’s picture

Status: Fixed » Closed (fixed)