5 Commits

17 changed files with 20 additions and 20 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
## [v0.1.0] - 2024-10-02
- prepared for publication in Typst Universe
## [v0.0.2] - 2024-06-15 ## [v0.0.2] - 2024-06-15
### Added ### Added
- `width` parameter to `schema.render` for easier integration - `width` parameter to `schema.render` for easier integration

View File

@ -31,14 +31,11 @@ It is based on the [homonymous Python script](https://git.kb28.ch/HEL/rivet/)
*Click on the example image to jump to the code.* *Click on the example image to jump to the code.*
## Usage ## Usage
For information, see the [manual](manual.pdf) For more information, see the [manual](manual.pdf)
To use this package, simply import `schema` [src/lib.typ](src/lib.typ) 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 "src/lib.typ": schema #import "@preview/rivet:0.1.0": schema
#let doc = schema.load("path/to/schema.yaml") #let doc = schema.load("path/to/schema.yaml")
#schema.render(doc) #schema.render(doc)
``` ```
## Installing
> TODO

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.2.2": draw #import "@preview/cetz:0.3.1": draw
#import "../src/lib.typ": schema #import "../src/lib.typ": schema
#import "../src/util.typ" #import "../src/util.typ"

10
gallery.bash Normal file → Executable file
View File

@ -16,7 +16,7 @@ cnt="$#"
i=1 i=1
for f for f
do do
f2="${f/typ/png}" f2="${f%.typ}.png"
echo "($i/$cnt) $f -> $f2" echo "($i/$cnt) $f -> $f2"
typst c --root ./ "$f" "$f2" typst c --root ./ "$f" "$f2"
i=$((i+1)) i=$((i+1))
@ -27,12 +27,12 @@ then
echo echo
echo "Generating gallery PDFs" echo "Generating gallery PDFs"
set -- ./gallery/*.typ files=$(find ./gallery -type f -name "*.typ")
cnt="$#" cnt=$(echo "$files" | wc -l)
i=1 i=1
for f for f in $files
do do
f2="${f/typ/pdf}" f2="${f%.typ}.pdf"
echo "($i/$cnt) $f -> $f2" echo "($i/$cnt) $f -> $f2"
typst c --root ./ "$f" "$f2" typst c --root ./ "$f" "$f2"
i=$((i+1)) i=$((i+1))

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 KiB

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

After

Width:  |  Height:  |  Size: 303 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 KiB

After

Width:  |  Height:  |  Size: 490 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -53,7 +53,7 @@ This is a port of the #link("https://git.kb28.ch/HEL/rivet")[homonymous Python s
Simply import `schema` from #link("src/lib.typ") and call `schema.load` to parse a schema description. Then use `schema.render` to render it, et voilà ! Simply import `schema` from #link("src/lib.typ") and call `schema.load` to parse a schema description. Then use `schema.render` to render it, et voilà !
#pad(left: 1em)[```typ #pad(left: 1em)[```typ
#import "src/lib.typ": schema #import "@preview/rivet:0.1.0": schema
#let doc = schema.load("path/to/schema.yaml") #let doc = schema.load("path/to/schema.yaml")
#schema.render(doc) #schema.render(doc)
```] ```]

View File

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

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.2.2": canvas, draw #import "@preview/cetz:0.3.1": canvas, draw
#import "range.typ" as rng #import "range.typ" as rng
#import "structure.typ" #import "structure.typ"
@ -373,7 +373,7 @@
// Draw rectangle around structure // Draw rectangle around structure
shapes += draw-rect(border-col, bits-x, bits-y, bits-width, bit-h, thickness: 2) shapes += draw-rect(border-col, bits-x, bits-y, bits-width, bit-h, thickness: 2)
let indices = range(struct.bits) let indices = range(struct.start, struct.start + struct.bits)
if not config.all-bit-i { if not config.all-bit-i {
indices = () indices = ()
for r in struct.ranges.values() { for r in struct.ranges.values() {

View File

@ -1,7 +1,7 @@
[package] [package]
name = "rivet" name = "rivet"
version = "0.0.2" version = "0.2.0"
compiler = "0.11.0" compiler = "0.12.0"
repository = "https://git.kb28.ch/HEL/rivet-typst" repository = "https://git.kb28.ch/HEL/rivet-typst"
entrypoint = "src/lib.typ" entrypoint = "src/lib.typ"
authors = [ authors = [
@ -11,4 +11,4 @@ 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 with Typst, using CeTZ"
keywords = [ "assembly", "instruction", "binary" ] keywords = [ "assembly", "instruction", "binary" ]
exclude = [ "/gallery/*" ] exclude = [ "gallery", "gallery.bash", "docs" ]