Fragment ======== Base class: :doc:`Part` .. _Fragment: `Fragment` is a class used to build small HTML fragments that plug into iommi's structure. .. code-block:: python h1 = Fragment(children__text='Tony', tag='h1') # There is also a shorthand version that is identical to the above: h1 = Fragment('Tony', tag='h1') It's easiest to use via the html builder: .. code-block:: python h1 = html.h1('Tony') Fragments are useful because attrs, template and tag are evaluated, so if you have a `Page` with a fragment in it you can configure it later: .. code-block:: python class MyPage(Page): header = html.h1( 'Hi!', attrs__class__staff= lambda request, **_: request.user.is_staff, ) Rendering a `MyPage` will result in a `

`, but if you do `MyPage(parts__header__tag='h2')` it will be rendered with a `

`. Refinable members ----------------- `after`     (:ref:`evaluated `) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type: `int | str` See :ref:`after ` `assets` ^^^^^^^^ Type: `Namespace` See :ref:`assets ` `attrs`     (:ref:`evaluated `) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type: :doc:`Attrs` See :ref:`attributes ` `children` ^^^^^^^^^^ Cookbook: :ref:`override-part-of-page` `endpoints` ^^^^^^^^^^^ Type: `Namespace` See :ref:`endpoints ` `extra` ^^^^^^^ Type: `dict[str, Any]` See :ref:`extra ` `extra_evaluated` ^^^^^^^^^^^^^^^^^ Type: `dict[str, Any]` See :ref:`extra ` `extra_params` ^^^^^^^^^^^^^^ See :ref:`extra_params ` `include`     (:ref:`evaluated `) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type: `bool` See :ref:`include ` `iommi_style` ^^^^^^^^^^^^^ Type: `str | Style | None` See :ref:`iommi_style ` `tag`     (:ref:`evaluated `) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ See :ref:`tag ` `template`     (:ref:`evaluated `) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type: `str | Template` See :ref:`template