Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/ansys/dpf/core/documentation/generate_operators_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ def generate_operator_doc(
file.write(output)


def generate_toc_tree(docs_path: Path):
"""Write the global toc.yml file for the DPF documentation based on the operators found.
def update_toc_tree(docs_path: Path):
"""Update the global toc.yml file for the DPF documentation based on the operators found.

Parameters
----------
Expand All @@ -391,7 +391,7 @@ def generate_toc_tree(docs_path: Path):
operators = [] # Reset operators for each category
for file in folder.iterdir():
if (
file.is_file() and file.suffix == ".md"
file.is_file() and file.suffix == ".md" and not file.name.endswith("_upd.md")
): # Ensure 'file' is a file with .md extension
file_name = file.name
file_path = f"{category}/{file_name}"
Expand All @@ -405,10 +405,18 @@ def generate_toc_tree(docs_path: Path):
template = jinja2.Template(template_file.read())
output = template.render(data=data) # Pass 'data' as a named argument

# Write the rendered output to toc.yml at the operators_doc level
# Update the original toc.yml file with the rendered output for operator_specifications
toc_path = docs_path / Path("toc.yml")
with toc_path.open(mode="r") as file:
original_toc = file.read()
new_toc = re.sub(
pattern=r"- name: Operator specifications\s*.*?(?=- name: Changelog|\Z)",
repl=output,
string=original_toc,
flags=re.DOTALL,
)
with toc_path.open(mode="w") as file:
file.write(output)
file.write(new_toc)


def generate_operators_doc(
Expand Down Expand Up @@ -452,7 +460,7 @@ def generate_operators_doc(
for operator_name in operators:
generate_operator_doc(server, operator_name, include_private, output_path)
# Generate the toc tree
generate_toc_tree(output_path)
update_toc_tree(output_path)
# Use update files in output_path
update_operator_descriptions(output_path)

Expand Down
31 changes: 1 addition & 30 deletions src/ansys/dpf/core/documentation/toc_template.j2
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
- name: Introduction
href: index.md
- name: Getting started
items:
- name: Installation
href: getting-started/installation.md
- name: Licensing
href: getting-started/licensing.md
- name: Configuration
href: getting-started/configuration.md
- name: User guide
items:
- name: The server context
href: user-guide/server-context.md
- name: How to use data containers
href: user-guide/using-data-containers.md
- name: How to use operators
href: user-guide/using-operators.md
- name: Workflow examples for beginners
href: user-guide/workflow-examples.md
- name: Build local documentation
href: user-guide/dpf-docs-local-preview.md
- name: Core concepts
items:
- name: Available types
href: core-concepts/dpf-types.md
- name: Operator fundamentals
href: core-concepts/operator.md
- name: Operator specifications
items:
- name: Operator specifications
Expand All @@ -36,5 +8,4 @@
- name: {{ operator.operator_name }}
href: operator-specifications/{{ operator.file_path }}{% endfor %}
{% endfor %}
- name: Changelog
href: changelog/changelog.md

Loading