Live data from Hacker News

Beautiful mini language for outputing HTML in Python

shpaml.webfactional.com

1–10 of 74 posts

Re: Beautiful mini language for outputing HTML in Python

#2
I'm not a big proponent of all of these new HTML replacers. They don't really buy you anything--this one just gets rid of angle brackets as far as I can see, and adds CSS style #id and .classname. Now, instead of angle brackets, we have to use tabs, or spaces, or some other delimiter (I saw | in there for continuing a line).

The best way I've found of representing XML/XHTML or even HTML for that matter, is with X-Expressions--a subset of S-Expressions. But, they are most useful in a language that fully supports S-Expressions, like Lisp, since you can then use standard functions to generate your markup for you.

Re: Beautiful mini language for outputing HTML in Python

#5
post #2

I'm not a big proponent of all of these new HTML replacers. They don't really buy you anything--this one just gets rid of angle brackets as far as I can see, and adds CSS style #id and .classname. Now, instead of angle brackets, we have to use tabs, or spaces, or some other delimiter (I saw | in there for continuing a line). The best way I've found of representing XML/XHTML or even HTML for that matter, is with X-Exp…

Yes, I think that for HTML, "better tools" is the right answer. HTML is something that can be shared between people with various backgrounds, skills, and toolsets. I can write it in Emacs on Ubuntu, and send it to some guy who will work on it in Windows with Notepad, who can send it to someone else who will open it with Chrome on a Mac.

These things might be ok for small, tight teams, but I don't see them as buying that much in the long term, as opposed to tools that let you be more productive with HTML.

Re: Beautiful mini language for outputing HTML in Python

#6
this could almost be embedded, which would be much cooler i think. you'd have to define objects with names from html tokens and do some ugly hacking with python's operators. you'd also have to add something other than space between strings (a "+" might be ok).

but once you've done that, this could be very neat. no processors - just constructing html in python.

(i don't know if this sounds crazy or not, but you can see the same kind of approach in lepl, which i wrote. the main problem is operator precedence.)

Re: Beautiful mini language for outputing HTML in Python

#8

There's just something wrong about creating a language with a language to produce about in a third language. As Brian Kernighan told Dustin Hoffman one time, "Learn to code!".

While your language^3 comment is technically true, this seems to be simply shifting one markup syntax to another, using a language to perform the translation.

In addition, using something like SHPAML requires knowledge of the final output syntax, so the person using it must already know how to code.

Edit: In reading my response, it seems too curt. I definitely see your point, but more so in contexts other than this.

Post reply on HN