aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/ocda/abstraction/ssp.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/ocda/abstraction/ssp.d')
-rw-r--r--src/sisudoc/ocda/abstraction/ssp.d88
1 files changed, 87 insertions, 1 deletions
diff --git a/src/sisudoc/ocda/abstraction/ssp.d b/src/sisudoc/ocda/abstraction/ssp.d
index d29737b..6b487d7 100644
--- a/src/sisudoc/ocda/abstraction/ssp.d
+++ b/src/sisudoc/ocda/abstraction/ssp.d
@@ -50,6 +50,21 @@
module sisudoc.ocda.abstraction.ssp;
@safe:
/+ ↓ write document abstraction as human-readable .ssp text file +/
+/+ ↓ the format version, carried by both serialisations: the .ssp says it in
+ its "% SiSU Document Abstraction v" header line and the .ocda.db in its
+ metadata schema.version row, so that one bump moves both.
+
+ a reader checks the major part and refuses what it does not know, rather
+ than loading an older artefact half populated in silence. bump the minor
+ part when a property is added (a reader of the newer format still reads
+ the older one), the major part when one changes meaning or goes away.
+
+ 1.1 2026-09-10 @source block; the document metadata the output writers
+ read carried in full (14 meta and 3 make properties
+ added); was 0.1
++/
+enum ssp_format_version = "1.1";
+enum ssp_format_version_major = "1";
/+ ↓ escaping for values that are folded onto one line
a .ssp property value runs to the end of its line, and
@@ -431,9 +446,22 @@ template spineAbstractionTxt() {
auto doc_matters = doc.matters;
string[] output;
/+ ↓ header comment +/
- output ~= "% SiSU Document Abstraction v0.1";
+ output ~= "% SiSU Document Abstraction v" ~ ssp_format_version;
output ~= "% Source: " ~ doc_matters.src.filename;
output ~= "";
+ /+ ↓ @source block: what this abstraction was made from, so a reader can
+ say whether it is looking at the right images and whether the
+ markup has moved on since. the filename is in the % Source: line
+ above and is not repeated here
+ +/
+ output ~= "@source {";
+ output ~= " language: " ~ doc_matters.src.language;
+ if (doc_matters.pod.manifest_list_of_languages.length > 0) {
+ output ~= " languages: " ~ doc_matters.pod.manifest_list_of_languages.join(" ");
+ }
+ output ~= " digest: " ~ doc_matters.doc_digest.markup_doc.toHexString.to!string;
+ output ~= "}";
+ output ~= "";
/+ ↓ @meta block +/
output ~= "@meta {";
auto meta = doc_matters.conf_make_meta.meta;
@@ -449,6 +477,9 @@ template spineAbstractionTxt() {
if (meta.title_language.length > 0) {
output ~= " title.language: " ~ meta.title_language;
}
+ if (meta.title_edition.length > 0) {
+ output ~= " title.edition: " ~ meta.title_edition;
+ }
if (meta.creator_author.length > 0) {
output ~= " creator.author: " ~ meta.creator_author;
}
@@ -485,9 +516,33 @@ template spineAbstractionTxt() {
if (meta.date_valid.length > 0) {
output ~= " date.valid: " ~ meta.date_valid;
}
+ if (meta.date_added_to_site.length > 0) {
+ output ~= " date.added_to_site: " ~ meta.date_added_to_site;
+ }
if (meta.rights_copyright.length > 0) {
output ~= " rights.copyright: " ~ meta.rights_copyright;
}
+ if (meta.rights_copyright_text.length > 0) {
+ output ~= " rights.copyright_text: " ~ meta.rights_copyright_text;
+ }
+ if (meta.rights_copyright_translation.length > 0) {
+ output ~= " rights.copyright_translation: " ~ meta.rights_copyright_translation;
+ }
+ if (meta.rights_copyright_illustrations.length > 0) {
+ output ~= " rights.copyright_illustrations: " ~ meta.rights_copyright_illustrations;
+ }
+ if (meta.rights_copyright_photographs.length > 0) {
+ output ~= " rights.copyright_photographs: " ~ meta.rights_copyright_photographs;
+ }
+ if (meta.rights_copyright_cover.length > 0) {
+ output ~= " rights.copyright_cover: " ~ meta.rights_copyright_cover;
+ }
+ if (meta.rights_copyright_audio.length > 0) {
+ output ~= " rights.copyright_audio: " ~ meta.rights_copyright_audio;
+ }
+ if (meta.rights_copyright_video.length > 0) {
+ output ~= " rights.copyright_video: " ~ meta.rights_copyright_video;
+ }
if (meta.rights_license.length > 0) {
output ~= " rights.license: " ~ meta.rights_license;
}
@@ -515,6 +570,21 @@ template spineAbstractionTxt() {
if (meta.language_document.length > 0) {
output ~= " language.document: " ~ meta.language_document;
}
+ if (meta.language_document_char.length > 0) {
+ output ~= " language.document_char: " ~ meta.language_document_char;
+ }
+ if (meta.original_title.length > 0) {
+ output ~= " original.title: " ~ meta.original_title;
+ }
+ if (meta.original_source.length > 0) {
+ output ~= " original.source: " ~ meta.original_source;
+ }
+ if (meta.original_language.length > 0) {
+ output ~= " original.language: " ~ meta.original_language;
+ }
+ if (meta.original_language_char.length > 0) {
+ output ~= " original.language_char: " ~ meta.original_language_char;
+ }
if (meta.notes_abstract.length > 0) {
output ~= " notes.abstract: " ~ meta.notes_abstract;
}
@@ -537,6 +607,22 @@ template spineAbstractionTxt() {
} // check
output ~= " auto_num_top_lv: " ~ make.auto_num_top_lv.to!string;
output ~= " auto_num_depth: " ~ make.auto_num_depth.to!string;
+ /+ ↓ the make settings the output writers read. the rest of make
+ (italics, bold, emphasis, substitute, headings) is read at parse
+ time and its effect is already in the objects, so it does not
+ travel; these three are read in outputs/io_out/ and must
+ +/
+ if (make.breaks.length > 0) {
+ output ~= " breaks: " ~ make.breaks;
+ }
+ if (make.footer.length > 0) { // a list: joined, each slot escaped
+ string[] _ft;
+ foreach (_f; make.footer) { _ft ~= sspEscapeValue(_f); }
+ output ~= " footer: " ~ _ft.join("|");
+ }
+ if (make.home_button_text.length > 0) {
+ output ~= " home_button_text: " ~ make.home_button_text;
+ }
output ~= "}";
output ~= "";
/+ ↓ @doc_has block +/