5.5.3 <al-setdefault>

The <al-setdefault> tag is used inside a macro definition to specify default content for a named macro argument. The content enclosed by this tag will be used if the caller does not override it with a <al-setarg> tag.

Note that only named arguments can have a default as the unnamed argument is always set, implicitly or explicitly, by the calling <al-expand> tag.

>>> import albatross
>>> ctx = albatross.SimpleContext('.')
>>> albatross.Template(ctx, '<magic>', '''
... <al-macro name="pagelayout">
...  <al-setdefault name="title">Parrot</al-setdefault>
...  <title><al-usearg name="title"></title>
... </al-macro>
... ''').to_html(ctx)
>>> albatross.Template(ctx, '<magic>', '''
... <al-expand name="pagelayout">
...  <al-setarg name="title">Lumberjack</al-setarg>
... </al-expand>''').to_html(ctx)
>>> ctx.flush_content()
<title>Lumberjack</title>
>>> albatross.Template(ctx, '<magic>', '''
... <al-expand name="pagelayout">
... </al-expand>''').to_html(ctx)
>>> ctx.flush_content()
<title>Parrot</title>



Subsections