TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Beautiful mini language for outputing HTML in Python

92 pointsby iamelgringoover 15 years ago

15 comments

capablancaover 15 years ago
I no longer fall for languages that only change the syntax for something the author thinks it's cuter...
评论 #1021477 未加载
评论 #1020743 未加载
评论 #1020657 未加载
评论 #1020438 未加载
评论 #1021406 未加载
nirover 15 years ago
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.
评论 #1020619 未加载
评论 #1020821 未加载
apgwozover 15 years ago
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).<p>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.
评论 #1020430 未加载
评论 #1020941 未加载
Jim_Neathover 15 years ago
I like HTML. I like the way it looks. I like writing it.<p>On the other hand, I don't like new DSLs for writing what is already a simple markup language.
评论 #1020697 未加载
nicpottierover 15 years ago
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.<p>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.
评论 #1020980 未加载
amituover 15 years ago
One reason to use this would be to get well indented HTML.<p>Finding the potentially missing closing &#60;/div&#62; tag has been a common problem I have seen some people face.
andrewcookeover 15 years ago
this could <i>almost</i> 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).<p>but once you've done that, this could be very neat. no processors - just constructing html in python.<p>(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.)
评论 #1021330 未加载
RyanMcGrealover 15 years ago
&#62; If HTML were truly awesome, then you would not have Wikipedia; you would have Htmlpedia.<p>I don't buy this. The problem with HTML is not that it isn't expressive enough or that it's too hard to use; it's that arbitrary user code can easily compromise the integrity of your website.
评论 #1020991 未加载
wglbover 15 years ago
Browsers care about how html looks. We should think of html and css as the assembly language--generated by some server-side process.
mattmcknightover 15 years ago
I prefer XML Builder templates (in Rails or Groovy) to this approach. It's similar, but SHPAML just drops enough stuff to have to be learned. You basically already know how to write Builder, it's that simple.
prodigal_erikover 15 years ago
I'm disappointed they resorted to a one-way preprocessor. Is it really not feasible to make a first-class domain-specific language like this in Python?
评论 #1021365 未加载
teehemkayover 15 years ago
The language may be prettier than HTML but the name looks rather ugly to me. Doesn't sound as bad though :-)
dan_simover 15 years ago
Is HTML that hard to write?
评论 #1020662 未加载
评论 #1020961 未加载
评论 #1020925 未加载
drhowarddrfineover 15 years ago
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!".
评论 #1020439 未加载
评论 #1020451 未加载
评论 #1020580 未加载
评论 #1021076 未加载
jmonegroover 15 years ago
I don't see why I would use that over this: <a href="http://lab.xms.pl/markup-generator/" rel="nofollow">http://lab.xms.pl/markup-generator/</a> Not only does it have the same syntax (with some improvements), but it also gives me the CSS to work with. AND I don't have to install python. Hooray.
评论 #1021004 未加载