Skip to content

Commit 798a325

Browse files
committed
tut: work on sphinx_codes_include extension
1 parent 95c16fa commit 798a325

4 files changed

Lines changed: 6 additions & 31 deletions

File tree

tutorial/jbook/discover/hello_world.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ We will follow the steps below:
1212
2. We use the `imgui.text()` (Python) or `ImGui::Text` (C++) function to display a text in the window.
1313
3. We call `hello_imgui.run()` (Python) or `HelloImGui::Run()` (C++) to start the application, optionally specifying the window title and size, or if we want it to set its size automatically.
1414

15-
16-
**Python**
17-
```{literalinclude} hello_world.py
18-
```
19-
20-
21-
**C++**
22-
```{literalinclude} hello_world.cpp
15+
```{codes_include} discover/hello_world
2316
```
2417

2518

@@ -43,11 +36,5 @@ We will follow the steps below:
4336
*Note: In the case of a web application, such as in this tutorial, the "exit" button will not have any effect. In the case of a desktop application, it will close the window.*
4437

4538

46-
**Python**
47-
```{literalinclude} button.py
48-
```
49-
50-
51-
**C++**
52-
```{literalinclude} button.cpp
39+
```{codes_include} discover/button
5340
```

tutorial/jbook/discover/layout_advices.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,5 @@ The code below demonstrates these advices and create this application:
3030
![](layout_advices.jpg)
3131
3232
33-
**Python**
34-
```{literalinclude} layout_advices.py
35-
```
36-
37-
38-
**C++**
39-
```{literalinclude} layout_advices.cpp
33+
```{codes_include} discover/layout_advices
4034
```

tutorial/jbook/discover/widget_edit.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,5 @@ Here, we use Hello ImGui to display images. See the doc about Hello ImGui for mo
1616
image_from_asset will keep the aspect ratio of the image if one of the dimensions is set to 0.
1717

1818

19-
**Python**
20-
```{literalinclude} widget_edit.py
19+
```{codes_include} discover/widget_edit
2120
```
22-
23-
24-
**C++**
25-
```{literalinclude} widget_edit.cpp
26-
```
27-

tutorial/jbook/sphinx_ext_imgui/sphinx_codes_include.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class CodesIncludeDirective(Directive):
1313
option_spec = {} # No specific options
1414

1515
def run(self):
16-
base_name = self.arguments[0]
16+
base_name = self.arguments[0] # The filename provided in the directive
17+
1718
content = []
1819

1920
# Generate tab-set Markdown syntax

0 commit comments

Comments
 (0)