News for hackers. Stuff that matters.
Re:Foolproof HTML by tannhaeuser on Sunday February 05, 2017 @06:43AM (#13571930)
SGML/HTML tag inference is guided by content model declarations, eg.

     <!ELEMENT html O O (head,body)>
tells SGML that the html element should contain a head element, followed by a body element. "O O" (capital letter O for omission) are tag omission indicators (in this case meaning that both the start- and the end-element tags for html can be omitted).

This is covered in depth in the linked paper/slides (in fact, covering JimDabell's example exactly).

Re:Foolproof HTML by lisper on Sunday February 05, 2017 @12:31PM (#13573393)
You really don't seem to understand the difference between syntax and semantics. Syntax has to do with the rules that govern what strings of characters constitute legal programs. Semantics has to do with what strings of characters which are legal programs mean. For example, the following two documents are both syntactically correct:

    <!document ...>
    <a><c></c></a>

    <!document ...>
    <!element a O O (b,c)>
    <a><c></c></a>
They just have different semantics. If parsed as HTML, the first produces a DOM with two nodes and the second produces a DOM with three nodes.

By way of contrast, this is syntactically incorrect:

    <table><tr><td>data</img>
So is this:

    <img src=x<y.html>
There is no DOM that corresponds to those two examples.

One of the (many) problems with SGML is that it muddies the distinction between syntax and semantics. That is one of the (many) reasons that using S-expression syntax to write SGML-like languages is advantageous.

Re:Foolproof HTML by tannhaeuser on Sunday February 05, 2017 @12:48PM (#13573495)
> You really don't seem to understand the difference between syntax and semantics.

Are you talking to me? I've just pointed out how SGML works and didn't say anything about syntax/semantics.

Re:Foolproof HTML by lisper on Sunday February 05, 2017 @01:17PM (#13573623)
Yes, I'm talking to you. You're right, you didn't say anything about syntax and semantics. I did. Go back to the beginning of the thread:

> > If you have a good strategy for validating your template files, I'd love to hear it!

> Use S-expression syntax instead of SGML syntax [emphasis added]

Note the use of the word syntax. I'm talking about syntax. All of your responses have been at best irrelevant or at worst wrong because you either don't understand what syntax is, or you chose to ignore it. It's damned annoying, particularly when you start making demonstrably false claims like, "it's nowhere close to the power of SGML as a text format" (https://news.ycombinator.com/item?id=13569991).

Re:Foolproof HTML by tannhaeuser on Sunday February 05, 2017 @02:46PM (#13574153)
If reality is so annoying to you, please refrain from (trash-)talking to me.
Re:Foolproof HTML by lisper on Sunday February 05, 2017 @03:04PM (#13574258)
Reality is not annoying. Straw-man arguments are.

https://en.wikipedia.org/wiki/Straw_man