mirror of
https://github.com/TinyTapeout/tt-support-tools.git
synced 2026-11-03 04:36:09 +01:00
cleanup(website): remove hugo related functionality
Project pages are now dynamically generated based on the shuttle index.
This commit is contained in:
@@ -268,9 +268,6 @@ if __name__ == "__main__":
|
||||
"--dump-markdown", help="dump markdown of all project data to given file"
|
||||
)
|
||||
parser.add_argument("--dump-pdf", help="create pdf from the markdown")
|
||||
parser.add_argument(
|
||||
"--build-hugo-content", help="directory to where to build hugo content"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--metrics", help="print some project metrics", action="store_const", const=True
|
||||
)
|
||||
@@ -330,7 +327,3 @@ if __name__ == "__main__":
|
||||
if args.dump_markdown:
|
||||
shuttle.configure_mux()
|
||||
docs.write_datasheet(args.dump_markdown, args.dump_pdf)
|
||||
|
||||
if args.build_hugo_content:
|
||||
shuttle.configure_mux()
|
||||
docs.build_hugo_content(args.build_hugo_content)
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
---
|
||||
title: "{{shuttle_name}}"
|
||||
weight: 50
|
||||
description: {{project_count}} designs, closed {{end_date}}
|
||||
---
|
||||
|
||||
{{#hugo}}% toc %{{/hugo}}
|
||||
|
||||
# Design details
|
||||
|
||||
* [Github repository](https://github.com/TinyTapeout/tinytapeout-07)
|
||||
* [PDF datasheet](https://tinytapeout.github.io/tinytapeout-07/datasheet.pdf)
|
||||
* [Efabless MPW submission](https://repositories.efabless.com/urish/tinytapeout-07)
|
||||
* [Shuttle index (JSON)](https://tinytapeout.github.io/tinytapeout-07/shuttle_index.json)
|
||||
|
||||
# Launch stats
|
||||
|
||||
* Launched: 22 April 2024
|
||||
* Submission closed: 1 June 2024
|
||||
* Submitted to Efabless [2406C chipIgnite](https://efabless.com/shuttle-status) shuttle using Skywater 130nm open source PDK
|
||||
* Chips expected November 2024, PCBs expected December 2024
|
||||
|
||||
# Chip map
|
||||
|
||||
{{#hugo}}< shuttle-map "{{shuttle_id}}" >{{/hugo}}
|
||||
|
||||
@@ -1,39 +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 |
|
||||
| ------------- | -------- | -------- | --------------- |
|
||||
{{#pins}}
|
||||
| {{pin_index}} | {{&ui}} | {{&uo}} | {{&uio}} |
|
||||
{{/pins}}
|
||||
|
||||
{{#is_analog}}
|
||||
### Analog pins
|
||||
|
||||
| `ua`# | `analog`# | Description |
|
||||
| ------------ | ---------------- | ------------------- |
|
||||
{{#analog_pins}}
|
||||
| {{ua_index}} | {{analog_index}} | {{&desc}} |
|
||||
{{/analog_pins}}
|
||||
{{/is_analog}}
|
||||
|
||||
### Chip location
|
||||
|
||||
{{#hugo}}< shuttle-map "{{shuttle_id}}" "{{mux_address}}" >{{/hugo}}
|
||||
+1
-91
@@ -1,6 +1,5 @@
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from typing import List, Optional
|
||||
|
||||
@@ -10,7 +9,7 @@ import git # type: ignore
|
||||
|
||||
from config import Config
|
||||
from git_utils import get_first_remote
|
||||
from markdown_utils import rewrite_image_paths, rewrite_image_paths_for_website
|
||||
from markdown_utils import rewrite_image_paths
|
||||
from project import Project
|
||||
|
||||
|
||||
@@ -161,92 +160,3 @@ class Docs:
|
||||
if p.returncode != 0:
|
||||
logging.error("pdf generation failed")
|
||||
raise RuntimeError(f"pdf generation failed with code {p.returncode}")
|
||||
|
||||
def build_hugo_content(self, hugo_root: str) -> None:
|
||||
hugo_images = os.path.join(hugo_root, "images")
|
||||
shutil.rmtree(hugo_root)
|
||||
os.makedirs(hugo_root)
|
||||
os.makedirs(hugo_images)
|
||||
|
||||
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.mustache")
|
||||
) as fh:
|
||||
index_template = fh.read()
|
||||
|
||||
# copy image
|
||||
# TODO, need to get image from somewhere
|
||||
# shutil.copyfile(
|
||||
# "tt/docs/pics/tinytapeout_numbered.png",
|
||||
# os.path.join(hugo_images, f'tinytapeout-{self.config["id"]}.png'),
|
||||
# )
|
||||
|
||||
# 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"],
|
||||
"project_count": len(self.projects),
|
||||
"end_date": self.config["end_date"],
|
||||
}
|
||||
with open(os.path.join(hugo_root, "_index.md"), "w") as fh:
|
||||
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")
|
||||
self.projects.sort(key=lambda x: x.mux_address)
|
||||
for project in self.projects:
|
||||
logging.info(project)
|
||||
fh.write(project.get_hugo_row())
|
||||
|
||||
project_dir = os.path.join(hugo_root, f"{project.mux_address :03}")
|
||||
project_image_dir = os.path.join(project_dir, "images")
|
||||
os.makedirs(project_dir)
|
||||
os.makedirs(project_image_dir)
|
||||
yaml_data = project.get_project_docs_dict()
|
||||
analog_pins = project.info.analog_pins
|
||||
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)
|
||||
],
|
||||
"analog_pins": [
|
||||
{
|
||||
"ua_index": str(i),
|
||||
"analog_index": str(project.analog_pins[i]),
|
||||
"desc": desc,
|
||||
}
|
||||
for i, desc in enumerate(
|
||||
project.info.pinout.ua[:analog_pins]
|
||||
)
|
||||
],
|
||||
"is_analog": analog_pins > 0,
|
||||
}
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
@@ -78,12 +78,3 @@ class WebsiteImagePathRewriterRenderer(MarkdownRenderer):
|
||||
url = f"images/{filename}"
|
||||
token["attrs"]["url"] = url
|
||||
return super().image(token, state)
|
||||
|
||||
|
||||
def rewrite_image_paths_for_website(
|
||||
source: str, source_dir: str, target_dir: str
|
||||
) -> str:
|
||||
markdown = mistune.create_markdown(
|
||||
renderer=WebsiteImagePathRewriterRenderer(source_dir, target_dir)
|
||||
)
|
||||
return unescape_braces(markdown(source))
|
||||
|
||||
@@ -255,9 +255,6 @@ class Project:
|
||||
if num_cells < 11:
|
||||
logging.warning(f"{self} only has {num_cells} cells")
|
||||
|
||||
def get_hugo_row(self) -> str:
|
||||
return f"| {self.mux_address} | [{self.info.title}]({self.mux_address :03}) | {self.info.author}|\n"
|
||||
|
||||
# docs stuff for index on README.md
|
||||
def get_index_row(self):
|
||||
return f"| {self.mux_address} | {self.info.author} | {self.info.title} | {self.get_project_type_string()} | {self.git_url} |\n"
|
||||
|
||||
Reference in New Issue
Block a user