Skip to content

title_from_content option has no effect when set via needs_global_options #918

Open
@arwedus

Description

@arwedus

Example config file section:

# Forces the user to set an ID for each need, which gets defined.
needs_id_required = True

# For selected directives below, a title is mandatory.
# For convenience, if a requirement has an empty title / heading line,
# we add option title_from_content so that the first sentence from content is used as title when we leave a title empty
# For the directives below, we add a validator via TIM that checks if the title is non-empty.
needs_global_options = {
    "title_from_content": (True, 'type=="req-sw"')
}

# For all other directives, a title is optional
needs_title_optional = True

Example output:

sphinx_title_from_content_via_global_options

NOTE: I also get some warnings like this:


/home/.../projects/docs-as-code/sphinx-examples/breathe-example/index.rst:12: ERROR: Error in "req-sw" directive:
1 argument(s) required, 0 supplied.

.. req-sw::
    :title_from_content:
    :id: REQ_CAT_0001
    :status: agreed

    Cats shall make the sound "meow" upon request.

The requirement is in this case missing from the output.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions