Macro arguments can also be derived by evaluating a python expression. Attributes of the <al-expand> tag that end in argexpr are evaluated, and the base name becomes the macro argument of that name.
For example:
<al-expand name="pagelayout" titleargexpr="foo" />
is functionally equivilent to:
<al-expand name="pagelayout"> <al-setarg name="title"><al-value expr="foo"></al-setarg> </al-expand>
For a more complete example:
>>> import albatross >>> ctx = albatross.SimpleContext('.') >>> ctx.locals.title = 'Lumberjack' >>> albatross.Template(ctx, '<magic>', ''' ... <al-macro name="pagelayout"> ... <title><al-usearg name="title"></title> ... </al-macro> ... ''').to_html(ctx) >>> albatross.Template(ctx, '<magic>', ''' ... <al-expand name="pagelayout" titleargexpr="title" />''').to_html(ctx) >>> ctx.flush_content() <title>Lumberjack</title> >>> albatross.Template(ctx, '<magic>', ''' ... <al-expand name="pagelayout"> ... <al-setarg name="title"><al-value expr="title"></al-setarg> ... </al-expand>''').to_html(ctx) >>> ctx.flush_content() <title>Lumberjack</title>