Defining :autoclose with a regex?

8 views
Skip to first unread message

Dan Brendstrup

unread,
Nov 14, 2009, 9:23:23 AM11/14/09
to Haml
Hi,

Is there any way to define tags for the :autoclose option with a
regex? I'm trying to use Haml as a preprocessor for Textpattern
templates, and Textpattern uses XML-style templating tags such as
<txp:site_name />, <txp:author /> etc.

Unless they contain statements and therefore function as "container
tags", all Textpattern tags must be self-closed, so to avoid ending
each Haml-tag with a forward slash, it'd be great to be able to
specify that all tags beginning with "txp:" should be self-closed.

Is this possible, or does :autoclose simply parse a static array?

Due to the plugin nature of Textpattern, the number of txp-tags is
potentially infite, so listing them all in an array is unfortunately
impossible.

Thanks for any help!

- Dan

(And for anyone interested: Aside form the above niggle, because Haml
is tag-agnostic it is a perfect fit for Textpattern pre-processing.
I'm experimenting with nanoc for pre-processing templates, and pulling
them in with the cnk_versioning Textpattern-plugin, and it friggin'
rocks.)

Nathan Weizenbaum

unread,
Nov 14, 2009, 3:45:13 PM11/14/09
to ha...@googlegroups.com
Not until now. I've just pushed revision 27f6df9 to the master branch that will allow regular expressions in the :autoclose array.


--

You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to ha...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=.



Dan Brendstrup

unread,
Nov 14, 2009, 5:48:03 PM11/14/09
to Haml
A.W.E.S.O.M.E.

You rock, Nathan! I can't wait to test this. And I can't believe you
just implemented it on my request, and so quickly to boot!

This will make Haml even better suited for writing templates for
Textpattern, Movable Type, anything based on the Radius-parser or
something similar.
Reply all
Reply to author
Forward
0 new messages