From f672324da643c370cd81bb9f5791b7503950a821 Mon Sep 17 00:00:00 2001 From: Kristaps Jurkans Date: Thu, 16 Oct 2025 00:35:54 +0100 Subject: [PATCH] fix(docs): ensure datasheet can use images properly (#125) (cherry picked from commit 8132ad6ecc9a6d302d34274025bde8c79828a878) --- docs/typst/chapters/pinout.typ | 4 +++- docs/typst/chapters/tt-multiplexer.typ | 15 +++++---------- docs/typst/src/datasheet.typ | 14 +++++++------- docs/typst/src/lib.typ | 25 +++++-------------------- 4 files changed, 20 insertions(+), 38 deletions(-) diff --git a/docs/typst/chapters/pinout.typ b/docs/typst/chapters/pinout.typ index 6fe4c79..432296a 100644 --- a/docs/typst/chapters/pinout.typ +++ b/docs/typst/chapters/pinout.typ @@ -1,8 +1,10 @@ +#import "../src/lib.typ": get_image_by_id + = Pinout The chip is packaged in a 64-pin QFN package. The pinout is shown below. -#align(center, image("../resources/images/tt-qfn-64.svg")) +#align(center, get_image_by_id("images", "chip_pinout_qfn64")) Note: You will receive the chip mounted on a breakout board (#link("https://github.com/tinytapeout/breakout-pcb")[github.com/tinytapeout/breakout-pcb]). diff --git a/docs/typst/chapters/tt-multiplexer.typ b/docs/typst/chapters/tt-multiplexer.typ index b5d85f0..150d18d 100644 --- a/docs/typst/chapters/tt-multiplexer.typ +++ b/docs/typst/chapters/tt-multiplexer.typ @@ -1,3 +1,5 @@ +#import "../src/lib.typ": get_image_by_id + = The Tiny Tapeout Multiplexer == Overview The Tiny Tapeout Multiplexer distributes a single set of user IOs to multiple user designs. It is the backbone of the @@ -36,24 +38,17 @@ For instance, to select the design at address 12, you need to pulse `sel_rst_n` #figure( caption: [Mux signals for activating the design at address 12], - - align(center)[ - #image("../resources/images/mux_select_addr_12.svg") - ] + align(center, get_image_by_id("images", "mux_address_select_waveform")) ) #figure( caption: [Mux Diagram], - align(center)[ - #image("../resources/images/mux_diagram.svg", height: 55%) - ] + align(center, get_image_by_id("images", "mux_diagram", height: 55%)) ) #figure( caption: [Mux Controller Diagram], - align(center)[ - #image("../resources/images/mux_controller.png") - ] + align(center, get_image_by_id("images", "mux_controller")) ) Internally, the controller is just a chain of 10 D-flip-flops. The `sel_inc` signal is connected to the clock of the diff --git a/docs/typst/src/datasheet.typ b/docs/typst/src/datasheet.typ index 6124381..0588ba3 100644 --- a/docs/typst/src/datasheet.typ +++ b/docs/typst/src/datasheet.typ @@ -65,9 +65,9 @@ let logo = box(baseline: 0.25em, { if invert_text_colour { - image("../resources/logos/tt-logo-white.svg", height: 25%) + get_image_by_id("logos", "tt_roundel_white", height: 25%) } else { - image("../resources/logos/tt-logo-black.svg", height: 25%) + get_image_by_id("logos", "tt_roundel_black", height: 25%) } }) @@ -246,7 +246,7 @@ let pattern = tiling( size: (3cm, 3cm), spacing: (1cm, 1cm), - image("../resources/logos/tt-logo-light-grey.svg") + get_image_by_id("logos", "tt_roundel_light_grey") ) page( @@ -309,18 +309,18 @@ // make titlepage if theme == "classic" { - image("../resources/logos/tt-logo-colourful.png") + get_image_by_id("logos", "tt_square_colourful") cover_text } else if theme == "bold" { set page( - background: image("../resources/backgrounds/colourful-background-gds-o10-bw.png", height: 100%), + background: get_image_by_id("backgrounds", "gds_bw_transparent", height: 100%), fill: selected_theme_colour ) align( center + horizon, - image("../resources/logos/tt-logo-white.svg", height: 60%) + get_image_by_id("logos", "tt_roundel_white", height: 60%) ) set text(white) @@ -329,7 +329,7 @@ } else if theme == "monochrome" { align( center + horizon, - image("../resources/logos/tt-logo-black.svg", height: 60%) + get_image_by_id("logos", "tt_roundel_black", height: 60%) ) cover_text } diff --git a/docs/typst/src/lib.typ b/docs/typst/src/lib.typ index 71f1f9e..1883d0a 100644 --- a/docs/typst/src/lib.typ +++ b/docs/typst/src/lib.typ @@ -124,29 +124,14 @@ // external manifest is used for artwork repo // since large photos would bloat the template size - let external_manifest = yaml("../resources/external/manifest.yaml") - let local_manifest = yaml("../resources/manifest.yaml") - let combined_manifest = (:) + let manifest = yaml("../resources/external/manifest.yaml") - // combine the two - for (k, v) in local_manifest.pairs() { - combined_manifest.insert(k, v) + if type not in manifest { + panic("type not in manifest") } - for (k, v) in external_manifest.pairs() { - combined_manifest.insert(k, v) - } - - if type not in combined_manifest { - panic("type not in either local or external manifest") - } - - let root_path = "../resources" - if type in external_manifest { - root_path += "/external" - } - - let img_details = combined_manifest.at(type).at(id) + let root_path = "../resources/external" + let img_details = manifest.at(type).at(id) // make image image(root_path + "/" + type + "/" + img_details.file, ..args)