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.
18 When using a template, copy the directory in `doc/docs/templates/`,
19 to your <repo>/docs/ directory in your repository.
20 For instance if you want to document component-info, then your steps shall be
25 git clone ssh://<your_id>@gerrit.onap.org:29418/doc
26 cp -p doc/docs/templates/component-info <your_repo>/docs/component-info/
29 You should then add the relevant information to the template.
30 When you are done writing, you can commit
31 the documentation to the your project repository.
32 The sequence below shows basic git/gerrit steps,
33 see `Developer Best Practices`_ for complete current information.
35 .. _Developer Best Practices: https://wiki.onap.org/x/BZZk
40 git commit --signoff --all
43 In the ONAP doc Repository
44 --------------------------
46 To import project documents from project repositories, we use git submodules.
47 Each ONAP project providing documentation, other than the doc project, is loaded under
48 `doc/docs/submodules/` when needed for validating or publishing documentation.
49 To describe the relationship between content files we use the `Sphinx toctree directive`.
51 The following diagram illustrates:
52 - all ONAP gerrit project repositories,
53 - the doc project repository including a master document index.rst,
54 - other document directories and/or RST files that organize sections and documents doc repository,
55 - the submodules directory where other project repositories and directories/files may be referenced,
56 - the templates directory with one example, a component-info template that may referenced in release orhigh level design documents, and
57 - another project repository example, `appc` that provides documentation source by copying and filling in an instance of the component-info template.
63 digraph docstructure {
65 node [fontname = "helvetica"];
66 // Align gerrit repos and docs directories
67 {rank=same doc aaf aai appc repoelipse vnfsdk vvp}
68 {rank=same componentinfotemplate localappcdocs }
70 //Show submodule linkage to docs directory
71 submodules -> localappcdocs [style=dotted];
73 //Illustrate Gerrit Repos and provide URL/Link for complete repo list
74 gerrit [label="gerrit.onap.org/r", href="https://gerrit.onap.org/r/#/admin/projects/" ];
79 gerrit -> repoelipse; repoelipse [label=". . . ."];
83 //Show example of local appc instance of component info
84 appc -> localappcdocs; localappcdocs [label="docs"];
85 localappcdocs -> componentinfoinstance; componentinfoinstance [label="component-info"];
86 componentinfoinstance -> compinfoindexinstance; compinfoindexinstance [label="index.rst", shape=box];
87 componentinfoinstance -> compinofotherinstance; compinofotherinstance [label="... other sections", shape=box];
89 //Show detail structure of a portion of doc/docs _images _static _templates multiple master documents omitted
91 docs -> confpy; confpy [label="conf.py",shape=box];
92 docs -> toplevelindex; toplevelindex [label="index.rst", shape=box];
94 docs -> rsttemplates; rsttemplates [label="templates"];
95 docs -> indexdirelipse; indexdirelipse [label="...other\ndocuments"];
98 //Example Release document, section release notes, and reference to an instance of component-info
99 release -> releasenotes; releasenotes [label="release-notes"];
100 releasenotes -> lowerlevelindex; lowerlevelindex [label="index.rst", shape=box];
101 lowerlevelindex -> componentinfoinstance;
103 //Example component-info template
104 rsttemplates -> componentinfotemplate; componentinfotemplate [label="component-info"];
105 componentinfotemplate -> compinfotmpindex; compinfotmpindex [label="index.rst", shape=box];
106 componentinfotemplate -> compinfotmpother; compinfotmpother [label="... other sections", shape=box];
112 To include your project specific documentation in the composite documentation,
113 first identify where your project documentation should be included.
114 Say your project provides component-info and should be referenced in the `doc/docs/release/release-info/index.rst toctree`, then:
118 git clone ssh://<your_id>@gerrit.onap.org:29418/doc
119 vim doc/docs/release/release-notes/index.rst
121 This opens the text editor. Identify where you want to add your release notes.
122 If your release notes are to be added to the toctree, simply include the path to
131 ../../submodules/<your_repo>/docs/component-info/index
133 When finished, you can request a commit to the doc project repository.
134 Be sure to add the PTL of the docs project as a reviewer of the change you just
140 git commit --signoff --all
147 It's pretty common to want to reference another location in the
148 ONAP documentation and it's pretty easy to do with
149 reStructuredText. This is a quick primer, more information is in the
150 `Sphinx section on Cross-referencing arbitrary locations
151 <http://www.sphinx-doc.org/en/stable/markup/inline.html#ref-role>`_.
153 Within a single document, you can reference another section simply by::
155 This is a reference to `The title of a section`_
157 Assuming that somewhere else in the same file there a is a section
158 title something like::
160 The title of a section
161 ^^^^^^^^^^^^^^^^^^^^^^
163 It's typically better to use ``:ref:`` syntax and labels to provide
164 links as they work across files and are resilient to sections being
165 renamed. First, you need to create a label something like::
169 The title of a section
170 ^^^^^^^^^^^^^^^^^^^^^^
172 .. note:: The underscore (_) before the label is required.
174 Then you can reference the section anywhere by simply doing::
176 This is a reference to :ref:`a-label`
180 This is a reference to :ref:`a section I really liked <a-label>`
182 .. note:: When using ``:ref:``-style links, you don't need a trailing
185 Because the labels have to be unique, it usually makes sense to prefix
186 the labels with the project name to help share the label space, e.g.,
187 ``sfc-user-guide`` instead of just ``user-guide``.
192 It is recommended that all rst content is validated by `doc8 <https://pypi.python.org/pypi/doc8>`_ standards.
193 To validate your rst files using doc8, install doc8.
197 sudo pip install doc8
199 doc8 can now be used to check the rst files. Execute as,
203 doc8 --ignore D000,D001 <file>
206 Testing: Build Documentation Locally
207 ------------------------------------
209 Composite DOC documentation
210 +++++++++++++++++++++++++++++++++
211 To build the whole documentation under doc/, follow these steps:
213 Install virtual environment.
217 sudo pip install virtualenv
218 cd /local/repo/path/to/project
220 Download the DOC repository.
224 git clone http://gerrit.onap.org/r/doc
226 Change directory to docs & install requirements.
231 sudo pip install -r etc/requirements.txt
233 Update submodules, build documentation using tox & then open using any browser.
238 git submodule update --init
240 firefox docs/_build/html/index.html
242 .. note:: Make sure to run `tox -edocs` and not just `tox`.
244 Individual project documentation
245 ++++++++++++++++++++++++++++++++
246 To test how the documentation renders in HTML, follow these steps:
248 Install virtual environment.
252 sudo pip install virtualenv
253 cd /local/repo/path/to/project
255 Download the doc repository.
259 git clone http://gerrit.onap.org/r/doc
261 Change directory to doc & install requirements.
266 sudo pip install -r etc/requirements.txt
268 Move the conf.py file to your project folder where RST files have been kept:
272 mv doc/docs/conf.py <path-to-your-folder>/
274 Move the static files to your project folder:
278 mv docs/_static/ <path-to-your-folder>/
280 Build the documentation from within your project folder:
284 sphinx-build -b html <path-to-your-folder> <path-to-output-folder>
286 Your documentation shall be built as HTML inside the
287 specified output folder directory.
289 .. 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.
292 Adding your project repository as a submodule
293 ---------------------------------------------
295 Clone the doc repository and add your submodule using the commands below and where $reponame is your repository name.
300 git submodule git https://gerrit.onap.org/r/$reponame
301 git submodule init $reponame/
302 git submodule update $reponame/