proposal for hamlet-like syntax that is more compatible with html

It is clear from my experience working with html that hamlet has the right idea. The one time I worked on a HAML (the original hamlet, for Ruby) project professionally it was wonderful. However, the actual hamlet syntax could be implemented more nicely and that there is an opportunity for the syntax to be more similar to html. In particular, I would much rather have white space (and quotes where needed) than exclamation marks. Here is one possible alternative: https://github.com/stonean/slim With this style you end up with something like this: form action=url = text #id.class But a more practical syntax could allow compatibility with existing html- this has always been the main weakness of these newer systems. As I said, I have only worked on 1 HAML project, but have used standard templates for everything else. Even after a proper converter is built, the different syntax is a point of pain. Compatibility would also help remove part of the criticism that Yesod is off in its own little world. Instead of '%body' why not '
text' instead of '#id.class title=div>text'. Perhaps both could be allowed. Michael Snoyman is "intrigued" by this proposal and pointed out that because '<' is not used in Hamlet it would be possible to maintain a backwards compatible mode. However, we both don't want to fracture the community- this is a proposal to permantenly improve things and then deprecate the previous syntax, providing a converter to upgrade. I would appreciate feedback from some haskellers. Are there any limitations are drawbacks to such a syntax, or is it just different? Does this appeal to you more hamlet? Will this make a convert out of anybody who runs away screaming when they see a hamlet template? Greg Weber
On Thu, Dec 9, 2010 at 9:20 PM, Greg Weber
I would appreciate feedback from some haskellers. Are there any limitations are drawbacks to such a syntax, or is it just different? Does this appeal to you more hamlet? Will this make a convert out of anybody who runs away screaming when they see a hamlet template?
I took some time to "get" Hamlet's syntax. While Hamlet (and Yesod as a whole) is really great, I find those %s just plain ugly. Your proposal seems to be better and looks more like HTML without losing conciseness. Personally I would probably close all tags, including those that do not have text on the same line, but I don't want a bike shed around this point =). Cheers! -- Felipe.

I support this proposal's goal, and would be fine with rewriting my templates.

Alright, at this point I've only heard positive things about this
syntax change. Does anyone want to volunteer to try and tackle this,
or will this need to wait till I can get around to it? Fair warning:
I'm likely to try to deal with the WAI + enumerator and xml-enumerator
tasks first. If someone wants to take a crack at the Hamlet changes,
I'll be happy to review things.
Michael
On Sat, Dec 11, 2010 at 2:38 AM, Simon Michael
I support this proposal's goal, and would be fine with rewriting my templates.
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

My belated 2c (sorry, work has been keeping me away from things Yesod and
Haskell):
1. The key reason I switched to Yesod was Hamlet. I'm very new to Haskell,
and I wanted to try developing a webapp in it; when I looked at the various
frameworks, my main question was "What will require me to learn the least
new stuff, while still giving me a full Haskell-based development
experience?" Yesod was the answer, because I was already familiar with Haml.
So, it is one less thing a large swath of people need to learn when they
decide to give Yesod a try. And at least in my case, it was a deciding
factor.
2. I'm not convinced closeness to HTML is a design goal. My experience is
again limited, but I wouldn't expect many people to switch existing projects
to Yesod (or really, from any framework to any other); therefore, the idea
that someone will have a bunch of HTML to be converted as simply as possible
to whatever templating language we use seems remote.
3. Along the same lines, the reason for the existence of templating
frameworks like Haml and Hamlet is precisely that people don't enjoy writing
HTML: why would we constrain ourselves by similarity to something people
have put large (and creative) amounts of effort into avoiding? I think it is
unduly limiting.
4. I do believe there are some issues with Hamlet; in fact, the issues
raised by Greg are exactly the issues I have. I don't see having a
Yesod-specific templating language as the solution, unless this new syntax
gives Yesod such a big productivity boost compared to using Hamlet that it's
worth putting in the effort.
In brief, I think Hamlet is 95% of the way there, and that Michael has done
a great job with it. It seems easier to take it another 4% and get it to 99%
than it would be to rewrite the syntax from scratch. I don't view HTML
similarity as a bonus (or a malus, either way). Maintaining (and furthering)
similarity with Haml seems worthier goal, given how many people use it, are
familiar with it, and love it; it will ease adoption.
I hope this all made sense, and that I didn't start an argument about bike
shed colors... ;-)
Alexandros
On Sat, Dec 11, 2010 at 10:48 AM, Michael Snoyman
Alright, at this point I've only heard positive things about this syntax change. Does anyone want to volunteer to try and tackle this, or will this need to wait till I can get around to it? Fair warning: I'm likely to try to deal with the WAI + enumerator and xml-enumerator tasks first. If someone wants to take a crack at the Hamlet changes, I'll be happy to review things.
Michael
On Sat, Dec 11, 2010 at 2:38 AM, Simon Michael
wrote: I support this proposal's goal, and would be fine with rewriting my templates.
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

I would prefer that the bikeshed stay the color it already is. ;) The
syntax is easier for me as it is different from HTML. The HTML-like
syntax looks to me like invalid HTML and is more difficult to read.
Alex
On Sat, Dec 11, 2010 at 7:48 AM, Michael Snoyman
Alright, at this point I've only heard positive things about this syntax change. Does anyone want to volunteer to try and tackle this, or will this need to wait till I can get around to it? Fair warning: I'm likely to try to deal with the WAI + enumerator and xml-enumerator tasks first. If someone wants to take a crack at the Hamlet changes, I'll be happy to review things.
Michael
On Sat, Dec 11, 2010 at 2:38 AM, Simon Michael
wrote: I support this proposal's goal, and would be fine with rewriting my templates.
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
participants (6)
-
Alexander Dunlap
-
Alexandros Salazar
-
Felipe Almeida Lessa
-
Greg Weber
-
Michael Snoyman
-
Simon Michael