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
12 changes: 7 additions & 5 deletions pipeline/toctree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import List

from rstcloth import RstCloth
from pipeline.utils import count_instances

def create_toc_tree_page(version:str, relative_path:List[str]):
target_file = os.path.join("target", f"{version}/docs/{'/'.join(relative_path)}.rst")
Expand All @@ -27,12 +28,13 @@ def create_toc_tree_page(version:str, relative_path:List[str]):
new_relative_path.extend(relative_path)
new_relative_path.append(sub_dir)
create_toc_tree_page(version, new_relative_path)

if heading == "Instance libraries":
doc.note(content="The instance libraries are continuously extended and optimized. You can "
"request the registration of new instances or corrections\/extensions of existing "
"instances by raising an issue on `openMINDS_instances "
"<https://github.com/openMetadataInitiative/openMINDS_documentation/issues>`_.")
instances_count = count_instances(version)
doc.note(content=["The instance libraries are continuously extended and optimized.",
"You can request the registration of new instances or corrections\/extensions of existing",
"instances by raising an issue on `openMINDS_instances <https://github.com/openMetadataInitiative/openMINDS_instances/issues>`_",
"",
f"The {version} version of openMINDS contains {instances_count} metadata instances in total."])

for link in links:
doc.content(link)
Expand Down
5 changes: 5 additions & 0 deletions pipeline/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def clone_sources():
shutil.rmtree("sources_instances")
Repo.clone_from("https://github.com/openMetadataInitiative/openMINDS_instances.git", to_path="sources_instances", depth=1)


def count_instances(version:str) -> int:
instances_sources = os.path.join(os.path.realpath("."), "sources_instances", "instances", version)
return sum(1 for _ in glob.iglob(os.path.join(instances_sources, '**', '*.jsonld'), recursive=True))

class SchemaLoader(object):

def __init__(self):
Expand Down