Skip to content

Commit

Permalink
Bumped to 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jomaway committed Nov 20, 2023
1 parent 0ab09d0 commit cf770bd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bytefield(

## Usage

To use this library through the Typst package manager (for Typst v0.6.0+), import bytefield with `#import "@preview/bytefield:0.0.2": *` at the top of your file.
To use this library through the Typst package manager (for Typst v0.6.0+), import bytefield with `#import "@preview/bytefield:0.0.3": *` at the top of your file.

The package contains some of the most common network protocol headers: `ipv4`, `ipv6`, `icmp`, `icmpv6`, `dns`, `tcp`, `udp`.

Expand All @@ -43,7 +43,7 @@ At the moment very limited features. Feel free to extend if you like.

## Changelog

### v0.0.3 (WIP)
### v0.0.3

- Added "smart" bit headers thanks to [hgruniaux](https://github.com/hgruniaux)
- Added "smart-firstline" to only consider the first row for calculation.
Expand Down
11 changes: 7 additions & 4 deletions bytefield.typ
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@

let bitheader_font_size = 9pt;
let bh_num_text(num) = {
let alignment = if (msb_first) {
if (num == 0) {end} else if (num == (bits - 1)) { start } else { center }
} else {
if (num == (bits - 1)) {end} else if (num == 0) { start } else { center }
let alignment = if (bitheader == "all") {center}
else {
if (msb_first) {
if (num == 0) {end} else if (num == (bits - 1)) { start } else { center }
} else {
if (num == (bits - 1)) {end} else if (num == 0) { start } else { center }
}
}

align(alignment, text(bitheader_font_size)[#num]);
Expand Down
Binary file modified example.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion example.typ
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "@local/bytefield:0.0.2": *
#import "@local/bytefield:0.0.3": *

= Bytefield
== Colored Example
Expand Down
4 changes: 2 additions & 2 deletions typst.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name="bytefield"
version = "0.0.2"
version = "0.0.3"
entrypoint = "bytefield.typ"
authors = ["Jomaway <https://github.com/jomaway>"]
license = "MIT"
description = "A package to create network protocol headers"
repository = "https://github.com/jomaway/typst-bytefield"
keywords = ["bytefields", "protocol", "header"]
compiler = "0.8.0"
exclude = ["example.typ", "ipv4-example.png"]
exclude = ["example.typ","example.pdf", "ipv4-example.png"]

0 comments on commit cf770bd

Please sign in to comment.