melexis / sphinx-traceability-extension

Traceability extension for Sphinx documentation generator
GNU General Public License v3.0
25 stars 9 forks source link

Decouple item/attribute presentation from content #370

Open gcrabbe opened 7 months ago

gcrabbe commented 7 months ago

Currently, items (and attributes) are defined and rendered through the same directive, item (respectively, item-attribute, although the latter is just for the description).

I would like to be able to re-render existing items by reference in multiple locations. These referenced items could have a distinct visual style from the "canonical" definition (e.g. green instead of blue), but should otherwise be identical to the real deal.

I'm almost able to do so through item-list:

.. item-list::
    :filter: RQT-
    :showcontents:

But the resulting render is quite different (no relationships, for starters).

I propose to add an item-render directive (alternative names: item-display, item-present, item-reference) with a similar syntax to item-list that generates "full-fat" renders of matching items:

.. item-render:: <regex>
    :<attribute>: <attribute-value>

Attributes could have a similar attribute-render (item-attribute-render?) directive.

This decoupling could eventually allow importing item definitions from external sources, such as a (yet to be defined) JSON importer, and describing attributes directly in conf.py, alongside their definition.