1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
3 .. _include-documentation:
5 ============================
6 Including your Documentation
7 ============================
13 In your project repository
14 --------------------------
16 Add your documentation to your repository in the folder structure and
17 using templates as described above. The documentation templates
18 are available in `doc/docs/templates/`, you should
19 copy the relevant templates to your <repo>/docs/ directory in your repository.
20 For instance if you want to document release-notes, then your steps shall be
25 git clone ssh://<your_id>@gerrit.onap.org:29418/doc
26 cp -p doc/docs/templates/release-notes <your_repo>/docs/release-notes/
29 You should then add the relevant information to the template that will
30 explain the documentation. When you are done writing, you can commit
31 the documentation to the your project repository.
36 git commit --signoff --all
39 In the ONAP doc Repository
40 --------------------------
42 To import project documents from project repositories, we use git submodules.
43 Each ONAP project providing documentation, other than the doc project, is loaded under `doc/docs/submodules/`
44 when needed for validating or publishing documentation. To describe the relationship between content files
45 we use the `Sphinx toctree directive`.
47 The following diagram illustrates:
48 - all ONAP gerrit project repositories,
49 - the doc project repository including a main index.rst,
50 - other master document directories and/or RST files that may be created to organize sections and documents,
51 - the submodules directory where other repositories and directories/files may be referenced,
52 - the templates directory with one example, a release-notes template, and
53 - another project repository `appc` that provides documentation source by copying and filling in an instance of the release-notes template.
59 digraph docstructure {
61 node [fontname = "helvetica"];
62 // Align gerrit repos and docs directories
63 {rank=same doc aaf aai appc repoelipse vnfsdk vvp}
64 {rank=same releasenotestemplate localappcdocs }
66 //Show submodule linkage to docs directory
67 submodules -> localappcdocs [style=dotted];
69 //Illustrate Gerrit Repos and provide URL/Link for complete repo list
70 gerrit [label="gerrit.onap.org/r", href="https://gerrit.onap.org/r/#/admin/projects/" ];
75 gerrit -> repoelipse; repoelipse [label=". . . ."];
79 //Show example of local appc instance release notes
80 appc -> localappcdocs; localappcdocs [label="docs"];
81 localappcdocs -> releasenotesinstance; releasenotesinstance [label="release-notes"];
82 releasenotesinstance -> relnoteindexinstance; relnoteindexinstance [label="index.rst", shape=box];
83 releasenotesinstance -> relnoteotherinstance; relnoteotherinstance [label="... other sections", shape=box];
85 //Show detail structure of a portion of doc/docs _images _static _templates multiple master documents omitted
87 docs -> confpy; confpy [label="conf.py",shape=box];
88 docs -> toplevelindex; toplevelindex [label="index.rst", shape=box];
90 docs -> rsttemplates; rsttemplates [label="templates"];
91 docs -> indexdirelipse; indexdirelipse [label="...other\ndocuments"];
94 //Example Release notes document
95 release -> releasenotes; releasenotes [label="release-notes"];
96 releasenotes -> lowerlevelindex; lowerlevelindex [label="index.rst", shape=box];
98 //Example release-notes template
99 rsttemplates -> releasenotestemplate; releasenotestemplate [label="release-notes"];
100 releasenotestemplate -> relnoteindex; relnoteindex [label="index.rst", shape=box];
101 releasenotestemplate -> relnoteother; relnoteother [label="... other sections", shape=box];
107 To include your project specific documentation in the composite documentation,
108 first identify where your project documentation should be included.
109 Say your project provides release-notes and should be referenced in the `doc/docs/release/release-notes/index.rst toctree`, then:
113 git clone ssh://<your_id>@gerrit.onap.org:29418/doc
114 vim doc/docs/release/release-notes/index.rst
116 This opens the text editor. Identify where you want to add your release notes.
117 If your release notes are to be added to the toctree, simply include the path to
126 ../../submodules/<your_repo>/docs/release-notes/index
128 When finished, you can request a commit to the doc project repository.
129 Be sure to add the project leader of the docs project as a reviewr of the change you just pushed in gerrit.
134 git commit --signoff --all
141 It's pretty common to want to reference another location in the
142 ONAP documentation and it's pretty easy to do with
143 reStructuredText. This is a quick primer, more information is in the
144 `Sphinx section on Cross-referencing arbitrary locations
145 <http://www.sphinx-doc.org/en/stable/markup/inline.html#ref-role>`_.
147 Within a single document, you can reference another section simply by::
149 This is a reference to `The title of a section`_
151 Assuming that somewhere else in the same file there a is a section
152 title something like::
154 The title of a section
155 ^^^^^^^^^^^^^^^^^^^^^^
157 It's typically better to use ``:ref:`` syntax and labels to provide
158 links as they work across files and are resilient to sections being
159 renamed. First, you need to create a label something like::
163 The title of a section
164 ^^^^^^^^^^^^^^^^^^^^^^
166 .. note:: The underscore (_) before the label is required.
168 Then you can reference the section anywhere by simply doing::
170 This is a reference to :ref:`a-label`
174 This is a reference to :ref:`a section I really liked <a-label>`
176 .. note:: When using ``:ref:``-style links, you don't need a trailing
179 Because the labels have to be unique, it usually makes sense to prefix
180 the labels with the project name to help share the label space, e.g.,
181 ``sfc-user-guide`` instead of just ``user-guide``.
186 It is recommended that all rst content is validated by `doc8 <https://pypi.python.org/pypi/doc8>`_ standards.
187 To validate your rst files using doc8, install doc8.
191 sudo pip install doc8
193 doc8 can now be used to check the rst files. Execute as,
197 doc8 --ignore D000,D001 <file>
200 Testing: Build Documentation Locally
201 ------------------------------------
203 Composite DOC documentation
204 +++++++++++++++++++++++++++++++++
205 To build the whole documentation under doc/, follow these steps:
207 Install virtual environment.
211 sudo pip install virtualenv
212 cd /local/repo/path/to/project
214 Download the DOC repository.
218 git clone http://gerrit.onap.org/r/doc
220 Change directory to docs & install requirements.
225 sudo pip install -r etc/requirements.txt
227 Update submodules, build documentation using tox & then open using any browser.
232 git submodule update --init
234 firefox docs/_build/html/index.html
236 .. note:: Make sure to run `tox -edocs` and not just `tox`.
238 Individual project documentation
239 ++++++++++++++++++++++++++++++++
240 To test how the documentation renders in HTML, follow these steps:
242 Install virtual environment.
246 sudo pip install virtualenv
247 cd /local/repo/path/to/project
249 Download the doc repository.
253 git clone http://gerrit.onap.org/r/doc
255 Change directory to doc & install requirements.
260 sudo pip install -r etc/requirements.txt
262 Move the conf.py file to your project folder where RST files have been kept:
266 mv doc/docs/conf.py <path-to-your-folder>/
268 Move the static files to your project folder:
272 mv docs/_static/ <path-to-your-folder>/
274 Build the documentation from within your project folder:
278 sphinx-build -b html <path-to-your-folder> <path-to-output-folder>
280 Your documentation shall be built as HTML inside the
281 specified output folder directory.
283 .. note:: Be sure to remove the `conf.py`, the static/ files and the output folder from the `<project>/docs/`. This is for testing only. Only commit the rst files and related content.
286 Adding your project repository as a submodule
287 ---------------------------------------------
289 Clone the doc repository and add your submodule using the commands below and where $reponame is your repository name.
294 git submodule git https://gerrit.onap.org/r/$reponame
295 git submodule init $reponame/
296 git submodule update $reponame/