From cf770bddc6b007a7f7ca7e08fbf15f22087b064b Mon Sep 17 00:00:00 2001 From: jomaway Date: Mon, 20 Nov 2023 18:04:59 +0100 Subject: [PATCH] Bumped to 0.0.3 --- README.md | 4 ++-- bytefield.typ | 11 +++++++---- example.pdf | Bin 78677 -> 78673 bytes example.typ | 2 +- typst.toml | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b65b8cc..1ea567c 100644 --- a/README.md +++ b/README.md @@ -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`. @@ -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. diff --git a/bytefield.typ b/bytefield.typ index a52d90f..92f6d8f 100644 --- a/bytefield.typ +++ b/bytefield.typ @@ -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]); diff --git a/example.pdf b/example.pdf index f23b4661446a4444c30c3d9838d7b620a861891e..e3821c8dc25aa159fdf5dc9f515d4a3d20c1d757 100644 GIT binary patch delta 2990 zcmZuxc{tQ-8}29TG=z!9M2)e{SZ7}_mJu3~329CX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F=0j@pDh|qn&DTS)6%GI1^a;>G`}@N^EPRp6%vARUdW%!Acano7^H(VLBf_ zE*wlAF3d1nA%{l~->1~Cy{QqM%!nUF<44KY~SR zl{Elg(39J}!^JtdD(uRVR)E}J6{IeaQ9IX@SB)e-uv&{N^j8y4a(a(4SS1-#HR|4; z?_w2TovXamt^+19Pb;iHqk$J-9E z4pGtXBWy(6$n}VdUCy012D#QBE!#B8C;WmRJUWX9p4(^fsy#P~nsb(mM}ch@TIfByMq)vPJr>Tb|^1k_fEE>=D#Rv!$$RxmgDP^^vl z*V>mGjtsXtWLo1#!myHkqs zvdpY$L`IX!pJT{h(f1DvDPY@6zblVB7mmoTI>P#U`&nb&>lR?4X0$)+3@TF1sHnTGvt)~`V| zEcXRKheCps+JT_6qc{6#wMMpJj=it}0p12mYZOtiwR`*8!U5}7x*M%pN& z3rT6m2mBDQU}MgDRx)WOFnxw$o9FaZ6%SlkF2jFc3sx&jN@KqJWy)Azx%MCr(9(C& zOVHao06uV98#r39_uZbB`QKL-I#Ntn_R$xn8$vw3_B&J@eTLCFdb#+g)U~+v+Lja{ zfQW_&9*f1H={Z^e#eZ*GZfgOYfTDOqEY@(#*wg{&|M!5=1$^9n%q4+{BYDKSQjX}@ z1lU+(-R*Sj%v(@;fJ6WgjiT4;12lqBXf@Z3=-KwG63`esDy1Eo=75Y*9b@q0kthhKw;54G&~Z$vv(3<2M>$F{73Wo z-;h`|en+F&t>pH?SR8Ig5iFjB-H{_=aP%n@V3!GLyM;sHcOY(irT>8j_+kG4S1~cs@&=R1;Fwsy=-7nl SpkOe8fW?x)aJaRL%|8IeM&}3s diff --git a/example.typ b/example.typ index d71407e..2675b50 100644 --- a/example.typ +++ b/example.typ @@ -1,4 +1,4 @@ -#import "@local/bytefield:0.0.2": * +#import "@local/bytefield:0.0.3": * = Bytefield == Colored Example diff --git a/typst.toml b/typst.toml index 3640481..54888bb 100644 --- a/typst.toml +++ b/typst.toml @@ -1,6 +1,6 @@ [package] name="bytefield" -version = "0.0.2" +version = "0.0.3" entrypoint = "bytefield.typ" authors = ["Jomaway "] license = "MIT" @@ -8,4 +8,4 @@ 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"] \ No newline at end of file +exclude = ["example.typ","example.pdf", "ipv4-example.png"] \ No newline at end of file