<body><h1>Purpose</h1>
<...more HTML...>
command1 argument1 argument2
switch1 more parameters
switch2 more parameters
<...more HTML...>
command2 argument1 argument2 argument3
switch1 more parameters
</body>
So I intend to insert my DSL code "in between" the HTML of the body, without tagging it as is customary in PHP.
However, as a constraint, this only is used in conjunction with a Javascript file included in the header.
The purpose of the DSL is to enable the user to write much more cryptive and fast syntax, that may also stand for Javascript or even PHP/Java/Python etc. bits.
Questions:
- Is this a new idea, or have many people had the same?
- What are the arguments (for and) against introducing the off-side-rule to HTML?
Is it just impolite not to use brackets like PHP or are there other reasons not to?
With some sort of brackets (or block delimiters), it's easier to specify the syntax of how the various languages on the page are intertwined. You need to specify the syntax of the page in order to build a parser for it. Without brackets it might be impossible to specify a syntax, or the syntax (and the parser/preprocessor) might be horrendously complex.
How often do you think "\n|" occurs naturally in contemparary HTML?
I don't know. You'd need to ask someone that really understands the syntax of the various HTML dialects, someone that has written an HTML parser or two.
I can't imagine that will be easier to type than a single block opening and closing as in other languages (such as PHP, JSP, ASP, etc). There are very good reasons all of those very popular languages use almost identical block identifiers, maybe take a few moments to read the html spec sheet so you can fully grasp what impact your "adjustments" might make to parsers.
What if the block were introduced just only by a newline character, outside of HTML? I could check in PHP for orphanated text nodes with the DOMDocument class...
Something like:
<html>
<div><h1>Header</h1></div>
Some code
In some new
language
to be preprocessed
<div>some more html</div>
</hml>
Thanks handcraftedweb - glad you think the approch with the "\n|" would be feasible. What do you think of the above?
What if the block were introduced just only by a newline character, outside of HTML? I could check in PHP for orphanated text nodes with the DOMDocument class...
Something like:
<html>
<div><h1>Header</h1></div>
Some code
In some new
language
to be preprocessed
<div>some more html</div>
</hml>
Thanks handcraftedweb - glad you think the approch with the "\n|" would be feasible. What do you think of the above?
That would break html parsers and fail html validation.
I'm thinking of including these text nodes within a master <div>.
That way, they would validate and be loose text nodes...
Handcraftedweb - what do you think?
I'm assuming you're preprocessing this on the server side, in which case the input doesn't need to be valid HTML, the output does. The input does need to have well specified language/syntax and the preprocessor will act as validator for the new language.
So you don't need the enclosing div but I guess it wouldn't hurt.
It's a mixture of client-side and server-side processing...
(see. http://4nf.org/n.js)
Worth mentioning that the wrapping <div> is visible to the user(on display HTML) and the search engine alike from the start, as they see the HTML before DOMReady.
So if I want it to validate, I do need the wrapping <div> .
Am now thinking of integrating JQuery into the framework (http://4nf.org/)
Can anybody think of how the off-side-rule could be used to further simplify the use of JQuery in a pre-processing step (server-side)?
Bookmarks