|
2 | 2 | Reference |
3 | 3 | ######### |
4 | 4 |
|
5 | | -Each tutorial file can contain two elements: |
| 5 | +For a complete model reference, please see the `Swagger UI documentation <_static/swagger-ui/index.html>`_. |
6 | 6 |
|
7 | | -parts (required, type: :ref:`Parts <reference_parts>`) |
8 | | - The individual parts of the tutorial. See :ref:`Parts <reference_parts>` for more information. |
9 | | -configuration (optional, type: :ref:`Parts <reference_configuration>`) |
10 | | - Global/initial configuration for the tutorial. See :ref:`Configuration <reference_configuration>` for |
11 | | - more information. |
| 7 | +For a quick overview, each tutorial file can contain two elements: |
12 | 8 |
|
13 | | -.. _reference_parts: |
| 9 | +parts (required) |
| 10 | + The individual parts of the tutorial. A part can have multiple types, either: |
14 | 11 |
|
15 | | -***** |
16 | | -parts |
17 | | -***** |
| 12 | + * ``CommandsPartModel`` for a list of commands to execute. |
| 13 | + * ``FilePartModel`` for a file to create. |
18 | 14 |
|
19 | | -Parts is a list of individual "chapters" of your tutorial. For example, a chapter might be a set of commands |
20 | | -to install a software, or a configuration file that the user is instructed to create. |
21 | | - |
22 | | - |
23 | | -file parts |
24 | | -========== |
25 | | - |
26 | | -File parts are intended to create a file when running a tutorial, and to e.g. instruct the user to create that |
27 | | -file when rendering the tutorial in documentation. A full example: |
28 | | - |
29 | | -.. literalinclude:: /tutorials/file-full-example/tutorial.yaml |
30 | | - :language: yaml |
31 | | - |
32 | | -The above tutorial will render a file block when rendered: |
33 | | - |
34 | | -.. structured-tutorial:: file-full-example/tutorial.yaml |
35 | | - |
36 | | -.. structured-tutorial-part:: |
37 | | - |
38 | | -The configuration options are: |
39 | | - |
40 | | -parts[n].contents (optional, str) |
41 | | - The contents of the file. Mutually exclusive to ``source``. |
42 | | -parts[n].source (optional, str) |
43 | | - Path of the original file. Mutually exclusive to ``contents``. |
44 | | -parts[n].destination (optional, str) |
45 | | - Where to create the new file. |
46 | | -parts[n].template (optional, bool) |
47 | | - Default: ``True`` |
48 | | - |
49 | | - Set to ``False`` if this file should not be rendered as a template. This can be used to copy binary |
50 | | - files and cannot be read as text files, or if you want the destination file to be a template. |
51 | | -parts[n].doc (optional, type: :ref:`parts[n]doc <reference_parts_n_doc>`) |
52 | | - See :ref:`parts[n]doc <reference_parts_n_doc>` for details. |
53 | | -parts[n].run |
54 | | - No options are supported thus far. |
55 | | - |
56 | | -.. _reference_parts_n_doc: |
57 | | - |
58 | | -parts[n].doc |
59 | | ------------- |
60 | | - |
61 | | -language (optional, str) |
62 | | - Language used for syntax highlighting. |
63 | | -ignore_spelling (optional, bool) |
64 | | - Default: ``False`` |
65 | | - |
66 | | - Set to ``True`` to wrap the `caption` option in a ``:spelling:ignore:`` directive for |
67 | | - `sphinxcontrib-spelling <https://github.com/sphinx-contrib/spelling>`_. |
68 | | - |
69 | | -In addition, any option of the `code-block |
70 | | -<https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block>`_ directive |
71 | | -are also supported. |
72 | | - |
73 | | -commands parts |
74 | | -============== |
75 | | - |
76 | | -.. _reference_configuration: |
77 | | - |
78 | | -************* |
79 | | -configuration |
80 | | -************* |
81 | | - |
82 | | -configuration.doc |
83 | | -================= |
84 | | - |
85 | | -configuration.doc.context (dict) |
86 | | - Default: ``{"doc": True, "run": False, "cwd": "~", ...}`` |
87 | | - |
88 | | - The initial context for rendering template strings. Additional variables in the context are used to |
89 | | - influence the appearance of the prompt in console blocks: |
90 | | - |
91 | | - user |
92 | | - Default: ``"user"`` |
93 | | - host |
94 | | - Default: ``"host"`` |
95 | | - cwd |
96 | | - Default: ``"~"`` |
97 | | - prompt_template |
98 | | - Default: ``"{{ user }}@{{ host }}:{{ cwd }}{% if user == 'root' %}#{% else %}${% endif %} "`` |
99 | | - |
100 | | -configuration.run |
101 | | -================= |
102 | | - |
103 | | -configuration.run.context (dict) |
104 | | - Default: ``{"doc": True, "run": False, "cwd": Path.cwd()}`` |
105 | | - |
106 | | - The initial context for rendering template strings. |
107 | | - |
108 | | -configuration.run.git_export (optional, bool) |
109 | | - Default: ``False`` |
110 | | - |
111 | | - If set to ``True``, perform a git export before running the tutorial. The current working directory will |
112 | | - change to the git export. After the tutorial, the export directory will be removed. This setting |
113 | | - overrides ``temporary_directory``. |
114 | | - |
115 | | - If set, the ``cwd`` context variable will point to the temporary directory where the git repository was |
116 | | - exported to. The original/initial working directory is available as ``orig_cwd``. |
117 | | - |
118 | | -configuration.run.temporary_directory (optional, bool) |
119 | | - Default: ``False`` |
120 | | - |
121 | | - If set to ``True``, switch to an empty, temporary directory before running the tutorial. The empty |
122 | | - directory will be removed once the tutorial is completed. |
123 | | - |
124 | | - If set, the ``cwd`` context variable will point to the temporary directory. The original/initial working |
125 | | - directory is available as ``orig_cwd``. |
| 15 | +configuration (optional) |
| 16 | + Global/initial configuration for the tutorial. This is represented by the ``ConfigurationModel``. |
0 commit comments