mirror of
https://github.com/TinyTapeout/tt-support-tools.git
synced 2026-11-03 04:36:09 +01:00
feat(datasheet): use mustache for hugo_template
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
---
|
||||
title: "{shuttle_name}"
|
||||
title: "{{shuttle_name}}"
|
||||
weight: 50
|
||||
description: {project_count} designs, closed {end_date}
|
||||
description: {{project_count}} designs, closed {{end_date}}
|
||||
---
|
||||
|
||||
{{{{% toc %}}}}
|
||||
{{#hugo}}% toc %{{/hugo}}
|
||||
|
||||
# Design details
|
||||
|
||||
@@ -22,5 +22,5 @@ description: {project_count} designs, closed {end_date}
|
||||
|
||||
# Chip map
|
||||
|
||||
{{{{< shuttle-map "{shuttle_id}" >}}}}
|
||||
{{#hugo}}< shuttle-map "{shuttle_id}" >{{/hugo}}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
---
|
||||
hidden: true
|
||||
title: "{mux_address} {title}"
|
||||
weight: {weight}
|
||||
---
|
||||
|
||||
## {mux_address} : {title}
|
||||
|
||||
* Author: {author}
|
||||
* Description: {description}
|
||||
* [GitHub repository]({git_url})
|
||||
* [GDS submitted]({git_action})
|
||||
* {project_type} project
|
||||
* [Extra docs]({doc_link})
|
||||
* Clock: {clock_hz} Hz
|
||||
|
||||
{user_docs}
|
||||
|
||||
### IO
|
||||
|
||||
| # | Input | Output | Bidirectional |
|
||||
| - | -------------- | -------------- | --------------- |
|
||||
| 0 | {pinout.ui[0]} | {pinout.uo[0]} | {pinout.uio[0]} |
|
||||
| 1 | {pinout.ui[1]} | {pinout.uo[1]} | {pinout.uio[1]} |
|
||||
| 2 | {pinout.ui[2]} | {pinout.uo[2]} | {pinout.uio[2]} |
|
||||
| 3 | {pinout.ui[3]} | {pinout.uo[3]} | {pinout.uio[3]} |
|
||||
| 4 | {pinout.ui[4]} | {pinout.uo[4]} | {pinout.uio[4]} |
|
||||
| 5 | {pinout.ui[5]} | {pinout.uo[5]} | {pinout.uio[5]} |
|
||||
| 6 | {pinout.ui[6]} | {pinout.uo[6]} | {pinout.uio[6]} |
|
||||
| 7 | {pinout.ui[7]} | {pinout.uo[7]} | {pinout.uio[7]} |
|
||||
|
||||
### Chip location
|
||||
|
||||
{{{{< shuttle-map "{shuttle_id}" "{mux_address}" >}}}}
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
hidden: true
|
||||
title: "{{mux_address}} {{title}}"
|
||||
weight: {{weight}}
|
||||
---
|
||||
|
||||
## {{mux_address}} : {{title}}
|
||||
|
||||
* Author: {{author}}
|
||||
* Description: {{&description}}
|
||||
* [GitHub repository]({{git_url}})
|
||||
* [GDS submitted]({{git_action}})
|
||||
* {{project_type}} project
|
||||
* [Extra docs]({{doc_link}})
|
||||
* Clock: {{clock_hz}} Hz
|
||||
|
||||
{{&user_docs}}
|
||||
|
||||
### IO
|
||||
|
||||
| # | Input | Output | Bidirectional |
|
||||
| ------------- | -------- | -------- | --------------- |
|
||||
{{#pins}}
|
||||
| {{pin_index}} | {{&ui}} | {{&uo}} | {{&uio[0]}} |
|
||||
{{/pins}}
|
||||
|
||||
### Chip location
|
||||
|
||||
{{#hugo}}< shuttle-map "{{shuttle_id}}" "{{mux_address}}" >{{/hugo}}
|
||||
+28
-10
@@ -152,11 +152,13 @@ class Docs:
|
||||
os.makedirs(hugo_root)
|
||||
os.makedirs(hugo_images)
|
||||
|
||||
with open(os.path.join(self.script_dir, "docs", "hugo_template.md")) as fh:
|
||||
with open(
|
||||
os.path.join(self.script_dir, "docs", "hugo_template.md.mustache")
|
||||
) as fh:
|
||||
doc_template = fh.read()
|
||||
|
||||
with open(
|
||||
os.path.join(self.script_dir, "docs", "hugo_index_template.md")
|
||||
os.path.join(self.script_dir, "docs", "hugo_index_template.md.mustache")
|
||||
) as fh:
|
||||
index_template = fh.read()
|
||||
|
||||
@@ -169,6 +171,7 @@ class Docs:
|
||||
|
||||
# index page
|
||||
logging.info("building pages")
|
||||
hugo_tag = {"hugo": lambda text, render: "{{" + render(text) + "}}"}
|
||||
shuttle_info = {
|
||||
"shuttle_name": self.config["name"],
|
||||
"shuttle_id": self.config["id"],
|
||||
@@ -176,7 +179,8 @@ class Docs:
|
||||
"end_date": self.config["end_date"],
|
||||
}
|
||||
with open(os.path.join(hugo_root, "_index.md"), "w") as fh:
|
||||
fh.write(index_template.format(**shuttle_info))
|
||||
shuttle_info.update(hugo_tag)
|
||||
fh.write(chevron.render(index_template, shuttle_info))
|
||||
fh.write("# All projects\n")
|
||||
fh.write("| Index | Title | Author |\n")
|
||||
fh.write("| ----- | ----- | -------|\n")
|
||||
@@ -190,17 +194,31 @@ class Docs:
|
||||
os.makedirs(project_dir)
|
||||
os.makedirs(project_image_dir)
|
||||
yaml_data = project.get_project_docs_dict()
|
||||
yaml_data["mux_address"] = project.mux_address
|
||||
yaml_data["index"] = project.index
|
||||
yaml_data["weight"] = project.index + 1
|
||||
yaml_data["git_action"] = project.get_workflow_url_when_submitted()
|
||||
yaml_data["shuttle_id"] = self.config["id"]
|
||||
yaml_data["user_docs"] = rewrite_image_paths_for_website(
|
||||
yaml_data.update(
|
||||
{
|
||||
"mux_address": project.mux_address,
|
||||
"index": project.index,
|
||||
"weight": project.index,
|
||||
"git_action": project.get_workflow_url_when_submitted(),
|
||||
"shuttle_id": self.config["id"],
|
||||
"user_docs": rewrite_image_paths_for_website(
|
||||
yaml_data["user_docs"],
|
||||
os.path.join(project.src_dir, "docs"),
|
||||
project_image_dir,
|
||||
),
|
||||
"pins": [
|
||||
{
|
||||
"pin_index": str(i),
|
||||
"ui": project.info.pinout.ui[i],
|
||||
"uo": project.info.pinout.uo[i],
|
||||
"uio": project.info.pinout.uio[i],
|
||||
}
|
||||
for i in range(8)
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
doc = doc_template.format(**yaml_data)
|
||||
yaml_data.update(hugo_tag)
|
||||
doc = chevron.render(doc_template, yaml_data)
|
||||
with open(os.path.join(project_dir, "_index.md"), "w") as pfh:
|
||||
pfh.write(doc)
|
||||
|
||||
Reference in New Issue
Block a user