On Nov 27, 3:03 pm, Nathan Weizenbaum <[email protected]> wrote:
> If I were redesigning Haml from scratch, I'd actually try to make it *easier
> * to write tags and *harder* to write content. That is, I'd have the tag be
> the default and the content require an extra character. Something like this:
>
> html
> head
> title foo
> body
> p
> > This is text.
> > I like text!
>
Just to follow up on Nathan's suggestion from 10 days back, my
colleague and I are now using a very similar approach to the above
snippet in our Python-implemented HAML-like markup below:
div id="create_referral"
div class="cues"
br
h5 | Start a discussion with friends:
ul
li | Tell a story
li | Share some knowledge
li | Ask for advice
li | Plan a gathering
p
| This is a
| sentence.
i > b | This is italization of boldification of this text.
Everything to the left of the pipes is structural; everything to the
right of the pipes is content. So far it has worked out well. Any tag
like "br" above that is not followed by a pipe, inner tag (see ">"),
or an indentation block just auto-closes, so we do not have to special-
case any HTML knowledge within the parser itself.
Below is a more real-world example of us integrating with Django's
templating language, as well as incorporating some shortcut syntax
like "LINK." The "PASS" syntax is stolen from Python, where you want
to have an empty block and need something to indicate indentation
level.
head
link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/
base.css"
script src="{{ MEDIA_URL }}js/jquery-1.3.2.js"
script src="{{ MEDIA_URL }}js/swap.js"
body
p
LINK fake_login_entry | Signout
if user
| Currently logged in as <b>{{ user.username }}</b>,
| {{ user.points }} points.
hr
div id="menu"
span id="action_links"
LINK home | Home
LINK friends | Friends
LINK create_referral | Create a card
LINK recent_changes | Recent changes
LINK my_archive | Archive
span id="information_links"
LINK about | About Grapevyn
hr
block body
PASS
--
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.