Template reuse: inheritance and template functions ################################################### Inheritance ----------- The layout template should be marked up with `` tags to indicate customization points: .. code:: html Default title Content goes here Child templates then use ```` to pull in the parent's layout. Template functions ------------------- You can also define reusable template functions: .. code:: html Template functions can be imported into other templates: .. code:: html

${widgets.modal(content="Hello world!")}

Notice the ``${content() if callable content else content}`` interpolation in the function body? That's to support calling the function with :ref:`py-call`, which can pass chunks of template code as keyword arguments. In this case the passed argument will be a callable, which outputs template content. .. code:: html This is the modal content. You can include markup and template directives too!