Needs

Every need type you declare in Need types (req, spec, and any others in your needs.types) becomes a directive of the same name. ubCode renders those directives as need cards — a header, a meta table, and the need’s body — in the editor preview and in its html and pdf builds. The card in the preview, and how it fills in from the rest of the project, is described under need-card hydration.

This reference describes the Rendered preview mode; in Structural mode every directive and role renders as a uniform placeholder (see Preview modes).

These pages cover writing needs, most constructs with a live specimen in reStructuredText and in MyST, the rest as source:

  • Writing needs — the need directive: its title, id, fields, links and content, need parts, the card options, and a table of every option it takes.

  • Need roles — the roles that point at needs from running text: references to needs and need parts, need counts, and dynamic functions.

  • Need views — the directives that show the needs a filter selects: tables, lists, extracts, diagrams, charts and reports.

  • Importing and extending needs — the directives that create or change needs without a need directive: importing a needs.json, extending needs, and needs from a list.

  • Dynamic functions and filters — field values computed by dynamic functions, the filter expressions views select needs with, and Cypher queries.

Conditional needs

Like any other content, a need can be wrapped in the if directive so that it is included only for matching variants:

.. if:: var.platform == "windows"

   .. req:: Windows power management
      :id: REQ_WIN_PM

      This requirement only exists in the Windows variant.

The if directive is not specific to needs — it conditionally includes any block of content. For the full directive reference, the variant role, and variant field values, see Variants.

See also