Skip to content
Back to top
View this page
Edit this page

# needextract

Added in version 0.5.1.

`needextract` generates copies of filtered needs with custom layout and style.

It supports custom creation of extracts from existing needs. For instance, a supplier could get a copy of requirements but would not see all the internal meta-data.

Example 1

    .. feature:: A feature
       :id: EXTRACT_FEATURE_1

       This is a feature that should be extracted.

    .. needextract::
       :filter: id == 'EXTRACT_FEATURE_1'
       :layout: clean
       :style: green_border

Feature: A feature EXTRACT_FEATURE_1
This is a feature that should be extracted.

Feature: A feature EXTRACT_FEATURE_1
This is a feature that should be extracted.

Caution

`needextract` supports correct rendering of most, but not all, content coming from the original need. Be careful when using complex content in the original need, like custom roles or directives that require any sphinx transforms.

`needextract` supports the full filtering possibilities of sphinx-needs. Please read Filtering needs for more information.

It also supports arguments as filter string, which works like the option filter, but also supports need ID as filter argument.

Example 2

    .. needextract:: EXTRACT_FEATURE_1
       :layout: clean
       :style: green_border

Feature: A feature EXTRACT_FEATURE_1
This is a feature that should be extracted.

Note

arguments and option filter can’t be used at the same time.

## Options

### layout

`:layout:` overwrites the need-specific layout option and sets the same layout for each need. The original need provides the style information, if not overwritten by style.

See Layouts for a list of available layouts.

Example 3

    .. needextract:: EXTRACT_FEATURE_1
       :layout: focus_r

This is a feature that should be extracted. | EXTRACT_FEATURE_1

### style

`:style:` overwrites the need-specific style option and sets the same style for each need. The original need provides the layout information , if not overwritten by layout.

See Styles for a list of available styles.

Example 4

    .. needextract:: EXTRACT_FEATURE_1
       :style: blue_border

Feature: A feature EXTRACT_FEATURE_1
This is a feature that should be extracted.