docs: Add adoption notice lifecycle
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -15,32 +15,44 @@ class DrawioDirective(SphinxDirective):
|
|||||||
.. drawio::
|
.. drawio::
|
||||||
example-diagram.drawio.html
|
example-diagram.drawio.html
|
||||||
example-diagram.drawio.png
|
example-diagram.drawio.png
|
||||||
|
:alt: Example of a Draw.io diagram
|
||||||
"""
|
"""
|
||||||
|
|
||||||
has_content = False
|
has_content = False
|
||||||
required_arguments = 2 # html and png
|
required_arguments = 2 # html and png
|
||||||
|
optional_arguments = 1
|
||||||
|
final_argument_whitespace = True # indicating if the final argument may contain whitespace
|
||||||
|
option_spec = {
|
||||||
|
"alt": str,
|
||||||
|
}
|
||||||
|
|
||||||
def run(self) -> list[nodes.Node]:
|
def run(self) -> list[nodes.Node]:
|
||||||
html_path = self.arguments[0]
|
|
||||||
png_path = self.arguments[1]
|
|
||||||
|
|
||||||
env = self.state.document.settings.env
|
env = self.state.document.settings.env
|
||||||
|
builder = env.app.builder
|
||||||
|
|
||||||
|
# Resolve paths relative to the document
|
||||||
docdir = Path(env.doc2path(env.docname)).parent
|
docdir = Path(env.doc2path(env.docname)).parent
|
||||||
html_rel = Path(self.arguments[0])
|
html_rel = Path(self.arguments[0])
|
||||||
png_rel = Path(self.arguments[1])
|
png_rel = Path(self.arguments[1])
|
||||||
|
|
||||||
html_path = (docdir / html_rel).resolve()
|
html_path = (docdir / html_rel).resolve()
|
||||||
png_path = (docdir / png_rel).resolve()
|
png_path = (docdir / png_rel).resolve()
|
||||||
|
|
||||||
|
alt_text = self.options.get("alt", "")
|
||||||
|
|
||||||
container = nodes.container()
|
container = nodes.container()
|
||||||
|
|
||||||
# HTML output -> raw HTML node
|
# HTML output -> raw HTML node
|
||||||
if self.builder.format == "html":
|
if builder.format == "html":
|
||||||
# Embed the HTML file contents directly
|
# Embed the HTML file contents directly
|
||||||
|
try:
|
||||||
|
html_content = html_path.read_text(encoding="utf-8")
|
||||||
|
except OSError as e:
|
||||||
|
msg = self.state_machine.reporter.error(f"Cannot read HTML file: {e}")
|
||||||
|
return [msg]
|
||||||
|
aria_attribute = f' aria-label="{alt_text}"' if alt_text else ""
|
||||||
raw_html_node = nodes.raw(
|
raw_html_node = nodes.raw(
|
||||||
"",
|
"",
|
||||||
f'<div class="drawio-diagram">{open(html_path, encoding="utf-8").read()}</div>',
|
f'<div class="drawio-diagram"{aria_attribute}>{html_content}</div>',
|
||||||
format="html",
|
format="html",
|
||||||
)
|
)
|
||||||
container += raw_html_node
|
container += raw_html_node
|
||||||
@@ -51,17 +63,12 @@ class DrawioDirective(SphinxDirective):
|
|||||||
|
|
||||||
return [container]
|
return [container]
|
||||||
|
|
||||||
@property
|
|
||||||
def builder(self):
|
|
||||||
# Helper to access the builder from the directive context
|
|
||||||
return self.state.document.settings.env.app.builder
|
|
||||||
|
|
||||||
|
|
||||||
def setup(app: Sphinx) -> ExtensionMetadata:
|
def setup(app: Sphinx) -> ExtensionMetadata:
|
||||||
app.add_directive("drawio", DrawioDirective)
|
app.add_directive("drawio", DrawioDirective)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"version": "0.1",
|
"version": "0.2",
|
||||||
"parallel_read_safe": True,
|
"parallel_read_safe": True,
|
||||||
"parallel_write_safe": True,
|
"parallel_write_safe": True,
|
||||||
}
|
}
|
||||||
|
BIN
docs/user/Vermittlung-Lifecycle.drawio.png
Normal file
BIN
docs/user/Vermittlung-Lifecycle.drawio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 150 KiB |
11
docs/user/Vermittlung_Lifecycle.drawio.html
Normal file
11
docs/user/Vermittlung_Lifecycle.drawio.html
Normal file
File diff suppressed because one or more lines are too long
@@ -16,6 +16,12 @@ Ersteller*innen von Vermittlungen werden über neue Kommentare per Mail benachri
|
|||||||
|
|
||||||
Kommentare können, wie Vermittlungen, gemeldet werden.
|
Kommentare können, wie Vermittlungen, gemeldet werden.
|
||||||
|
|
||||||
|
.. drawio::
|
||||||
|
Vermittlung_Lifecycle.drawio.html
|
||||||
|
Vermittlung-Lifecycle.drawio.png
|
||||||
|
:alt: Diagramm das den Prozess der Vermittlungen zeigt.
|
||||||
|
|
||||||
|
|
||||||
Adoption Notice Status Choices
|
Adoption Notice Status Choices
|
||||||
++++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user