Skip to content

Commit 22bf616

Browse files
committed
Clean-up Example and Schema pages.
1 parent 3fee9fd commit 22bf616

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

lattice/docs/hugo_layouts/404.html

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{{ define "main" }}
22
{{ with .Content }}
3-
<div class="td-content">
4-
{{ . }}
5-
</div>
3+
<main id="main">
4+
<div class="td-content">
5+
{{ . }}
6+
</div>
7+
</main>
68
{{ end }}
79
{{ end }}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{{ define "main" }}
22
{{ with .Content }}
3-
<div class="td-content">
4-
{{ . }}
5-
</div>
3+
<main id="main">
4+
<div class="td-content">
5+
{{ . }}
6+
</div>
7+
</main>
68
{{ end }}
79
{{ end }}

lattice/docs/hugo_web.py

+20-5
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,21 @@ def make_schema_page(self):
190190
}
191191
schema_assets_directory = os.path.join(self.static_assets_directory_path,"schema")
192192
make_dir(schema_assets_directory)
193+
references = {}
194+
reference_counter = 1
195+
reference_string = "\n"
193196
for schema in self.lattice.schemas:
194197
content = load(schema.json_schema_path)
195198
output_path = os.path.join(schema_assets_directory, get_file_basename(schema.json_schema_path))
196199
shutil.copy(schema.json_schema_path, output_path)
197-
schema_files["Schema"].append(f"[{content['title']}](/{self.git_repo_name}/{os.path.relpath(output_path, self.static_directory_path)})")
200+
references[reference_counter] = f"/{self.git_repo_name}/{os.path.relpath(output_path, self.static_directory_path)}"
201+
schema_files["Schema"].append(f"[{content['title']}][{reference_counter}]")
202+
reference_string += f"\n[{reference_counter}]: {references[reference_counter]}"
203+
reference_counter += 1
198204
schema_files["Description"].append(content["description"])
199205

200-
self.make_main_menu_page(self.schema_directory_path,"Schema",content=write_table(schema_files,["Schema","Description"]))
206+
content = "# JSON Schema\n\n" + write_table(schema_files,["Schema","Description"]) + reference_string + "\n"
207+
self.make_main_menu_page(self.schema_directory_path,"Schema",content=content)
201208

202209
def make_examples_page(self):
203210
example_files = {
@@ -207,21 +214,29 @@ def make_examples_page(self):
207214
}
208215
example_assets_directory = os.path.join(self.static_assets_directory_path,"examples")
209216
make_dir(example_assets_directory)
217+
references = {}
218+
reference_counter = 1
219+
reference_string = "\n"
210220
for example in self.lattice.examples:
211221
content = load(example)
212222
file_base_name = get_file_basename(example, depth=1)
213-
formats = ['json', 'yaml', 'cbor']
223+
formats = ['yaml', 'json', 'cbor']
214224
output_path = {}
215225
web_links = {}
216226
for format in formats:
217227
output_path[format] = os.path.join(example_assets_directory, f"{file_base_name}.{format}")
218-
web_links[format] = f"[{format.upper()}](/{self.git_repo_name}/{os.path.relpath(output_path[format], self.static_directory_path)})"
228+
references[reference_counter] = f"/{self.git_repo_name}/{os.path.relpath(output_path[format], self.static_directory_path)}"
229+
web_links[format] = f"[{format.upper()}][{reference_counter}]"
230+
reference_string += f"\n[{reference_counter}]: {references[reference_counter]}"
231+
reference_counter += 1
219232
translate(example, output_path[format])
220233
example_files["File Name"].append(file_base_name)
221234
example_files["Description"].append(content["metadata"]["description"])
222235
example_files["Download"].append(f"{web_links['yaml']} {web_links['json']} {web_links['cbor']}")
223236

224-
self.make_main_menu_page(self.examples_directory_path,"Examples",content=write_table(example_files,["File Name","Description","Download"]))
237+
238+
content = "# Example Files\n\n" + write_table(example_files,["File Name","Description","Download"]) + reference_string + "\n"
239+
self.make_main_menu_page(self.examples_directory_path,"Examples",content=content)
225240

226241
def make_page(self, page_path, front_matter, content=""):
227242
with open(page_path,'w') as file:

0 commit comments

Comments
 (0)