Uniform HTML templating language
Asked Answered
V

5

9

It seems like every web framework has its own pet template language. Ruby has eRuby, Python's django uses the Django template language, Haskell has Heist and Hamlet, Java's got JSP, and then there's PHP...

My question is, has anyone tried creating One Templating Language to Rule Them All? Are there any such templating languages that at least have some widespread support amongst the varying web frameworks?

Vulpecula answered 27/3, 2011 at 6:2 Comment(0)
R
7

Mustache maybe.

Rodge answered 27/3, 2011 at 6:35 Comment(2)
Important to note that this is because it can call functions in a language-agnostic (though very limited) fashion.Subsonic
It is easy for something as trivial as Mustache to come close to universal. :-)Rowenarowland
A
3

XSLT might be a candidate as a "universal" template language.

It might also be the greatest evil that this land has ever seen, but that's up for debate.

Adriatic answered 27/3, 2011 at 6:19 Comment(2)
definitely the greatest evil this land has ever seen.Rodge
Well, it isn't universal in a way that it depends on XML as a data source - even if it can be used to produce output other than XMLRowenarowland
E
0

NHAML/HAML is the closest you'll get to a standard.

Exenterate answered 27/3, 2011 at 6:5 Comment(0)
B
0

Freemarker (and Velocity to some extent) seem to be supported by a growing number of frameworks (Spring, Tiles, Struts and more) and can be used to generate code in any framework, but I don't think there is "one template engine to rule them all". If there was though, I would choose Freemarker any day

Boarhound answered 27/3, 2011 at 6:44 Comment(4)
If I understand correctly, both are Java only? :( Though I suppose that 98% of truly enterprisey projects are in Java nowadays...Vulpecula
Velocity has a .NET port (nvelocity.sourceforge.net) but I don't know of one for FreemarkerBoarhound
These are hardly choices if you need client side templates.Sounding
True, though I am not sure the OP meant to include them. if so, I would recommend Handlebars or DoT.js rather than MustacheBoarhound
C
0

uh... Trying to find something like that for WEB project which would be able to render html from same templates at both sides. Server and Client. Already mentioned Mustache seams to be most suitable choice so far...

Maybe this JSON based solution will sound interesting...

Also HAML looks promising.

Carbonate answered 17/1, 2013 at 19:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.