mirror of
https://github.com/TeachBooks/manual.git
synced 2026-11-12 22:35:51 +00:00
Remove debug logging and update intro content
Debug logging statements were removed from MergeGatedDirectivesTransform in sphinx_gated_directives. The intro.md file was updated to include new theorem and figure directive examples, code cells, and additional documentation content.
This commit is contained in:
parent
fddd493e39
commit
bd47d63475
2 changed files with 63 additions and 12 deletions
|
|
@ -450,13 +450,6 @@ class MergeGatedDirectivesTransform(SphinxTransform):
|
|||
end_index = parent.children.index(end_n)
|
||||
between_nodes = parent.children[start_index + 1:end_index]
|
||||
|
||||
# print the nodes for debugging
|
||||
logger.info(f"{start_n.pformat()}",color="green")
|
||||
if between_nodes:
|
||||
for bn in between_nodes:
|
||||
logger.info(f"{bn.pformat()}",color="yellow")
|
||||
logger.info(f"{end_n.pformat()}",color="red")
|
||||
|
||||
# We have to merge, but how is the question.
|
||||
# we handle based on "experience" and "observation" of what kind of nodes are generated
|
||||
# step 1: create a new container node to hold the merged content
|
||||
|
|
@ -490,14 +483,10 @@ class MergeGatedDirectivesTransform(SphinxTransform):
|
|||
for i, bn in enumerate(between_nodes):
|
||||
content.insert(pos + i, bn) # insert sets parent/doc links
|
||||
else:
|
||||
logger.info(f"Found no caption and no section node in start_node content.",color="blue")
|
||||
# otherwise, we add all between nodes to the main content directly\
|
||||
for bn in between_nodes:
|
||||
content += bn # add sets parent/doc links
|
||||
logger.info(f"New nodes after merging:",color="blue")
|
||||
for nn in new_nodes:
|
||||
logger.info(f"{nn.pformat()}",color="blue")
|
||||
|
||||
|
||||
# finally, replace start_n with new_nodes, and remove end_n and between_nodes
|
||||
start_pos = parent.children.index(start_n)
|
||||
# remove end_n
|
||||
|
|
|
|||
|
|
@ -1,5 +1,67 @@
|
|||
---
|
||||
file_format: mystnb
|
||||
kernelspec:
|
||||
name: python3
|
||||
---
|
||||
|
||||
# TeachBooks Manual
|
||||
|
||||
:::{prf:theorem-start} A title
|
||||
:label: theorem-label
|
||||
|
||||
This is a theorem. This text is inside the directive.
|
||||
:::
|
||||
|
||||
Now some extra text that should come inside the theorem.
|
||||
|
||||
:::{figure} images/sphinx-logo.svg
|
||||
:alt: Sphinx logo
|
||||
:width: 200px
|
||||
:align: center
|
||||
|
||||
Sphinx is a great tool for documentation! This figure should be inside the theorem.
|
||||
:::
|
||||
|
||||
```{code-cell} ipython3
|
||||
a = "This is some"
|
||||
b = "Python code"
|
||||
c = "that should be inside the theorem."
|
||||
print(f"{a} {b} {c}")
|
||||
```
|
||||
|
||||
:::{prf:theorem-end}
|
||||
:::
|
||||
|
||||
:::{figure-start} images/logo-wide.svg
|
||||
:name: figure-label
|
||||
:alt: JupyterBook logo
|
||||
:width: 200px
|
||||
:align: center
|
||||
|
||||
This is a figure. This text is inside the caption.
|
||||
:::
|
||||
|
||||
```{code-cell} ipython3
|
||||
a = "This is some"
|
||||
b = "Python code"
|
||||
c = "that should be inside the figure,"
|
||||
d = "above the caption."
|
||||
print(f"{a} {b} {c} {d}")
|
||||
```
|
||||
|
||||
Now some extra text that should come inside the figure, above the caption.
|
||||
|
||||
:::{figure} images/sphinx-logo.svg
|
||||
:alt: Sphinx logo
|
||||
:width: 200px
|
||||
:align: center
|
||||
|
||||
Sphinx is a great tool for documentation! This figure should be inside the parent figure, above the parent caption.
|
||||
:::
|
||||
|
||||
:::{figure-end}
|
||||
:::
|
||||
|
||||
This manual is primarily designed for and by teachers for use in education, but should be a useful resource for anyone interested in creating and collaborating on a TeachBook: a <a href="https://jupyterbook.org/v1/"><img style="display:inline-block; height:1.5em; width:auto; transform:translate(0, -0.15em)" src="images/logo-wide.svg" alt="Jupyter book v1"> v1</a> using the <a href="https://www.sphinx-doc.org/"><img style="display:inline-block; height:1.5em; width:auto; transform:translate(0, -0.15em)" src="images/sphinx-logo.svg" alt="Sphinx logo"> Sphinx backend</a> with additional editing tools and book features. Our aim is to provide a simple way to start book-making for new users (it only takes 10 clicks!), ease the editing process for anyone, and provide additional features developed for education-purposes. We hope you find this resource useful and refer back to it often.
|
||||
|
||||
TeachBooks originated at Delft University of Technology in the Netherlands, and some of the material in this Manual reflects tools and resources specific to TU Delft. With the exception of a few tools for which we have educational licenses at Delft, everything in this Manual is open source. Despite this, we are happy to grow our open source community beyond Delft and welcome contributions from all users.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue