Settings

Theme

Welcome PyT. Python DSL for fast (X)HTML generation

cliws.com

16 points by dogada 13 years ago · 8 comments

Reader

roguas 13 years ago

experience tells me the closer you stay to html the better. ZenCoding + LESS should sufficiently lower code generation. Abstraction layers over html tend to introduce a lot of hussle with premise of easier maintainably ( tried haml and many others, hardly added anything to the table)

  • adambard 13 years ago

    Depends on a) how comfortable you are working with HTML to begin with, b) what functionality you're implementing with your DSL, and c) how many people are working on the project? If you're someone with a lot of Python experience and no HTML experience, and you're doing a solo project, this is a perfectly appropriate.

    One other area where abstraction is appropriate is form generation. I've used Django a lot and recently Clojure+Noir a bit, and in both of those I've ended up using an abstraction for all the form code (Django forms in the former, Hiccup+helpers in the latter). In the Clojure project I was even working with someone knew HTML and not Clojure, so most of the site is rendered using Mustache templates, but I ended up rewriting all the forms in Hiccup because it's just easier to work with.

    All that said, you seem like someone that might like Enlive (https://github.com/cgrand/enlive). I'm not sure if equivalents exist in other languages, but the gist of using it for templating is that you write a plain HTML file, and run the text through Enlive along with some transforms (identified by CSS-style selectors). I've never used it for anything major, but other people have, and it seems really cool.

    • roguas 13 years ago

      a)if you are not, you should get or let someone else do it b)right, this fits nice with forms... forms are not purely html issue, but a whole another layer of serverside complexity underneath...(escapes, xss, tokens) c)argument against imo, if more people have to work on something more I am eager to use something common, standard...

      Enlive is kind of like haml from what I see. For me its right on the border, I like it, I see the benefits but you have to take some leap and believe you wont hit the pit.

  • dogadaOP 13 years ago

    I understand you but DSLs allows to reduce number of used languages/tools in a web-projects.

    For example NodeJs allows to use same JavaScript for both client and server and if we will have smth like http://lispyscript.com/docs/#templates we can also seamless export business logic into templates (without need to create special template tags, filters, syntax, etc).

    Single language for almost everything can be big performance boost IMO.

jdnier 13 years ago

I like his advice:

"""You probably know this feeling when you think that code is not ready for public release yet and you need to implement at least 50% of your huge todo.txt to make it good enough.

Today in the morning news on TV was said that we all need to finish postponed stuff because Mayan 'End of Time' is too close to postpone again. I said: "Well, if even Maya need this, I will release today". """

mmariani 13 years ago

You shouldn't worry about the word ending, at least not according to a NASA's scientists [1].

Either way, thanks for releasing your code. I'll check it out later. I love reading python.

[1] http://news.cnet.com/8301-17938_105-57556172-1/nasa-there-wi...

baq 13 years ago

i see certain similarities to nevow stan (created about 10 years ago by my calculation). anybody care to point out the differences?

http://code.activestate.com/recipes/286210-very-basic-exampl...

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection