[albatross-users] Macro default args

Gregory Bond gnb at itga.com.au
Wed Jan 15 14:39:41 EST 2003


By the way:

I'd love to be able to do 
	<al-expand name="box" color="red">Error!!</al-expand>
instead of
	<al-expand name="box"><al-setarg name="color">red</al-setarg>Error!!</al-expand>

(i.e. put macro args in the al-expand tag.)   Again, only useful for small
amounts of argument text, but much neater.  Some hackery in Expand.to_html 
should do it (see below).  This only allows plain text substitutions (no 
nested <al-value> etc), but will still work with the <al-setarg> which is 
better for longer or more complicated macro text.

What do people think?


-------------- next part --------------
--- albatross/tags.py.DIST1	Wed Jan 15 14:33:07 2003
+++ albatross/tags.py	Wed Jan 15 14:35:51 2003
@@ -1100,6 +1100,9 @@
         if not macro:
             self.raise_error('undefined macro "%s"' % self.get_attrib('name'))
         dict = {}
+	for k, v in self.attrib_items():
+	    if k != 'name':
+	    	dict[k] = v
         ctx.push_content_trap()
         self.content.to_html(ctx)
         dict[None] = ctx.pop_content_trap()


More information about the Albatross-users mailing list