Skip to content

Commit

Permalink
and the ref back to the library from the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
lzehl committed Jul 14, 2023
1 parent 2c2cd23 commit 1b71d7f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pipeline/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ def build(self):
with open(target_file, "w") as output_file:
doc = RstCloth(output_file, line_width=100000)
schema_name = self._schema_payload["name"]
schema_name_camelCase = "".join([schema_name[0].lower, schema_name[1:]])
doc.heading(schema_name, char="#", overline=True)
doc.newline()
doc.heading(self._schema_payload["_type"], char="-")
doc.field(name="Semantic name:", value=self._schema_payload["_type"])
doc.newline()
if "description" in self._schema_payload and self._schema_payload["description"]:
doc.content(self._schema_payload["description"])
Expand All @@ -36,11 +37,22 @@ def build(self):
if semantic_equivalent:
doc.field(name="Semantic equivalents:", value=semantic_equivalent)
doc.newline()
doc.newline()# https://openminds-documentation.readthedocs.io/en/latest/libraries/terminologies/actionStatusType.html#actionstatustype
if "controlledTerms" in self._schema_payload["name"]:
library_subdir = f"terminologies/{schema_name_camelCase}.html"
library_link = os.path.join(self.readthedocs_url, self.version, "libraries", library_subdir)
doc.content(f"For this schema openMINDS provides a `library of instances <{library_link}>`_.")
doc.newline()
if schema_name_camelCase in ["license", "contentType"]:
library_subdir = f"{schema_name_camelCase}s.html"
library_link = os.path.join(self.readthedocs_url, self.version, "libraries", library_subdir)
doc.content(f"For this schema openMINDS provides a `library of instances <{library_link}>`_.")
doc.newline()
doc.content("------------")
doc.newline()
doc.content("------------")
doc.newline()
doc.heading("Properties", char="*", overline=True)
doc.heading("Properties", char="#")
doc.newline()
doc.field(name="Required", value=self._extract_required_properties())
doc.field(name="Optional", value=self._extract_optional_properties())
Expand All @@ -53,7 +65,7 @@ def build(self):
p_name = p_info["name"]
doc.content(f".. _{p_name}_heading:")
doc.newline()
doc.heading(p_name, char="-")
doc.heading(p_name, char="*", overline=True)
doc.newline()
# property subsection description
if "description" in p_info.keys():
Expand Down

0 comments on commit 1b71d7f

Please sign in to comment.