Skip to content

Commit 956ab54

Browse files
authored
External needs (#270)
* Initial dev-prototype for #137 * bugfix: need_incoming and need_outgoing working * refactoring * Poetry update * Bugifx and tests for external_need handling * Calculated link gets .html file extension after docname * Tests are updated to really check data Fixes #137
1 parent fa59ff8 commit 956ab54

24 files changed

+1508
-373
lines changed

docs/changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ License
1010
-----
1111
:Released: under development
1212

13+
* Improvement: Providing :ref:`needs_external_needs` to allow usage and referencing of external needs.
14+
(`#137 <https://github.com/useblocks/sphinxcontrib-needs/issues/137>`_)
15+
* Bugfix: :ref:`needtable` shows attributes with value ``False`` again.
1316
* Bugfix: ``:hide:`` and ``:collapse: True`` are working inside :ref:`needimport`.
1417
(`#284 <https://github.com/useblocks/sphinxcontrib-needs/issues/284>`_,
1518
`#294 <https://github.com/useblocks/sphinxcontrib-needs/issues/294>`_)

docs/configuration.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,49 @@ Default: ``False``.
11421142
11431143
needs_service_all_data = True
11441144
1145+
1146+
.. _needs_external_needs:
1147+
1148+
needs_external_needs
1149+
~~~~~~~~~~~~~~~~~~~~
1150+
1151+
.. versionadded:: 0.7.0
1152+
1153+
Allows to reference and use external needs without having their representation in your own documentation.
1154+
(Unlike :ref:`needimport`, which creates need-objects from a local ``needs.json`` only).
1155+
1156+
.. code-block:: python
1157+
1158+
needs_external_needs = [
1159+
{
1160+
'base_url': 'http://mydocs/my_project',
1161+
'json_url': 'http://mydocs/my_project/needs.json',
1162+
'version': '1.0',
1163+
'id_prefix': 'ext_',
1164+
'css_class': 'external_link',
1165+
},
1166+
{
1167+
'base_url': 'http://mydocs/another_project/',
1168+
'json_url': 'http://mydocs/another_project/data/exports/needs.json',
1169+
'version': '2.5',
1170+
'id_prefix': 'other_',
1171+
'css_class': 'project_x',
1172+
}
1173+
]
1174+
1175+
``needs_external_needs`` must be a list of dictionary elements and each dictionary must/can have the following
1176+
keys:
1177+
1178+
:base_url: Base url which is used to calculate the final, specific need url. Normally the path under which the ``index.html`` is provided.
1179+
:json_url: url, which can be used to download the ``needs.json`` (or similar) file.
1180+
:version: Defines the version to use inside the ``needs.json`` file (*optional*).
1181+
:id_prefix: Prefix as string, which will be added to all id of external needs. Needed, if there is the risk that
1182+
needs from different projects may have the same id (*optional*).
1183+
:css_class: A class name as string, which gets set in link representations like :ref:`needtable`.
1184+
The related css class definition must be done by the user, e.g. by :ref:`own_css`.
1185+
(*optional*) (*default*: ``external_link``)
1186+
1187+
11451188
Removed options
11461189
---------------
11471190

docs/layout_styles.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@ Sphinx-needs provides the following css styles:
528528

529529
.. image:: _static/need_dark.png
530530

531+
.. _own_css:
532+
531533
Own CSS file on sphinx level
532534
++++++++++++++++++++++++++++
533535

0 commit comments

Comments
 (0)