Skip to content

Commit 181a6d7

Browse files
final first version of guide_lines_tutorials.rst
1 parent 8ccb409 commit 181a6d7

File tree

1 file changed

+141
-38
lines changed

1 file changed

+141
-38
lines changed

doc/source/getting_started/write_doc/guide_lines_tutorials.rst

Lines changed: 141 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ You will be handling only the ``doc/source/user_guide`` directory .
3636
Adding a new tutorial section
3737
=============================
3838

39+
:download:`Download the new tutorial section template<tutorial_section_template.rst>`
40+
3941
.. note::
4042

4143
Avoid creating new folders unless it is absolutely necessary. If you are in doubt, its precise location can be
@@ -101,16 +103,14 @@ The new folder must contain at least a ``index.rst`` file. This file has:
101103
You must also add the ``index.rst`` file in the main user guide page toctree. You can find it at the end of
102104
``doc/source/user_guide/index.rst`` file.
103105

104-
.. rubric:: Templates
105-
106-
:download:`Download the new tutorial section template<tutorial_section_template.rst>`
107-
108106
.. _ref_guide_lines_add_new_tutorial:
109107

110108
=====================
111109
Adding a new tutorial
112110
=====================
113111

112+
:download:`Download the tutorial card template<tutorial_card_template.rst>` :download:`Download the tutorial template<tutorial_template.rst>`
113+
114114
Location and naming
115115
-------------------
116116

@@ -133,26 +133,26 @@ You also have to add it to a card and the toctree on the tutorial section ``inde
133133
- Badges with the applicable solvers;
134134
- Link to the tutorial file;
135135

136-
.. card:: Tutorial title
137-
:text-align: center
138-
:width: 25%
139-
140-
Short description of the tutorial
136+
.. topic:: Card example
141137

142-
+++
143-
:bdg-mapdl:`MAPDL` :bdg-lsdyna:`LS-DYNA` :bdg-fluent:`FLUENT` :bdg-cfx:`CFX`
138+
.. card:: Tutorial title
139+
:text-align: center
140+
:width: 25%
144141

145-
.. rubric:: Templates
142+
Short description of the tutorial
146143

147-
:download:`Download the card template<tutorial_section_template.rst>`
144+
+++
145+
:bdg-mapdl:`MAPDL` :bdg-lsdyna:`LS-DYNA` :bdg-fluent:`FLUENT` :bdg-cfx:`CFX`
148146

149147
Structure
150148
---------
151149

152150
The tutorial structure can be divided in two main parts:
153151

154-
- Preamble;
155-
- Content.
152+
- :ref:`Preamble<ref_guide_lines_tutorial_preamble>`;
153+
- :ref:`Content<ref_guide_lines_tutorial_content>`.
154+
155+
.. _ref_guide_lines_tutorial_preamble:
156156

157157
Preamble
158158
^^^^^^^^
@@ -195,7 +195,7 @@ The preamble must have the following components:
195195
:jupyter-download-script:`Download tutorial as Python script<file_name>` :jupyter-download-notebook:`Download tutorial as notebook<file_name>`
196196
197197
The main PyDPF-Core library references are available already defined in the ``doc/source/links_and_refs.rst`` file.
198-
To use it you use the include directive and use the substitution text as usual:
198+
To employ them, you use the ``include`` directive and use the substitution text as usual:
199199

200200
.. code-block::
201201
@@ -212,6 +212,8 @@ To use it you use the include directive and use the substitution text as usual:
212212
213213
For more information on those references check the :download:`links and references file<../../links_and_refs.rst>`.
214214

215+
.. _ref_guide_lines_tutorial_content:
216+
215217
Content
216218
^^^^^^^
217219

@@ -315,30 +317,35 @@ Code blocks
315317
The tutorials must have code blocks where you show how you actually implement the coode.
316318
The guidelines for the code snippets are:
317319

318-
- Use the `jupyter sphinx<jupyter_sphinx_ext>`_ extension. Its executes embedded code in a Jupyter kernel,
319-
and embeds outputs of that code in the document:
320+
- Use the `jupyter sphinx<jupyter_sphinx_ext>`_ extension to show code blocks. Its executes embedded code in
321+
a Jupyter kernel and embeds outputs of that code in the document:
320322

321-
.. code-block::
323+
.. grid:: 2
324+
:gutter: 2
325+
:padding: 2
326+
:margin: 2
322327

323-
.. jupyter-execute::
328+
.. grid-item-card::
324329

325-
# This is a executable code block
326-
from ansys.dpf import core as dpf
330+
:octicon:`check-circle-fill` **Correct**
327331

328-
- You must split your code in several parts so you can make explanations between them:
332+
.. code-block::
329333
330-
First explanation
334+
.. jupyter-execute::
331335
332-
.. code-block::
336+
# This is a executable code block
337+
from ansys.dpf import core as dpf
333338
334-
# Code block 1
339+
.. grid-item-card::
335340

336-
Second explanation
341+
:octicon:`x-circle-fill` **Incorrect**
337342

338-
.. code-block::
343+
.. code-block::
339344
340-
# Code block 2
345+
.. code-block::
341346
347+
# This is a simple code block
348+
from ansys.dpf import core as dpf
342349
343350
- Every code implementation must be commented:
344351

@@ -347,9 +354,9 @@ Second explanation
347354
:padding: 2
348355
:margin: 2
349356

350-
.. grid-item::
357+
.. grid-item-card::
351358

352-
**Correct**
359+
:octicon:`check-circle-fill` **Correct**
353360

354361
.. code-block::
355362
@@ -358,34 +365,73 @@ Second explanation
358365
# Get the stress results
359366
stress_fc = model.results.stress.eval()
360367
361-
.. grid-item::
368+
.. grid-item-card::
362369

363-
**Incorrect**
370+
:octicon:`x-circle-fill` **Incorrect**
364371

365372
.. code-block::
366373
367374
model = dpf.Model()
368375
stress_fc = model.results.stress.eval()
369376
370-
- When using a PyDPF-Core object or method you must use key arguments
377+
- You must split your code in several parts so you can make explanations between them:
378+
379+
.. grid:: 2
380+
:gutter: 2
381+
:padding: 2
382+
:margin: 2
383+
384+
.. grid-item-card::
385+
386+
:octicon:`check-circle-fill` **Correct**
387+
388+
First explanation
389+
390+
.. code-block::
391+
392+
# Code comment 1
393+
code1
394+
395+
Second explanation
396+
397+
.. code-block::
398+
399+
# Code comment 2
400+
code2
401+
402+
.. grid-item-card::
403+
404+
:octicon:`x-circle-fill` **Incorrect**
405+
406+
.. code-block::
407+
408+
# First explanation
409+
# Code comment 1
410+
code1
411+
412+
# Second explanation
413+
# Code comment 2
414+
code2
415+
416+
- When using a PyDPF-Core object or method you must use key arguments:
371417

372418
.. grid:: 2
373419
:gutter: 2
374420
:padding: 2
375421
:margin: 2
376422

377-
.. grid-item::
423+
.. grid-item-card::
378424

379-
**Correct**
425+
:octicon:`check-circle-fill` **Correct**
380426

381427
.. code-block::
382428
383429
# Get the stress results
384430
stress_fc = model.results.stress(time_scoping=time_steps).eval()
385431
386-
.. grid-item::
432+
.. grid-item-card::
387433

388-
**Incorrect**
434+
:octicon:`x-circle-fill` **Incorrect**
389435

390436
.. code-block::
391437
@@ -395,9 +441,66 @@ Second explanation
395441
Text formating
396442
~~~~~~~~~~~~~~
397443

444+
- When enumerating something you must use bullet lists:
445+
446+
.. grid:: 2
447+
:gutter: 2
448+
:padding: 2
449+
:margin: 2
450+
451+
.. grid-item-card::
452+
453+
:octicon:`check-circle-fill` **Correct**
454+
455+
.. code-block::
456+
457+
This operator accepts as arguments:
458+
459+
- A Result;
460+
- An Operator;
461+
- A FieldsContainer.
462+
463+
.. grid-item-card::
398464

465+
:octicon:`x-circle-fill` **Incorrect**
399466

467+
.. code-block::
468+
469+
This operator accepts a Result, an Operator or a
470+
FieldsContainer as arguments.
471+
472+
- If the enumeration represent a order of topics the list must be numbered:
473+
474+
.. grid:: 2
475+
:gutter: 2
476+
:padding: 2
477+
:margin: 2
478+
479+
.. grid-item-card::
400480

481+
:octicon:`check-circle-fill` **Correct**
482+
483+
.. code-block::
484+
485+
To extract the mesh you need to follow those steps:
486+
487+
#. Get the result file;
488+
#. Create a Model;
489+
#. Get the MeshedRegion.
490+
491+
The ``#.`` renders as a numbered list.
492+
493+
.. grid-item-card::
494+
495+
:octicon:`x-circle-fill` **Incorrect**
496+
497+
.. code-block::
401498
499+
To extract the mesh you need to follow those steps:
402500
501+
- Get the result file;
502+
- Create a Model;
503+
- Get the MeshedRegion.
403504
505+
- If you need to put code blocks between the list items first you enumerate and reference them in a list. Then, you
506+
explore each of them separately in sub headings.

0 commit comments

Comments
 (0)