Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Add meta options to disable/enable cleanup and repair option #819

Closed
hwalinga opened this issue May 1, 2019 · 4 comments
Closed

Comments

@hwalinga
Copy link

hwalinga commented May 1, 2019

I only use tidy for indenting and wrapping and it took some time to figure out how to completely disable the cleanup and repair options.

For example to disable default cleanup options I need

--drop-empty-elements no --drop-empty-paras no --merge-divs no --merge-spans no

Maybe it is a good idea to add "meta" options like --cleanup no/yes and --repair no/yes to have an easier way to complete enable or disable the cleanup and repair options.

@geoffmcl
Copy link
Contributor

geoffmcl commented May 6, 2019

@hwalinga thanks for the idea of an option, to enable/disable cleanup and repair options... but can not quite see how to do this...

  1. choosing an new option name... we already have clean... even if that found, agreed...
  2. choose what options it should effect... you have found 4... are there others?
  3. I suppose we could not all agree on what it effects... so is always a compromise...
  4. this becomes hard coded, very inflexible, ...
  5. then documentation for this new option...

This does not seem very likely, or easy, to choose such a compromise, since all of tidy can be involved in clean and repair... that's what tidy is about...

Seems more a valid use-case, where you want to flip some default options... chose 4, but could be more...

Why not use a config file?

It could easily be setup for the four options you have identified... is flexible ie can be extended as and when needed... easily added to the command tidy -config mydefault.cfg ..., for each file processed... simple...

Or you could set the environment variable HTML_TIDY with /path/to/mydefault.cfg, and tidy will use it every time... there are more config file use options if you compile from source...

Does a config file solve your issue?

Look forward to further feedback... thanks...

@hwalinga
Copy link
Author

hwalinga commented May 6, 2019

Thank you for considering my suggestions.

The distinction between what a cleanup option is and what a repair option is, is already made here.

Personally I mainly use tidy for pretty printing, and there is a distinct difference between pretty printing and repair and cleanup.

For users that only use tidy for pretty printing, such an option would make their lives more simple. Just a matter of convenience. Off course the config file can solve this, but you need to go over the trouble to find out what options you need to disable, and than create the config file, than call your program with that config file. So much trouble for just pretty printing.

@geoffmcl
Copy link
Contributor

geoffmcl commented May 7, 2019

@hwalinga you are trying to create a strong distinction between pretty printing (PP) and repair and cleanup (C&R), and point to a quickref, and I suppose the Option Groups could imply that idea... but was never the intention...

And you further suggest use case differences - PP and !C&R - which again stretches the idea, but maybe, sort of, ok... very loosely speaking...

Then suggest, Just a matter of convenience, a meta-mega-option, maybe --pretty-print-use-only yes, to do this... My question is still to do what, exactly?

You gave 4 changes, in the Cleanup group... ok, are there more? I don't know! Do you? Is it possible to get a single, all agreed, definitive list? I think not!

I hope you can see I am struggling to fully define the idea... maybe if you deal with, answer, the above 5 points raised... especially the ugly No.4... I may understand more... or not...

But if this can be solved using a config file, then why bother?

Yes, every user of tidy probably likes, or dislikes, this or that option default... and it may depend on the use, at the time...

For testing, which I do a lot of, I have a set of convenient setXXXX.bat files, each of the form set HTML_TIDY=%CD%\tidy-XXXX.conf, just for convenience...

Yes, each user must go over the trouble to find out what options they need to disable/enable/set, etc... that's what the quickref is for... that is what the very flexible tidy config file system is for... so you/they can choose...

I just can not yet see that there is a list of options, that should be changed because of one more option, hard coded into tidy.c... sorry...

Look forward to further feedback... thanks...

@hwalinga
Copy link
Author

hwalinga commented May 7, 2019

I understand. Thank you for your response and have a nice day.

@hwalinga hwalinga closed this as completed May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants