I don't think we have a tag-closer yet, though.
No, we don't.
It was something I wasn't expecting produced by [...] the thing's response to my missing quote.
Well, it's not that unexpected. After all, your link to something.com, if the quote is never closed, becomes a link to the something.com address, plus the whole of the rest of the page from that point onward, doesn't it?
You know what's a really good habit to get into? Any time you type quotes, type both of them right away, then use the left-arrow to put the cursor back between them.
Same for HTML brackets.
Someone from our accountancy department showed me that and I've never looked back. Never miss a closing quote again! Though I sometimes accidentally end up with
A HREF="" something.com
I never end up with
A HREF="something.com [remainder of page]
I liked how HomeSite would type both the quote marks and jump your cursor back between them. Typically, what I'm doing is typing "quote, Ctrl-V, quote," with only a short time to forget the close quote.
what I'm doing is typing "quote, Ctrl-V, quote,"
That'll do it -- just do "quote-quote, left-arrow, Ctrl-V" like Homesite does for you. Same keystrokes.
ita, when you have a moment, what are the legal tags here?
I really want to think about the tag-closer code again, but are there any legal tags, apart from <br> which don't need closing?
I wouldn't swear to it, but poking around in the test site i found this list in the post-stripping function:
<a>
<b>
<i>
<u>
<ul>
<ol>
<li>
<p>
<br>
<strike>
<table>
<tr>
<td>
<th>
<font>
<pre>
<code>
Thanks Jon, that's like strip_tags(the list above), right?
So, only really BR, but what about the ones that don't need to be closed for it to work, but should be for the syntax, like P and LI? Hmmm. More thinking required.
that's like strip_tags(the list above), right?
Pretty much, yeah.
what about the ones that don't need to be closed for it to work, but should be for the syntax, like P and LI?
I'd say close them. I'm all for compliant html where possible.
t edit
although I see the problem --- you want the
t /li
to occur before the next
t li
or
t /ul
Similarly, with the P tag.
Having thought about it for a while, it's only the tags that would create formatting problems further down the page that need to be handled. An unclosed LI tag won't cause the rest of the page to be indented, but an unclosed OL or UL will. Unclosed P tags won't cause any problems either.
I'm seeing the logic like this:
Go through the post, creating a list of all potential troublesome tags, i.e. when we encounter the first A tag, put it on a list.
When we encounter the next </A>, take that A tag off the list again.
If there's anything on the list at the end, close it.
It needs some more refinement, but that's essentially it, right?
I've just remember that the last big HTML problems were caused by unclosed
attributes,
not unclosed tags. I don't have any idea how to sort that out...
Could you keep track of all open attributes and close them at the close of a tag?