8 Commits

16 changed files with 9962 additions and 8934 deletions

View File

@@ -1,5 +1,11 @@
# Changelog # Changelog
## [v0.3.1] - 2026-06-14
- Support for non-consecutive ranges ([#13](https://git.kb28.ch/HEL/rivet-typst/pulls/13))
- Prevent drawing separators on starting lines of fields ([#17](https://git.kb28.ch/HEL/rivet-typst/pulls/17))
- Fix end line on non-consecutive ranges ending at the highest bit not being draw ([#18](https://git.kb28.ch/HEL/rivet-typst/pulls/18))
- Add documentation for `start` property of structures ([61f13df815f](https://git.kb28.ch/HEL/rivet-typst/commit/6f13df815f99fd6be8b6b3a02b4d53bcc8fe0aff))
## [v0.3.0] - 2025-05-03 ## [v0.3.0] - 2025-05-03
- updated CeTZ to 0.3.4 - updated CeTZ to 0.3.4
- updated to Typst 0.13.1 - updated to Typst 0.13.1

View File

@@ -9,7 +9,7 @@ It is based on the [homonymous Python script](https://git.kb28.ch/HEL/rivet/)
<tr> <tr>
<td> <td>
<a href="./gallery/example1.typ"> <a href="./gallery/example1.typ">
<img src="./gallery/example1.png" width="1000px"> <img src="./gallery/example1.png" width="1000px" alt="A black on white diagram showing the bit structure of a machine instruction, detailing operands, flags and selectors.">
</a> </a>
</td> </td>
</tr> </tr>
@@ -19,7 +19,7 @@ It is based on the [homonymous Python script](https://git.kb28.ch/HEL/rivet/)
<tr> <tr>
<td> <td>
<a href="./gallery/example2.typ"> <a href="./gallery/example2.typ">
<img src="./gallery/example2.png" width="1000px"> <img src="./gallery/example2.png" width="1000px" alt="A white on blue diagram showing the bit structure of RISC-V memory instructions, detailing operands, flags and selectors.">
</a> </a>
</td> </td>
</tr> </tr>
@@ -35,7 +35,7 @@ For more information, see the [manual](manual.pdf)
To use this package, simply import `schema` from [rivet](https://typst.app/universe/package/rivet) and call `schema.load` to parse a schema description. Then use `schema.render` to render it, et voilà ! To use this package, simply import `schema` from [rivet](https://typst.app/universe/package/rivet) and call `schema.load` to parse a schema description. Then use `schema.render` to render it, et voilà !
```typ ```typ
#import "@preview/rivet:0.3.0": schema #import "@preview/rivet:0.3.1": schema
#let doc = schema.load(yaml("path/to/schema.yaml")) #let doc = schema.load(yaml("path/to/schema.yaml"))
#schema.render(doc) #schema.render(doc)
``` ```

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#import "../src/lib.typ": schema, config #import "@preview/rivet:0.3.1": schema, config
#let example = schema.load("/gallery/example1.yaml") #let example = schema.load(yaml("./example1.yaml"))
#schema.render(example, config: config.config( #schema.render(example, config: config.config(
full-page: true full-page: true
)) ))

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#import "../src/lib.typ": schema, config #import "@preview/rivet:0.3.1": schema, config
#let example = schema.load("/gallery/example2.yaml") #let example = schema.load(yaml("./example2.yaml"))
#schema.render(example, config: config.blueprint( #schema.render(example, config: config.blueprint(
full-page: true, full-page: true,
left-labels: true left-labels: true

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#import "../src/lib.typ": schema, config #import "@preview/rivet:0.3.1": schema, config
#let example = schema.load("/gallery/example1.yaml") #let example = schema.load(yaml("/gallery/example1.yaml"))
//#schema.render(example) //#schema.render(example)
= Chapter 1 = Chapter 1

View File

@@ -1,14 +1,14 @@
#import "../../src/lib.typ": * #import "@preview/rivet:0.3.1": *
#let conf = config.config( #let conf = config.config(
full-page: true, full-page: true,
left-labels: true left-labels: true
) )
#let alu = schema.load("/gallery/riscv/alu_instr.yaml") #let alu = schema.load(yaml("./alu_instr.yaml"))
#schema.render(alu, config: conf) #schema.render(alu, config: conf)
#let branch = schema.load("/gallery/riscv/branch_instr.yaml") #let branch = schema.load(yaml("./branch_instr.yaml"))
#schema.render(branch, config: conf) #schema.render(branch, config: conf)
#let mem = schema.load("/gallery/riscv/mem_instr.yaml") #let mem = schema.load(yaml("./mem_instr.yaml"))
#schema.render(mem, config: conf) #schema.render(mem, config: conf)

Binary file not shown.

View File

@@ -1,16 +1,17 @@
#import "../src/lib.typ": * #import "@preview/rivet:0.3.1": *
#let test-yaml = schema.load("/gallery/test.yaml") #let test-yaml = schema.load(yaml("./test.yaml"))
#schema.render(test-yaml, config: config.config( #schema.render(test-yaml, config: config.config(
full-page: true full-page: true
)) ))
#let test-json = schema.load("/gallery/test.json") #let test-json = schema.load(json("./test.json"))
#schema.render(test-json, config: config.blueprint( #schema.render(test-json, config: config.blueprint(
full-page: true full-page: true
)) ))
#let test-xml = schema.load("/gallery/test.xml") #let test-xml-raw = schema.xml-loader.parse(xml("./test.xml").first())
#let test-xml = schema.load(test-xml-raw)
#schema.render(test-xml, config: config.dark( #schema.render(test-xml, config: config.dark(
full-page: true full-page: true
)) ))

18840
manual.pdf

File diff suppressed because it is too large Load Diff

View File

@@ -105,7 +105,7 @@ Since the XML format is quite different from the other, you might find it helpfu
A schema contains a dictionary of structures. There must be at least one defined structure named "main". A schema contains a dictionary of structures. There must be at least one defined structure named "main".
It can also optionnaly contain a "colors" dictionary. More details about this in #link(<format-colors>)[Colors] It can also optionally contain a "colors" dictionary. More details about this in #link(<format-colors>)[Colors]
```json ```json
{ {
@@ -363,7 +363,7 @@ structures:
#let x = schema.xml-loader.load("schema.xml") #let x = schema.xml-loader.load("schema.xml")
#let s = schema.load(x) #let s = schema.load(x)
// From file // From file
#let x = schema.xml-loader.parse(yaml("schema.yaml").first()) #let x = schema.xml-loader.parse(xml("schema.xml").first())
#let s = schema.load(x) #let s = schema.load(x)
// Raw block // Raw block
#let s = schema.load(```xml #let s = schema.load(```xml

View File

@@ -1,4 +1,4 @@
#let version = version(0,3,0) #let version = version(0,3,1)
#import "config.typ" #import "config.typ"
#import "schema.typ" #import "schema.typ"

View File

@@ -76,8 +76,9 @@
} }
return ( return (
bits: elmt.attrs.bits, bits: int(elmt.attrs.bits),
ranges: ranges ranges: ranges,
start: elmt.attrs.at("start", default: 0)
) )
} }

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "rivet" name = "rivet"
version = "0.3.0" version = "0.3.1"
compiler = "0.13.1" compiler = "0.13.1"
repository = "https://git.kb28.ch/HEL/rivet-typst" repository = "https://git.kb28.ch/HEL/rivet-typst"
entrypoint = "src/lib.typ" entrypoint = "src/lib.typ"
@@ -9,6 +9,6 @@ authors = [
] ]
categories = [ "visualization" ] categories = [ "visualization" ]
license = "Apache-2.0" license = "Apache-2.0"
description = "Register / Instruction Visualizer & Explainer Tool with Typst, using CeTZ" description = "Register / Instruction Visualizer & Explainer Tool, using CeTZ"
keywords = [ "assembly", "instruction", "binary" ] keywords = [ "assembly", "instruction", "binary" ]
exclude = [ "gallery", "justfile", "docs" ] exclude = [ "gallery", "justfile", "docs" ]