From c69fc1cbba31c90ca1fe83f00337927cc060e893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20P=2E?= Date: Tue, 24 Mar 2026 18:31:05 +0100 Subject: [PATCH] Add tech acronym to metadata --- src/iiif/Metadata.js | 31 +++++++++++++++++++------------ src/service/ManifestBuilder.js | 1 + 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/iiif/Metadata.js b/src/iiif/Metadata.js index ec17baa..8a71c6b 100644 --- a/src/iiif/Metadata.js +++ b/src/iiif/Metadata.js @@ -1,3 +1,17 @@ +/** + * @typedef MetadataTerms + * @property {String} papyrus, + * @property {String} author, + * @property {String} title, + * @property {String} edition, + * @property {String} technique, + * @property {String} techniqueAcronym, + * @property {String} pca, + * @property {String} date, + * @property {String} imageAuthor, + * @property {String} license, + * @property {String} copyright + */ class ManifestMetadata { papyrus = ''; @@ -5,6 +19,7 @@ class ManifestMetadata { title = ''; edition = ''; technique = ''; + techniqueAcronym = ''; pca = null; date = ''; imageAuthor = ''; @@ -14,18 +29,7 @@ class ManifestMetadata { /** * @todo Maybe this doesn't make any sense?? - * @param { - * {papyrus, - * author, - * title, - * edition, - * technique, - * pca, - * date, - * imageAuthor, - * license, - * copyright} - * } metadata + * @param {MetadataTerms} metadata */ constructor(metadata) { this.papyrus = metadata.papyrus ?? this.papyrus; @@ -35,6 +39,8 @@ class ManifestMetadata { // There should always be a technique value // in the metadata param this.technique = metadata.technique; + // Return the key that corresponds to the technique value + this.techniqueAcronym = metadata.techniqueAcronym.toUpperCase(); this.date = metadata.date ?? this.date; this.imageAuthor = metadata.imageAuthor ?? this.imageAuthor this.license = metadata.license ?? this.license; @@ -52,6 +58,7 @@ class ManifestMetadata { {label:"Title", value: this.title}, {label:"Reference edition", value: this.edition}, {label:"Technique", value: this.technique}, + {label:"Technique acronym", value: this.techniqueAcronym}, {label:"Date (Year)", value: this.date}, {label:"Image Author", value: this.imageAuthor}, {label:"License", value: this.license}, diff --git a/src/service/ManifestBuilder.js b/src/service/ManifestBuilder.js index d32fe29..494d8fd 100644 --- a/src/service/ManifestBuilder.js +++ b/src/service/ManifestBuilder.js @@ -171,6 +171,7 @@ async function getImageName(name, manifestId) { function createMetadata(manifest, imgFilename) { let metadata = parse(imgFilename, manifest.technique); metadata.technique = TECH_NAMES[manifest.technique]; + metadata.techniqueAcronym = manifest.technique; return new ManifestMetadata(metadata); } \ No newline at end of file