|
4 | 4 | Writing tutorials guide lines |
5 | 5 | ============================= |
6 | 6 |
|
7 | | -To add a tutorial on the documentation you need to follow the guide lines presented here. |
| 7 | +You can improve the Py-DPF-Core documentation by adding: |
8 | 8 |
|
| 9 | +- :ref:`New tutorials sections<ref_guide_lines_add_new_tutorial_section>`; |
| 10 | +- :ref:`New tutorials<ref_guide_lines_add_new_tutorial>`. |
| 11 | + |
| 12 | +To do so, you must follow the guide lines presented here. |
| 13 | +You also need to understand the structure of the ``doc`` directory on the PyDPF-Core library: |
| 14 | + |
| 15 | +.. code-block:: |
| 16 | +
|
| 17 | + . |
| 18 | + ├── doc |
| 19 | + │ ├── source |
| 20 | + │ │ ├── api |
| 21 | + │ │ ├── examples |
| 22 | + │ │ ├── getting_started |
| 23 | + │ │ ├── images |
| 24 | + │ │ ├── user_guide |
| 25 | + │ │ ├── conf.py |
| 26 | + │ │ ├── index.rst |
| 27 | + │ ├── styles |
| 28 | + │ ├── make.bat |
| 29 | +
|
| 30 | +
|
| 31 | +You will be handling only the ``doc/source/user_guide`` directory . |
| 32 | + |
| 33 | +.. _ref_guide_lines_add_new_tutorial_section: |
| 34 | + |
| 35 | +============================= |
9 | 36 | Adding a new tutorial section |
10 | | ------------------------------ |
| 37 | +============================= |
11 | 38 |
|
12 | 39 | .. note:: |
13 | 40 |
|
14 | 41 | Avoid creating new folders unless absolutely necessary. If in doubt, its precise location can be advised |
15 | 42 | on in the pull request. If you must create a new folder, make sure to add a ``index.rst`` file containing |
16 | 43 | a reference, tue section title and a description of the section. Otherwise the new folder will be ignored by Sphinx. |
17 | 44 |
|
| 45 | +Location and naming |
| 46 | +------------------- |
| 47 | + |
| 48 | +The new tutorial section must be organized in a new folder in ``doc/source/user_guide/tutorials/new_section_name``. |
| 49 | + |
| 50 | +.. code-block:: |
| 51 | +
|
| 52 | + . |
| 53 | + ├── doc |
| 54 | + │ ├── source |
| 55 | + │ │ ├── user_guide |
| 56 | + │ │ │ ├── tutorials |
| 57 | + │ │ │ ├── new_section |
| 58 | +
|
| 59 | +Structure |
| 60 | +--------- |
| 61 | + |
| 62 | +The new folder must contain at least a ``index.rst`` file. This file has: |
| 63 | + |
| 64 | +- Reference name; |
| 65 | +- Section title; |
| 66 | +- General description of the content of the tutorials in this section; |
| 67 | +- Cards with the tutorial title, description and applicable solvers (the card must have a link to the tutorial file); |
| 68 | +- Toctree with the tutorials in the section. |
18 | 69 |
|
| 70 | +You must also add the ``index.rst`` file. in the main user guide toctree. You can find it at the end of |
| 71 | +``doc/source/user_guide/index.rst`` file. |
19 | 72 |
|
| 73 | +.. rubric:: Templates |
| 74 | + |
| 75 | +:download:`Download the new tutorial section template<tutorial_section_template.rst>` |
| 76 | + |
| 77 | +.. _ref_guide_lines_add_new_tutorial: |
| 78 | + |
| 79 | +===================== |
20 | 80 | Adding a new tutorial |
21 | | ---------------------- |
| 81 | +===================== |
| 82 | + |
22 | 83 | Location and naming |
23 | | -^^^^^^^^^^^^^^^^^^^ |
| 84 | +------------------- |
24 | 85 |
|
25 | 86 | New tutorials must be added as ``.rst`` files to: ``doc/source/user_guide/tutorials/section_name/tutorial_file.rst`` |
26 | 87 |
|
| 88 | +.. code-block:: |
| 89 | +
|
| 90 | + . |
| 91 | + ├── doc |
| 92 | + │ ├── source |
| 93 | + │ │ ├── user_guide |
| 94 | + │ │ │ ├── tutorials |
| 95 | + │ │ │ ├── section |
| 96 | + │ │ │ ├── new_tutorial.rst |
| 97 | +
|
| 98 | +You also have to add it to a card and the toctree on the section ``index.rst`` file. The card must have: |
| 99 | + |
| 100 | +- Tutorial title; |
| 101 | +- Short description; |
| 102 | +- Applicable solvers; |
| 103 | +- Link to the tutorial file; |
| 104 | + |
| 105 | +.. card:: Tutorial title |
| 106 | + :text-align: center |
| 107 | + :width: 25% |
| 108 | + |
| 109 | + Short description of the tutorial |
| 110 | + |
| 111 | + +++ |
| 112 | + :bdg-mapdl:`MAPDL` :bdg-lsdyna:`LS-DYNA` :bdg-fluent:`FLUENT` :bdg-cfx:`CFX` |
| 113 | + |
| 114 | +.. rubric:: Templates |
| 115 | + |
| 116 | +:download:`Download the card template<tutorial_section_template.rst>` |
27 | 117 |
|
28 | 118 | Structure |
29 | | -^^^^^^^^^ |
| 119 | +--------- |
| 120 | + |
| 121 | +The tutorial structure can be divided in two main parts: |
| 122 | + |
| 123 | +- Basis; |
| 124 | +- Content. |
| 125 | + |
| 126 | +Basis |
| 127 | +^^^^^ |
| 128 | + |
| 129 | +This first part must have the following components: |
| 130 | + |
| 131 | +- File reference name; |
| 132 | +- Tutorial title; |
| 133 | +- Substitution text for the PyDPF-Core library references; |
| 134 | +- Short description (same phrase used in the tutorial card in the tutorial section ``index.rst`` file); |
| 135 | +- Introduction that explains the context of the tutorial; |
| 136 | +- Download script buttons; |
30 | 137 |
|
31 | | -The tutorial needs to have the following parts: |
| 138 | +.. code-block:: |
32 | 139 |
|
33 | | -- Introduction |
34 | | -- |
35 | | -- |
| 140 | + .. _ref_tutorial_template: |
| 141 | +
|
| 142 | +
|
| 143 | + ============== |
| 144 | + Tutorial title |
| 145 | + ============== |
| 146 | +
|
| 147 | +
|
| 148 | + .. |Examples| replace:: :class:`ansys.dpf.core.examples` |
| 149 | +
|
| 150 | +
|
| 151 | + This sentence resumes the goal of the tutorial |
| 152 | +
|
| 153 | +
|
| 154 | + Introduction to the tutorial |
| 155 | +
|
| 156 | +
|
| 157 | + :jupyter-download-script:`Download tutorial as Python script<file_name>` :jupyter-download-notebook:`Download tutorial as notebook<file_name>` |
36 | 158 |
|
37 | 159 | Content |
38 | 160 | ^^^^^^^ |
| 161 | + |
| 162 | +A tutorial goal is to explain how to perform a task step by step and understand the underlying concepts. |
| 163 | + |
| 164 | +Sections |
| 165 | +~~~~~~~~ |
| 166 | + |
| 167 | +A well-structured tutorial content should be divided by those steps. For example: |
| 168 | + |
| 169 | +A tutorial goal is to explains how to plot a mesh using PyDPF-Core. |
| 170 | +The steps to achieve this task are: |
| 171 | + |
| 172 | +- Import a result file; |
| 173 | +- Extract the mesh; |
| 174 | +- Plot the mesh. |
| 175 | + |
| 176 | +To create those section, underline it with the appropriate characters (here: ``-``). |
| 177 | + |
| 178 | +.. code-block:: |
| 179 | +
|
| 180 | + Import result file |
| 181 | + ------------------ |
| 182 | +
|
| 183 | + First, you ... |
| 184 | +
|
| 185 | +
|
| 186 | + Extract the mesh |
| 187 | + ---------------- |
| 188 | +
|
| 189 | + Then, you extract ... |
| 190 | +
|
| 191 | +
|
| 192 | + Plot the mesh |
| 193 | + ------------- |
| 194 | +
|
| 195 | + Finally, you plot ... |
| 196 | +
|
| 197 | +Code snippets |
| 198 | +~~~~~~~~~~~~~ |
| 199 | + |
| 200 | +Text formating |
| 201 | +~~~~~~~~~~~~~~ |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
0 commit comments