Live data from Hacker News

Beautiful mini language for outputing HTML in Python

shpaml.webfactional.com

31–40 of 74 posts

Re: Beautiful mini language for outputing HTML in Python

#31
post #14

Why are most comments here negative? HAML already shown this technology does have value to a significant amount of people. Someone took the time to write this, seems to have done a pretty nice job and is releasing it for anyone to use. I can't see why anyone would feel the need to put it down in the comments. If you don't like, just don't use it.

One of the primary benefits I get from HN is the pro and con discussion of technology, especially if it's something I might want to use. If there are good reasons not use a technology, then I would rather hear about them before I rediscover them from my own experience.

Re: Beautiful mini language for outputing HTML in Python

#32
post #18
post #17

Earlier quoted context omitted.

1) As an HN submission, it's certainly better than most. Anything with code in it beats "Startup lessons from J-Lo". 2) Beauty is a matter of taste. It might not be the Bar Rafaeli of languages, but I wouldn't think it's so ugly as to require "forceful contradiction".

I like what I see of the DSL, but I don't believe meritorious beauty is a matter of taste. Coke vs. Pepsi - taste Python vs. PHP - not-taste For a better explanation, see: http://www.paulgraham.com/taste.html

I think we're in agreement. My distinction is:

Beautiful vs Nice - taste.

Beautiful vs Ugly - not taste.

So, since it's obvious this DSL isn't ugly, being less than beautiful doesn't really merit HN's negative response.

In any case, the negative comments seem to be doing great, which is sad for HN. My experience is that people who actually produce stuff (in any field) aren't usually publicly critical of other people's work, since they can appreciate the effort involved, and don't want to be at the same spot when they release their own work.

Re: Beautiful mini language for outputing HTML in Python

#33
post #5

Earlier quoted context omitted.

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 t…

I believe that I see your point, and I would agree that the verbosity of HTML leads to sharability, and that is a strength. But the verbosity is also one of its weaknesses for large projects; it adds a great deal of overhead in terms of keeping track of the tags, especially if the HTML needs to be re-arranged. And with no language-supplied rules for how much whitespace to use or where (beyond "all adjacent whitespace…

It's not the verbosity or lack of it that makes it shareable, it's the fact that it's a standard.

Some of these inventions are a bit nicer than the original thing, but not so much that I'd give up being able to share the code with pretty much anyone and everyone.

I can do HTML pretty quickly with Emacs' psgml mode, and I'm sure there are other people who specialize in it who can do it even faster with other tools. I think that's the place to look for improvements, rather than generating it like machine code.

Re: Beautiful mini language for outputing HTML in Python

#34
post #31
post #14

Why are most comments here negative? HAML already shown this technology does have value to a significant amount of people. Someone took the time to write this, seems to have done a pretty nice job and is releasing it for anyone to use. I can't see why anyone would feel the need to put it down in the comments. If you don't like, just don't use it.

One of the primary benefits I get from HN is the pro and con discussion of technology, especially if it's something I might want to use. If there are good reasons not use a technology, then I would rather hear about them before I rediscover them from my own experience.

As the author of SHPAML, I have no problem with all the negative comments about lightweight syntax abstractions, as I've seen all the same arguments written against HAML. Most of the critics of SHPAML have probably never actually used it, nor do I expect them to if they don't share the same pain points as I do. Nowhere do I make any claims that SHPAML is going to cure all problems. It does make producing HTML easier for me.

Re: Beautiful mini language for outputing HTML in Python

#36
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…

SHPAML replaces angle brackets and close tags with space-based indentation and pipes. The CSS sugar for #id and .classname is completely optional, and obviously if you know CSS, then the syntax should be familiar.

I agree that there are plenty of other useful ways to represent XML/HTML.

SHPAML does require or even support tabs. The "|" is not for line continuation; it is to separate markup from content.

Re: Beautiful mini language for outputing HTML in Python

#37
post #33

Earlier quoted context omitted.

I believe that I see your point, and I would agree that the verbosity of HTML leads to sharability, and that is a strength. But the verbosity is also one of its weaknesses for large projects; it adds a great deal of overhead in terms of keeping track of the tags, especially if the HTML needs to be re-arranged. And with no language-supplied rules for how much whitespace to use or where (beyond "all adjacent whitespace…

It's not the verbosity or lack of it that makes it shareable, it's the fact that it's a standard. Some of these inventions are a bit nicer than the original thing, but not so much that I'd give up being able to share the code with pretty much anyone and everyone. I can do HTML pretty quickly with Emacs' psgml mode, and I'm sure there are other people who specialize in it who can do it even faster with other tools. I…

When you run SHPAML through the preprocessor, it produces HTML that you can share with other people. So it's not that big an issue. Your greater point is well taken, though--using SHPAML is particularly suited to small teams.

Re: Beautiful mini language for outputing HTML in Python

#40

I kinda like it.. sure it is one more level of abstraction, and good editors will help with the tag balancing, but let's face it, (X|HT)ML syntax isn't exactly natural to write, and I say this despite having written it by hand for well over a decade. This probably appeals more to people who have made the Python jump and like that whitespace means something, as that's what really makes it terse.

SHPAML is definitely targeted at Python users and people who like meaningful whitespace (and associated terseness).

Glad you like it! I have also been hand writing HTML for well over a decade too (as well as other means of producing HTML), so my goal in SHPAML was simply to relieve pain points for an everyday task. It has worked for me.

Post reply on HN