What if I can't figure out what I've done wrong? Will it never post, causing me to be frustrated and discard my thought?
Not at all. With my suggestion, Tidy and Gus' enhancements will suggest a correction and display what the auto-corrected text will look like. It's up to you to accept the changes and hit post, or try to fix it yourself. The only alternatives I've seen are
a)
have Tidy, etc. fix the post and post it without any intermediate input from the poster, or
b)
do nothing and have the malformed html post as is (the current state).
The tidy alternatives proposed are -- have it fix it
in the database
or have it saved as entered, and fix it
every time it's displayed
(with a note visible only to the post owner).
When clarified like that, I lean towards on display. Then I can correct it myself, right?
I'm one of those people who never uses a preview option, even when offered. I make my mistakes for the whole internet to see, 'cause I'm too damned impatient to wait for a whole 'nother click-through screen. My dial-up is sometimes painfully slow. Of course, I don't want my mistakes to broke nothin', so it's all good.
I think I'd rather have the post fixed at the database rather than having to fix it every time it's displayed. That seems wasteful of resources.
I, OTOH, am pretty adamant about not wanting what I typed changed, if not by me or a stompy. It's a thing that transcends my resource concerns.
Here's the flow I'm imagining:
- Poster types a post and submits it.
- Post gets saved to a temporary variable and gets run through TidyPlus.
- If TidyPlus does nothing, post gets posted. End of story.
- If TidyPlus finds errors, it writes a suggested fixed post to another temporary variable.
- A page that looks somewhat like editpost.php is loaded. Near the top of this page is displayed how the Tidy'ed post will look. Below that is one or maybe two multiline text boxes.
- If it's one box, it could contain either the text of the original post or the text of the Tidy'ed post. The poster either makes changes to the post or (only if it contains the Tidy'ed text) accepts the changes as is and hits submit.
- Another option is to have two text boxes and two submit buttons -- one box and button with the original text and one with the Tidy'ed text. The poster could change or accept the text in either of the two text boxes, and then hit submit below the text box containing the text they want to post.
- If the resubmitted post still has html problems, the process begins anew.
If the resubmitted post still has html problems, the process begins anew.
The theory being that crap is never allowed through?
Exactly. Why would we want something posted that will mess up other posts or the entire showthread.php page?
Why would we want something posted that will mess up other posts or the entire showthread.php page?
We absolutely wouldn't.
I wonder, however, about two things:
1. We get caught in a user-controlled loop of no submission (admittedly, a really easy one to escape).
2. Before we can run tidy on it, we have to do the expansion from quickedit. I wonder if there's a risk of a combo of bad HTML entered by the users, and expanded quickedits that would give a tidy error, but not be easy to eyeball as a problem for the user -- see, we're not presenting the HTML that would be posted to the user to be fixed.
Okay, now I'm obsessing about #2.
1 isn't a problem because the user can always submit the Tidy'ed version as presented. I'll have to think on 2.
Once we get this figured out, I think we should start Tidying content. We could start with not allowing a post to be submitted if it contains two or more LOL's.