Stupid SGML tricks
Thursday, 15 January 2004 21:36LiveJournal's HTML cleaner uses a parser which can parse HTML (but also understands XHTML).
This means, for example, that you can leave off quotes on attribute values if they consist only of letters, numbers, hyphens, dots, underscores, and colons. This is the reason why <lj user=exampleusername> and <lj user="exampleusername"> both work to produce
exampleusername (though I'd prefer the latter)—the HTML cleaner doesn't see whether there are quotes or not and the output of the parser is the same in either case.
The fact that the cleaner uses an HTML parser also means that it does SGML-style attribute minimisation; if the value of an attribute in an HTML file is the same as its name, then you can leave off the value. For example, you can pre-check a checkbox in HTML with <input type=checkbox name=foo value=27 checked>, which would have to be <input type="checkbox" name="foo" value="27" checked="checked" /> in XHTML (which does not allow attribute minimisation).
And because the parser in the HTML cleaner does this, too, you can say <lj-cut text> (see it in action here: [this is cut]) and it'll be parsed the same as <lj-cut text="text"> :p Or even <lj user> which becomes
user (i.e. <lj user="user">). Funny.
no subject
Date: Thursday, 15 January 2004 12:38 (UTC)Danke.
no subject
Date: Thursday, 15 January 2004 12:45 (UTC)<strike>oder<s>(oder, wenn man's mit CSS machen möchte: <span style="text-decoration: line-through">).Wenn du speziell <lj user> meinst (wie in
no subject
Date: Thursday, 15 January 2004 12:53 (UTC)no subject
Date: Thursday, 15 January 2004 13:55 (UTC)no subject
Date: Thursday, 15 January 2004 13:57 (UTC)no subject
Date: Thursday, 15 January 2004 14:35 (UTC)Anyway, you cannot rely on del being rendered as strike-through. Not only can users override this in their user (or browser) stylesheets, page authors can also override it, and there are user agents which use a different rendering.
I've seen a phone with limited web browsing (not WAP!), where text was always black on white, but del was rendered as red text (CSS: del {color: red}). INS on that browser was blue.
Similarily you cannot rely on em being rendered in italics, or strong being rendered boldfaced.
no subject
Date: Thursday, 15 January 2004 14:40 (UTC)this was struck out, this was bold, and this was italic. :)<strike style="text-decoration: none;">this was struck out</strike>, <b style="font-weight: normal;">this was bold</b>, and <i style="font-style: normal;">this was italic</i>
Sorry for the double comment, I didn't close a tag!
no subject
Date: Thursday, 15 January 2004 16:27 (UTC)EM, STRONG, DEL, INS etc. have a real meaning: even if they are all rendered the same as normal text their meaning is not lost.
no subject
Date: Friday, 16 January 2004 00:55 (UTC)In principle, yes—if you want to strike through text because you want to mark it as deleted.
Using
<del>whenever you want struck-through text is like using<em>whenever you want italics and feeling you're "better" because you don't use the "evil"<i>tag. (For example, I tend to use<em>when talking, as with the "if" above, but<i>for things such as book titles or (sometimes) foreign words, which are conventionally italicised in English: the presentation [font-style] is the semantics in that case.)But yeah, I suppose the most common case is indeed where you want to replace one word with another (in which case you really should follow it with
<ins>as in thissentenceexample).no subject
Date: Friday, 16 January 2004 12:12 (UTC)no subject
Date: Friday, 16 January 2004 22:05 (UTC)no subject
Date: Thursday, 15 January 2004 14:20 (UTC)no subject
Date: Thursday, 15 January 2004 16:02 (UTC)no subject
Date: Friday, 16 January 2004 00:57 (UTC)<lj user>tags since I've seen that pretty often.And being able to say
no subject
Date: Friday, 16 January 2004 01:51 (UTC)no subject
Date: Friday, 16 January 2004 12:13 (UTC)no subject
Date: Thursday, 15 January 2004 20:36 (UTC)That just allowing people to get sloppy and cheat...