Live data from Hacker News

Beautiful mini language for outputing HTML in Python

shpaml.webfactional.com

21–30 of 74 posts

Re: Beautiful mini language for outputing HTML in Python

#25
post #19
post #13

Earlier quoted context omitted.

What is the problem with using one language to produce another? How do you think your primary programmin language gets converted to assembly and then to machine code? As far as I am concerned this is a useful abstraction on a trivial problem.

The problem is that this is a trivial problem. Why add an abstraction on top of something that is already so simple?

Well machine language is pretty simple especially when you use something like MIPS. It can even be pretty fun to code in if you assembler has good macro support. However there is value is adding an abstraction layer on top of machine code. I think what people are really trying to say in these comments is that this new mini language does not provide useful value vs HTML like C provides vs. MIPS. Cheers.

Re: Beautiful mini language for outputing HTML in Python

#26
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.

Re: Beautiful mini language for outputing HTML in Python

#27
post #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 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 is compressed"), there is too much flexibility for a large team to work smoothly. My usage case doesn't mesh with your example, because I'm working in an environment with version control and multiple developers. The guy using Notepad will be told to get a tab-aware text editor, because his changes will mangle the whitespace in the file and lead to unnecessary noise when he commits.

When structure in your whitespace is already desired (to avoid making your version control noisy), you can leverage the fact that you are structuring the whitespace to make it a semantic element. This greatly decreases typing, makes the code easier to eye-scan, and allows details such as proper closing bracing to be left to the compilation tool and not to the developer. I agree with commenters who have noted that HAML has been proven useful for some developers.

I would categorize both SHPAML and HAML as tools that let you be more productive with HTML.

Re: Beautiful mini language for outputing HTML in Python

#28

I no longer fall for languages that only change the syntax for something the author thinks it's cuter...

i use Markdown (http://daringfireball.net/projects/markdown/) regularly rather than directly writing HTML. like this thing, it's also just syntactic sugar, but it's well-designed and makes it so that i can concentrate on writing and not on formatting syntax. my raw text files are much more source-control friendly, since the diffs are clean.

Re: Beautiful mini language for outputing HTML in Python

#29
post #20

I no longer fall for languages that only change the syntax for something the author thinks it's cuter...

Is it just cuter if it means less typing?

The difficulty of programming isn't from having to type too much, it's from solving problems.

Re: Beautiful mini language for outputing HTML in Python

#30
post #29
post #20

Earlier quoted context omitted.

Is it just cuter if it means less typing?

The difficulty of programming isn't from having to type too much, it's from solving problems.

The difficulty of writing HTML is mostly having to type too much. Writing HTML isn't programming.
Post reply on HN