Live data from Hacker News

Produce HTML from S-Expressions

github.com

61–63 of 63 posts

Re: Produce HTML from S-Expressions

#61

Earlier quoted context omitted.

If My and first just stand for themselves, you're not interpolating variables; where is the templating? Also, what if you don't want a space between the bold hello and emphasized world ? Or between first and hello ?

> If My and first just stand for themselves, you're not interpolating variables; where is the templating? Templating wasn't mentioned (yet. looking at the feedback I got, some avenues are open for some sort of templating). > Also, what if you don't want a space between the bold hello and emphasized world? Then you don't put one in? $ echo "(div My first (b hello)(em world)) " | ./l2h -s My first hello world > Or betw…

That's not S-exprs then because there is no symbolic difference between )( and ) ( or between foo( and foo (.

But it's a better representation for HTML, that we would have had if Berners-Lee hadn't been a supreme goofball.

Re: Produce HTML from S-Expressions

#62

Earlier quoted context omitted.

> If My and first just stand for themselves, you're not interpolating variables; where is the templating? Templating wasn't mentioned (yet. looking at the feedback I got, some avenues are open for some sort of templating). > Also, what if you don't want a space between the bold hello and emphasized world? Then you don't put one in? $ echo "(div My first (b hello)(em world)) " | ./l2h -s My first hello world > Or betw…

That's not S-exprs then because there is no symbolic difference between )( and ) ( or between foo( and foo (. But it's a better representation for HTML, that we would have had if Berners-Lee hadn't been a supreme goofball.

> That's not S-exprs then because there is no symbolic difference between )( and ) ( or between foo( and foo (.

You (and everyone else) who points this out is quite correct. I could have chosen a proper name, but when I started project (and created the name for it) I did not realise that I would have to make whitespace and newlines significant in order for it to make sense from an HTML perspective.

It was only when doing testing and trying to bold the middle two letters of "hello" that I knew I had to make whitespace significant.

So .. uh, sorry about the name :-(

Re: Produce HTML from S-Expressions

#63
post #51

Earlier quoted context omitted.

ok, that's reasonable. though you could specify attributes as (:foo bar) so that "(:" always starts an attribute. attributes without value could still be written without surrounding parentheses although always requiring them would make parsing easier.

> ok, that's reasonable. though you could specify attributes as (:foo bar) so that "(:" always starts an attribute. attributes without value could still be written without surrounding parentheses although always requiring them would make parsing easier. There's been a lot of pushback on the attributes, so something there has got to change. I'm considering all the changes (including your suggestion too. Thanks, BTW).…

'(' is no longer context-free and is inconsistent

i would not see it that way. "(" still starts a group, now it would just be either a tag or an attribute.

you could still parse the whole tree into a native data structure based on the parentheses alone (well, except for the significant spaces between tags, but that's another issue), and later look at the first element in each group to decide if it is a tag or an attribute

the same is true when writing. an attribute name starts with a colon ":foo". if you want to add a value to the attribute, you have to use "()" to group it with its name: "(:foo bar)"

another benefit is that you can write: (:class foo bar baz) instead of :class="foo bar baz"

Post reply on HN