needtable

New in version 0.2.0.

needtable generates a table, based on the result of given filters.

.. needtable::
   :tags: main_example
   :style: table
ID Title Status Outgoing
S_503A1 → Spec for a requirement done req_001
req_001 → My first requirement

Options

Note

needtable supports the full filtering possibilities of sphinx-needs. Please see Filtering needs for more information.

Supported options:

columns

Needs a comma/semicolon separated string, which is used to define the position of specific columns. For instance:

.. needtable::
   :columns: id;title;tags

This will show the columns id, title and tags in the given order.

Show example
.. needtable::
   :columns: id;title;tags
ID Title Tags
T_C3893 → Test for XY test; user_interface; python27
R_F4722 → My first requirement requirement; test; awesome

Supported columns are:

  • id
  • title
  • type
  • status
  • tags
  • incoming
  • outgoing

If :columns: is set, the value of config parameter needs_table_columns is not used for the current table.

show_filters

If set, the used filter is added in front of the table:

.. needtable::
   :show_filters:
Show example
.. needtable::
   :tags: test
   :show_filters:

Used filter: tags(test)

ID Title Tags
T_C3893 → Test for XY test; user_interface; python27
R_F4722 → My first requirement requirement; test; awesome

style

Allows to set a specific style for the current table.

Supported values are:

  • table
  • datatables

Overrides config parameter needs_table_style if set.

Show example
.. needtable::
   :style: table

.. needtable::
   :style: datatables

Table with :style: table:

ID Title Status Outgoing
R_F4722 → My first requirement open

Table with :style: datatables:

ID Title Status Outgoing
R_F4722 → My first requirement open

show_parts

New in version 0.3.6.

Adds an extra table row for each need_part / np found inside a filtered need.

The part rows are added directly under the related need rows and their id and title get a prefix.

To change the prefix please read needs_part_prefix.

ID Title Outgoing Incoming
table_001 → Test need with need parts table_002; table_003
→ table_001.1 →  Part 1 of requirement table_002
→ table_001.3 →  Part 3 of requirement
→ table_001.2 →  Part 2 of requirement table_003
table_002 → Specifies part 1 table_001.1
table_003 → Specifies part 2 table_001.2
→ table_001.1 →  Part 1 of requirement table_002
→ table_001.3 →  Part 3 of requirement
→ table_001.2 →  Part 2 of requirement table_003
Show example configuration
.. req:: Test need with need parts
   :id: table_001

   :np:`(1) Part 1 of requirement`.

   :np:`(2) Part 2 of requirement`.

   :np:`(3) Part 3 of requirement`.

.. spec:: Specifies part 1
   :id: table_002
   :links: table_001.1

.. spec:: Specifies part 2
   :id: table_003
   :links: table_001.2

.. needtable::
   :show_parts:
   :columns: id;title;outgoing;incoming
   :style: table
Requirement: Test need with need parts table_001
tags: test_table

Part 1 of requirement 1.

Part 2 of requirement 2.

Part 3 of requirement 3.

Specification: Specifies part 1 table_002
tags: test_table
Specification: Specifies part 2 table_003
tags: test_table