1 .. _documentation-guide:
7 This guide provides details on how to contribute to the OpenDaylight
8 documentation. OpenDaylight currently uses a mix of AsciiDoc_ and
9 reStructuredText_ for documentation, although the `Documentation
10 Group`_ is generally trying to move toward using reStructuredText_ and
11 Sphinx_ to build it as it is widely-used to provide both HTML and pdf
12 documentation that can be easily versioned alongside the code. It also
13 offers similar syntax to Markdown which is familiar to large numbers of
16 reStructuredText-based Documentation
17 ====================================
19 When using reStructuredText, we try to follow the python documentation
22 https://docs.python.org/devguide/documenting.html
24 To build and review the reStructuredText documentation locally you must
25 have installed locally:
30 Which both should be available in most distribution's package managers.
32 Then simply run tox and open the html produced via your favourite web
38 firefox docs/_build/html/index.html
43 The directory structure for the reStructuredText documentation is
44 rooted in the ``docs`` directory inside the ``docs`` ``git``
47 Below that there are guides hosted directly in the ``docs`` ``git``
48 repository and there are guides hosted in remote ``git`` repositories.
49 Usually those are for project-specific information.
51 For example here is the directory layout on June, 28th 2016::
58 ├── getting-started-guide
60 │ ├── concepts_and_tools.rst
61 │ ├── experimental_features.rst
63 │ ├── installing_opendaylight.rst
64 │ ├── introduction.rst
65 │ ├── karaf_features.rst
66 │ ├── other_features.rst
68 │ └── who_should_use.rst
71 ├── opendaylight-with-openstack
74 │ ├── openstack-with-gbp.rst
75 │ ├── openstack-with-ovsdb.rst
76 │ └── openstack-with-vtn.rst
81 The ``getting-started-guide`` and ``opendaylight-with-openstack``
82 directories correspond to two guides hosted in the ``docs`` repository,
83 while the ``submodules/releng/builder`` directory houses documentation
84 for the `RelEng/Builder`_ project.
86 Inside each guide there is usually an ``index.rst`` file which then
87 includes other files using a ``toctree`` directive. For example::
92 getting-started-guide/index
93 opendaylight-with-openstack/index
94 submodules/releng/builder/docs/index
96 This creates a table of contents on that page where each heading of the
97 table of contents is the root of the files that are included.
99 .. note:: When including rst files using ``toctree`` omit the .rst at
100 the end of the file name.
102 Documentation Layout and Style
103 ------------------------------
105 As mentioned previously we try to follow the python documentation style guide
106 which defines a few types of sections::
108 # with overline, for parts
109 * with overline, for chapters
112 ^, for subsubsections
115 We try to follow the following structure based on that recommendation::
117 docs/index.rst -> entry point
118 docs/____-guide/index.rst -> part
119 docs/____-guide/<chapter>.rst -> chapter
121 In the ____-guide/index.rst we use the # with overline at the very top
122 of the file to determine that it is a part and then within each chapter
123 file we start the document with a section using * with overline to
124 denote that it's the chapter heading and then everything in the rest of
125 the chapter should use::
129 ^, for subsubsections
136 If you see an error like this::
138 ./build-integration-robot-libdoc.sh: line 6: cd: submodules/integration/test/csit/libraries: No such file or directory
139 Resource file '*.robot' does not exist.
141 It means that you haven't pulled down the git submodule for the integration/test project. The fastest way to do that is::
146 Also, you may notice errors like these when building::
148 Importing test library '/Users/ckd/git-reps/docs/docs/submodules/integration/test/csit/libraries/AAAJsonUtils.py' failed: ImportError: No module named jsonpath
150 sed: 1: "SxpLib.robot.html": invalid command code S
152 They can be ignored. This is an artifact of our building documentation for the robot test framework customizations OpenDaylight has and is being tracked as `BUG-6159 <https://bugs.opendaylight.org/show_bug.cgi?id=6159>`_. More information can be found there.
154 AsciiDoc-based Documentation
155 ============================
157 Information on the AsciiDoc tools and build system can be found here:
159 https://wiki.opendaylight.org/view/Documentation/Tools
164 The AsciiDoc documentation is all located in the ``manuals`` directory
165 of the ``docs`` ``git`` repository. An example of the directory
166 structure on June 28th, 2016 can be seen here::
171 │ └── app_support.xml
178 ├── getting-started-guide
203 Each of the top-level directories under ``manuals`` is a whole guide by
204 itself and it contains a ``pom.xml`` file saying how to build it, a
205 ``src/main/asciidoc`` directory with AsciiDoc source files and a
206 ``src/main/resources`` directory containing images.
208 Migration from AsciiDoc to ReStructuredText
209 ===========================================
214 In theory, Pandoc_ can convert from DocBook to reStructuredText and we
215 produce DocBook as part of our build chain from AsciiDoctor. In
216 practice, for modest-sized migrations doing things by hand works fairly
222 Converting from AsciiDoc to reStructuredText is usually pretty
223 straightforward and involves looking up the basic syntax for what you
224 want to do by looking it up in the reStructuredText_ guide.
226 The differences are usually minor and fast to change.
228 Also, because of how fast Sphinx builds, and how fast it is to refresh
229 the HTML documentation rapid iteration is very easy.
231 Bold/Italics/Verbatim Formatting
232 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
234 This is mostly minor syntax issues. In AsciiDoc you do inline
235 formatting something like this::
237 *bold* _italic_ +verbatim+ `verbatim`
239 In reStructuredText, things are slightly different::
241 **bold** *italic* ``verbatim``
246 Image formats change from something like::
248 .OpenStack Architecture
249 image::vtn/OpenStackDeveloperGuide.png["OpenStack Architecture",width=500]
253 .. image:: images/dlux-default.png
255 A helpful regular expression for automating the replacements is something like::
257 search: ^( *)\.(.+)\n +image::(.+)\[(.+),width=(\d+)\]
258 replace: $1.. figure:: images/dlux/$3\n$1 :width: $5\n\n$1 $2
264 .. _AsciiDoc: http://www.methods.co.nz/asciidoc/
265 .. _Sphinx: http://www.sphinx-doc.org/en/stable/
266 .. _reStructuredText: http://www.sphinx-doc.org/en/stable/rest.html
267 .. _Documentation Group: https://wiki.opendaylight.org/view/Documentation/
268 .. _RelEng/Builder: https://wiki.opendaylight.org/view/RelEng/Builder
269 .. _Pandoc: http://pandoc.org/