Skip to content

Commit 67ead54

Browse files
committed
Initial dev-prototype for #137
1 parent 7b2a822 commit 67ead54

23 files changed

+1264
-57
lines changed

docs/changelog.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ License
66

77
.. include:: ../LICENSE
88

9+
0.7.0
10+
-----
11+
:Released: under development
12+
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.
16+
917
0.6.3
1018
-----
1119
:Released: under development
@@ -16,7 +24,7 @@ License
1624
(`#263 <https://github.com/useblocks/sphinxcontrib-needs/issues/263>`_)
1725
* Bugfix: CSS fix for needtable :ref:`needtable_style_row`.
1826
(`#195 <https://github.com/useblocks/sphinxcontrib-needs/issues/195>`_)
19-
* Bugfix: ``current_need` var is accessible in all need-filters.
27+
* Bugfix: ``current_need`` var is accessible in all need-filters.
2028
(`#169 <https://github.com/useblocks/sphinxcontrib-needs/issues/169>`_)
2129
* Bugfix: Sets defaults for color and style of need type configuration, if not set by user.
2230
(`#151 <https://github.com/useblocks/sphinxcontrib-needs/issues/151>`_)

docs/configuration.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,49 @@ Default: ``False``.
11011101
11021102
needs_service_all_data = True
11031103
1104+
1105+
.. _needs_external_needs:
1106+
1107+
needs_external_needs
1108+
~~~~~~~~~~~~~~~~~~~~
1109+
1110+
.. versionadded:: 0.7.0
1111+
1112+
Allows to reference and use external needs without having their representation in your own documentation.
1113+
(Unlike :ref:`needimport`, which creates need-objects from a local ``needs.json`` only).
1114+
1115+
.. code-block:: python
1116+
1117+
needs_external_needs = [
1118+
{
1119+
'base_url': 'http://mydocs/my_project',
1120+
'json_url': 'http://mydocs/my_project/needs.json',
1121+
'version': '1.0',
1122+
'id_prefix': 'ext_',
1123+
'css_class': 'external_link',
1124+
},
1125+
{
1126+
'base_url': 'http://mydocs/another_project/',
1127+
'json_url': 'http://mydocs/another_project/data/exports/needs.json',
1128+
'version': '2.5',
1129+
'id_prefix': 'other_',
1130+
'css_class': 'project_x',
1131+
}
1132+
]
1133+
1134+
``needs_external_needs`` must be a list of dictionary elements and each dictionary must/can have the following
1135+
keys:
1136+
1137+
:base_url: Base url which is used to calculate the final, specific need url. Normally the path under which the ``index.html`` is provided.
1138+
:json_url: url, which can be used to download the ``needs.json`` (or similar) file.
1139+
:version: Defines the version to use inside the ``needs.json`` file (*optional*).
1140+
:id_prefix: Prefix as string, which will be added to all id of external needs. Needed, if there is the risk that
1141+
needs from different projects may have the same id (*optional*).
1142+
:css_class: A class name as string, which gets set in link representations like :ref:`needtable`.
1143+
The related css class definition must be done by the user, e.g. by :ref:`own_css`.
1144+
(*optional*) (*default*: ``external_link``)
1145+
1146+
11041147
Removed options
11051148
---------------
11061149

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

poetry.lock

Lines changed: 18 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ sphinx = [
3939
{ version = ">2.2, <=3.0", python = "~3.6" },
4040
{ version = ">2.2, <=4.0", python = "^3.7" },
4141
]
42+
requests-file = "^1.5.1"
43+
requests = "^2.25.1"
4244

4345
[tool.poetry.dev-dependencies]
4446

@@ -64,9 +66,9 @@ line-length = 120
6466
[tool.isort]
6567
profile = "black"
6668

69+
[tool.poetry.extras]
70+
docs = ["sphinx"]
6771
[build-system]
6872
requires = ["poetry-core>=1.0.0"]
6973
build-backend = "poetry.core.masonry.api"
7074

71-
[tool.poetry.extras]
72-
docs = ["sphinx"]

sphinxcontrib/needs/api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
add_need_type,
77
get_need_types,
88
)
9-
from .need import add_need, make_hashed_id
9+
from .need import add_external_need, add_need, make_hashed_id

0 commit comments

Comments
 (0)