Skip to content

Commit

Permalink
Bugfix: Needs nodes get ids set directly, to avoid empty ids Bugf…
Browse files Browse the repository at this point in the history
…ix: Needs nodes get ``ids`` set directly, to avoid empty ids given by sphinx or other extensions for need-nodes. (#228)

Fixes #193
  • Loading branch information
danwos authored Apr 15, 2021
1 parent 21dc902 commit 99dac3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changelog
* Bugfix: Need-service calls get mocked during tests, so that tests don't need reachable external services anymore.
* Bugfix: No warning is thrown anymore, if :ref:`needservice` can't find a service config in ``conf.py``
(`#168 <https://github.com/useblocks/sphinxcontrib-needs/issues/168>`_)
* Bugfix: Needs nodes get ``ids`` set directly, to avoid empty ids given by sphinx or other extensions for need-nodes.
(`#193 <https://github.com/useblocks/sphinxcontrib-needs/issues/193>`_)
* Bugfix: Using correct indention for pre and post_template function of needs.


Expand Down
2 changes: 1 addition & 1 deletion sphinxcontrib/needs/api/need.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def run():
style_classes.append(style)

node_need = sphinxcontrib.needs.directives.need.Need(
'', classes=style_classes)
'', classes=style_classes, ids=[need_id])

# Render rst-based content and add it to the need-node

Expand Down
12 changes: 6 additions & 6 deletions sphinxcontrib/needs/directives/need.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ def run(self):
for extra_option in env.config.needs_extra_options.keys():
need_extra_options[extra_option] = self.options.get(extra_option, '')

return add_need(env.app, self.state, self.docname, self.lineno,
need_type=self.name, title=self.trimmed_title, id=id, content=content,
status=status, tags=tags,
hide=hide, template=template, pre_template=pre_template, post_template=post_template,
collapse=collapse, style=style, layout=layout, **need_extra_options)
need_nodes = add_need(env.app, self.state, self.docname, self.lineno,
need_type=self.name, title=self.trimmed_title, id=id, content=content,
status=status, tags=tags,
hide=hide, template=template, pre_template=pre_template, post_template=post_template,
collapse=collapse, style=style, layout=layout, **need_extra_options)
return need_nodes

def read_in_links(self, name):
# Get links
Expand All @@ -132,7 +133,6 @@ def read_in_links(self, name):
else:
links.append(link.strip())


# This may have cut also dynamic function strings, as they can contain , as well.
# So let put them together again
# ToDo: There may be a smart regex for the splitting. This would avoid this mess of code...
Expand Down

0 comments on commit 99dac3d

Please sign in to comment.