From f9c3d1262b0484af90e946a74540c06e0cc75d47 Mon Sep 17 00:00:00 2001 From: jchv Date: Wed, 14 Jun 2023 22:55:24 -0400 Subject: [PATCH] Add size/repeat info to fields. (#50) --- package-lock.json | 20 ++++++++++++++------ package.json | 1 + src/templates/partials/struct.html | 6 +++--- src/templates/partials/type_link.html | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4bc9d2e..6a8e725 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "highlight.js": "^11.8.0", "js-yaml": "^4.1.0", "kaitai-struct-compiler": "^0.10.0", "parcel-bundler": "^1.12.5", @@ -4324,11 +4325,11 @@ "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==" }, "node_modules/highlight.js": { - "version": "10.7.3", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", - "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.8.0.tgz", + "integrity": "sha512-MedQhoqVdr0U6SSnWPzfiadUcDHfN/Wzq25AkXiQv9oiOO/sG0S7XkvpFIqWBl9Yq1UYyYOOVORs5UW2XlPyzg==", "engines": { - "node": "*" + "node": ">=12.0.0" } }, "node_modules/hmac-drbg": { @@ -5788,8 +5789,7 @@ }, "node_modules/parcel-plugin-pangdox": { "version": "0.0.4", - "resolved": "git+https://git@github.com/pangbox/parcel-plugin-pangdox.git#d7c80801d481fcc7849d0619ddbf61e5324ad5a6", - "integrity": "sha512-JRZz4UViU2rG6v67S+rXtS8vfq8LcqKO5tpLcHWxd6lX090aRQJ7GDOoNQBIrCEgj77SVleMu2W2X70Rp+QDJQ==", + "resolved": "git+https://git@github.com/pangbox/parcel-plugin-pangdox.git#a149a8116b03adb41bd517843b60933d7759902f", "dependencies": { "@types/glob": "^7.1.1", "@types/highlight.js": "^9.12.3", @@ -5808,6 +5808,14 @@ "parcel-bundler": "^1.12.3" } }, + "node_modules/parcel-plugin-pangdox/node_modules/highlight.js": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "engines": { + "node": "*" + } + }, "node_modules/parse-asn1": { "version": "5.1.5", "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", diff --git a/package.json b/package.json index 13efaa1..8ac9359 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "author": "John Chadwick ", "license": "ISC", "dependencies": { + "highlight.js": "^11.8.0", "js-yaml": "^4.1.0", "kaitai-struct-compiler": "^0.10.0", "parcel-bundler": "^1.12.5", diff --git a/src/templates/partials/struct.html b/src/templates/partials/struct.html index 8bca488..8531956 100644 --- a/src/templates/partials/struct.html +++ b/src/templates/partials/struct.html @@ -27,9 +27,9 @@

{{ struct.id }}

{{ field.id }} {% if field.struct %} - {% include 'partials/type_link.html' with type: field.struct %} + {% include 'partials/type_link.html' with type: field.struct -%}{%- if field.repeat == "expr" %}[{{ field.repeatExpr }}]{% endif %} {% else %} - {{ field.type | default: "bytes" }} + {{ field.type | default: "bytes" }}{% if field.size %}[{{ field.size }}]{% endif %} {% endif %} {{ field.doc | default: "" }} @@ -42,4 +42,4 @@

{{ struct.id }}

{% endfor %} - \ No newline at end of file + diff --git a/src/templates/partials/type_link.html b/src/templates/partials/type_link.html index e7ed202..7d3f7d0 100644 --- a/src/templates/partials/type_link.html +++ b/src/templates/partials/type_link.html @@ -1 +1 @@ -{{- type.id -}} +{{- type.id -}}{{ "" -}}