Add support for sphinx NEEDS Directive 15/56315/1
authorRich Bennett <rb2745@att.com>
Thu, 12 Jul 2018 20:23:19 +0000 (16:23 -0400)
committerRich Bennett <rb2745@att.com>
Thu, 12 Jul 2018 20:27:27 +0000 (16:27 -0400)
Add configuration, pip requirements, and conventiions for use

Change-Id: Ia065b7f72fc5aa16b4010b0100dc70e2f0a42b8c
Issue-ID: DOC-285
Signed-off-by: Rich Bennett <rb2745@att.com>
docs/conf.py
docs/guides/onap-developer/how-to-use-docs/style-guide.rst
etc/requirements.txt

index 815d0d0..f81a78b 100644 (file)
@@ -38,6 +38,7 @@ extensions = [
     'sphinx.ext.imgmath',
     'sphinx.ext.viewcode',
     'sphinxcontrib.blockdiag',
+    'sphinxcontrib.needs',
     'sphinxcontrib.nwdiag',
     'sphinxcontrib.seqdiag',
     'sphinx.ext.ifconfig',
@@ -426,3 +427,64 @@ linkcheck_ignore = [
        r'https://we-are-data-router.us',
        r'https://we-are-message-router.us:\d+/'
        ]
+
+from docutils.parsers.rst import directives
+
+needs_extra_options = {
+    "target": directives.unchanged,
+    "keyword": directives.unchanged,
+    "introduced": directives.unchanged,
+    "updated": directives.unchanged,
+    "impacts": directives.unchanged,
+    "validation_mode": directives.unchanged,
+    "validated_by": directives.unchanged,
+    "test": directives.unchanged,
+    "test_case": directives.unchanged,
+    "test_file": directives.unchanged,
+    "notes": directives.unchanged,
+}
+
+needs_id_regex = "^[A-Z0-9]+-[A-Z0-9]+"
+needs_id_required = True
+needs_title_optional = True
+
+needs_template_collapse = """
+.. _{{id}}:
+
+{% if hide == false -%}
+.. role:: needs_tag
+.. role:: needs_status
+.. role:: needs_type
+.. role:: needs_id
+.. role:: needs_title
+
+.. rst-class:: need
+.. rst-class:: need_{{type_name}}
+
+.. container:: need
+
+    `{{id}}` - {{content|indent(4)}}
+
+    .. container:: toggle
+
+        .. container:: header
+
+            Details
+
+{% if status and  status|upper != "NONE" and not hide_status %}        | status: :needs_status:`{{status}}`{% endif %}
+{% if tags and not hide_tags %}        | tags: :needs_tag:`{{tags|join("` :needs_tag:`")}}`{% endif %}
+{% if keyword %}        | keyword: `{{keyword}}` {% endif %}
+{% if target %}        | target: `{{target}}` {% endif %}
+{% if introduced %}        | introduced: `{{introduced}}` {% endif %}
+{% if updated %}        | updated: `{{updated}}` {% endif %}
+{% if impacts %}        | impacts: `{{impacts}}` {% endif %}
+{% if validation_mode %}        | validation mode: `{{validation_mode}}` {% endif %}
+{% if validated_by %}        | validated by: `{{validated_by}}` {% endif %}
+{% if test %}        | test: `{{test}}` {% endif %}
+{% if test_case %}        | test case: {{test_case}} {% endif %}
+{% if test_file %}        | test file: `{{test_file}}` {% endif %}
+{% if notes %}        | notes: `{{notes}}` {% endif %}
+        | children: :need_incoming:`{{id}}`
+        | parents: :need_outgoing:`{{id}}`
+{% endif -%}
+"""
index 74fc261..3246885 100644 (file)
@@ -118,3 +118,27 @@ Tasks
 
 -  Break down end-to-end tasks into manageable chunks.
 
+
+ONAP Conventions for the Use of Sphinx Directives
+-------------------------------------------------
+
+Needs Directive
+^^^^^^^^^^^^^^^
+
+ * Needs IDs must match the regular expression "^[A-Z0-9]+-[A-Z0-9]+"
+
+ * The prefix (string before the dash) must be described in the following table
+
+.. list-table:: Needs Prefix Use
+   :align: center
+   :widths: 8 40 40
+   :header-rows: 1
+
+   * - Prefix
+     - Description
+     - Use
+
+   * - R
+     - Represents a requirement that must be met by a VNF provider
+     - Defined only in the vnfrqts project repositories, may be referenced in any project repository source
+
index 4b86791..8e2894c 100644 (file)
@@ -6,6 +6,7 @@ setuptools
 six
 sphinx_rtd_theme
 sphinxcontrib-blockdiag
+sphinxcontrib-needs>=0.2.3
 sphinxcontrib-nwdiag
 sphinxcontrib-seqdiag
 sphinxcontrib-swaggerdoc