1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
6 Some initial steps are required to connect a project with
7 the master document structure and enable automated publishing of
8 changes as summarized in the following diagram and described detail
14 RD [label = "Read The Docs", color =lightgreen ];
15 DA [label = "Doc Project\nAuthor/Committer", color=lightblue];
16 DR [label = "Doc Gerrit Repo" , color=pink];
17 PR [label = "Other Project\nGerrit Repo", color=pink ];
18 PA [label = "Other Project\nAuthor/Committer", color=lightblue];
20 === One time setup doc project only ===
21 RD -> DA [label = "Account Setup" ];
22 DA -> DR [label = "Create initial\nrepository content"];
23 DA <<-- DR [label = "Merged" ];
24 RD <-- DA [label = "Connect gerrit.onap.org" ];
25 === For each project & repository containing document source ===
26 DA -> PR [label = "Other Project Contribution to Setup\ndocs directory, index, other initial content" ];
27 PR <-- PA [label = "Review/Merge Change" ];
28 DA <-- PR [label = "Change Merged" ];
29 DA -> DR [label = "Add Other Project Repo as\nGit submodule in doc project" ];
30 DA <-- DR [label = "Change Merged" ];
37 These steps are performed only once for the doc project and include:
39 (1) creating in the doc repository an initial:
40 - sphinx master document index
41 - directory structure aligned with the document structure
42 - set of test performed in jenkins verify jobs
43 - configuration for sphinx plugins and redendering of content
45 (2) establishing an account at readthedocs connected with gerrit.onap.org
48 Setup other project(s)
49 ----------------------
50 These steps are performed for each new project repo (referred to in the
51 next three code blocks as $newreponame) the master document
52 in doc repository references and include:
54 (1) clone, modify, and commit to the other project an initial: docs top
55 level directory; index.rst; any other intial content.
59 git clone ssh://<your_id>@gerrit.onap.org:29418/$newreponame
62 echo ".. This work is licensed under a Creative Commons Attribution 4.0 International License.
73 git commit -m "Add RST docs directory and index" -s
75 # modify the commit message to comply with ONAP best practices
78 When the above commit is reviewed and merged complete step 2 before any
79 new changes are merged into $newreponame.
81 (2) clone, modify, and commit to the doc project: a directory under doc/docs/submodules with the same path/name as the other project and initialized as a git submodule.
85 git clone ssh://<your_id>@gerrit.onap.org:29418/doc
86 # For top level repositories use the following
87 mkdir doc/docs/submodules/$reponame
88 # For lower level repositories you may need to make a directory for each node in path
90 echo "../submodules/$newreponame/index.rst" >> docs/release/index.rst
91 cd doc/docs/submodules/$reponame
93 git submodule git https://gerrit.onap.org/r/$reponame
94 git submodule init $reponame/
95 git submodule update $reponame/
99 git commit -m "Add $newreponame as asubmodule" -s
101 # modify the commit message to comply with ONAP best practices
106 The diagram below illustrates what is accomplished in the setup steps
107 above from the perspective of a file structure created for local test,
108 jenkins verify job, and/or merge/publish documentation including:
110 - all ONAP gerrit project repositories,
111 - the doc project repository including a master document index.rst, templates, configuration
112 - the submodules directory where other project repositories and directories/files may be referenced
113 - newreponame project repository being added and integrated.
119 digraph docstructure {
121 node [fontname = "helvetica"];
122 // Align gerrit repos and docs directories
123 {rank=same doc aaf aai newreponame repoelipse vnfsdk vvp}
124 {rank=same confpy release templates masterindex submodules otherdocdocumentelipse}
127 //Illustrate Gerrit Repos and provide URL/Link for complete repo list
128 gerrit [label="gerrit.onap.org/r", href="https://gerrit.onap.org/r/#/admin/projects/" ];
132 gerrit -> newreponame;
133 gerrit -> repoelipse;
134 repoelipse [label=". . . ."];
138 //Show example of local newreponame instance of component info
139 newreponame -> newreponamedocsdir;
140 newreponamesm -> newreponamedocsdir;
141 newreponamedocsdir [label="docs"];
142 newreponamedocsdir -> newrepodocsdirindex;
143 newrepodocsdirindex [label="index.rst", shape=box];
145 //Show detail structure of a portion of doc/docs
148 confpy [label="conf.py",shape=box];
150 masterindex [label="Master index.rst", shape=box];
153 docs -> otherdocdocumentelipse;
154 otherdocdocumentelipse [label="...other\ndocuments"];
157 masterindex -> releasedocumentindex [style=dashed, label="sphinx\ntoctree\nreference"];
159 //Show submodule linkage to docs directory
160 submodules -> newreponamesm [style=dotted,label="git\nsubmodule\nreference"];
161 newreponamesm [label="newreponame"];
163 //Example Release document index that references component info provided in other project repo
164 release -> releasedocumentindex;
165 releasedocumentindex [label="index.rst", shape=box];
166 releasedocumentindex -> newrepodocsdirindex [style=dashed, label="sphinx\ntoctree\nreference"];
170 THE FOLLOWING SECTION NEEDS TO BE CONSOLIDATED / UPDATED
176 It's pretty common to want to reference another location in the
177 ONAP documentation and it's pretty easy to do with
178 reStructuredText. This is a quick primer, more information is in the
179 `Sphinx section on Cross-referencing arbitrary locations
180 <http://www.sphinx-doc.org/en/stable/markup/inline.html#ref-role>`_.
182 Within a single document, you can reference another section simply by::
184 This is a reference to `The title of a section`_
186 Assuming that somewhere else in the same file there a is a section
187 title something like::
189 The title of a section
190 ^^^^^^^^^^^^^^^^^^^^^^
192 It's typically better to use ``:ref:`` syntax and labels to provide
193 links as they work across files and are resilient to sections being
194 renamed. First, you need to create a label something like::
198 The title of a section
199 ^^^^^^^^^^^^^^^^^^^^^^
201 .. note:: The underscore (_) before the label is required.
203 Then you can reference the section anywhere by simply doing::
205 This is a reference to :ref:`a-label`
209 This is a reference to :ref:`a section I really liked <a-label>`
211 .. note:: When using ``:ref:``-style links, you don't need a trailing
214 Because the labels have to be unique, it usually makes sense to prefix
215 the labels with the project name to help share the label space, e.g.,
216 ``sfc-user-guide`` instead of just ``user-guide``.
221 It is recommended that all rst content is validated by `doc8 <https://pypi.python.org/pypi/doc8>`_ standards.
222 To validate your rst files using doc8, install doc8.
226 sudo pip install doc8
228 doc8 can now be used to check the rst files. Execute as,
232 doc8 --ignore D000,D001 <file>
235 Testing: Build Documentation Locally
236 ------------------------------------
238 Composite DOC documentation
239 +++++++++++++++++++++++++++++++++
240 To build the whole documentation under doc/, 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 docs & install requirements.
260 sudo pip install -r etc/requirements.txt
262 Update submodules, build documentation using tox & then open using any browser.
267 git submodule update --init
269 firefox docs/_build/html/index.html
271 .. note:: Make sure to run `tox -edocs` and not just `tox`.
273 Individual project documentation
274 ++++++++++++++++++++++++++++++++
275 To test how the documentation renders in HTML, follow these steps:
277 Install virtual environment.
281 sudo pip install virtualenv
282 cd /local/repo/path/to/project
284 Download the doc repository.
288 git clone http://gerrit.onap.org/r/doc
290 Change directory to doc & install requirements.
295 sudo pip install -r etc/requirements.txt
297 Move the conf.py file to your project folder where RST files have been kept:
301 mv doc/docs/conf.py <path-to-your-folder>/
303 Move the static files to your project folder:
307 mv docs/_static/ <path-to-your-folder>/
309 Build the documentation from within your project folder:
313 sphinx-build -b html <path-to-your-folder> <path-to-output-folder>
315 Your documentation shall be built as HTML inside the
316 specified output folder directory.
318 .. 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.
321 Adding your project repository as a submodule
322 ---------------------------------------------
324 Clone the doc repository and add your submodule using the commands below and where $reponame is your repository name.
329 git submodule git https://gerrit.onap.org/r/$reponame
330 git submodule init $reponame/
331 git submodule update $reponame/