From 39cb8bd2847bfe1c45f629d579fcef5ce6621766 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 2 Sep 2026 22:27:05 -0400 Subject: ocda a fix & ssp code-style use curly braces ocda: fixed inverted object_number_off on body paragraphs ssp: make use of curly braces (code-style) (assisted by Claude-Code) --- org/ocda.org | 2 +- org/out_src_abstraction_ocda_peg_ssp.org | 217 +++++++++++++++++++++---------- src/sisudoc/ocda/abstraction/ssp.d | 217 +++++++++++++++++++++---------- src/sisudoc/ocda/meta/metadoc_from_src.d | 2 +- 4 files changed, 294 insertions(+), 144 deletions(-) diff --git a/org/ocda.org b/org/ocda.org index 25a5d8e..c815604 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -862,7 +862,7 @@ _loopMarkupSrcByLineStruct loopMarkupSrcByLine( comp_obj_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; comp_obj_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1to4"]; comp_obj_.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_.metainfo.object_number_off = (obj_cite_digits.off == 0) ? true : false; // TODO + comp_obj_.metainfo.object_number_off = obj_cite_digits.off; comp_obj_.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_.metainfo.object_number_type = obj_cite_digits.type; comp_obj_.attrib.indent_hang = indent["hang_position"]; diff --git a/org/out_src_abstraction_ocda_peg_ssp.org b/org/out_src_abstraction_ocda_peg_ssp.org index a14773e..099d81f 100644 --- a/org/out_src_abstraction_ocda_peg_ssp.org +++ b/org/out_src_abstraction_ocda_peg_ssp.org @@ -51,73 +51,104 @@ template spineAbstractionTxt() { /+ ↓ @meta block +/ output ~= "@meta {"; auto meta = doc_matters.conf_make_meta.meta; - if (meta.title_main.length > 0) + if (meta.title_main.length > 0) { output ~= " title.main: " ~ meta.title_main; - if (meta.title_subtitle.length > 0) + } + if (meta.title_subtitle.length > 0) { output ~= " title.subtitle: " ~ meta.title_subtitle; - if (meta.title_full.length > 0) + } + if (meta.title_full.length > 0) { output ~= " title.full: " ~ meta.title_full; - if (meta.title_language.length > 0) + } + if (meta.title_language.length > 0) { output ~= " title.language: " ~ meta.title_language; - if (meta.creator_author.length > 0) + } + if (meta.creator_author.length > 0) { output ~= " creator.author: " ~ meta.creator_author; - if (meta.creator_author_surname.length > 0) + } + if (meta.creator_author_surname.length > 0) { output ~= " creator.author_surname: " ~ meta.creator_author_surname; - if (meta.creator_author_surname_fn.length > 0) + } + if (meta.creator_author_surname_fn.length > 0) { output ~= " creator.author_surname_fn: " ~ meta.creator_author_surname_fn; - if (meta.creator_author_email.length > 0) + } + if (meta.creator_author_email.length > 0) { output ~= " creator.author_email: " ~ meta.creator_author_email; - if (meta.creator_illustrator.length > 0) + } + if (meta.creator_illustrator.length > 0) { output ~= " creator.illustrator: " ~ meta.creator_illustrator; - if (meta.creator_translator.length > 0) + } + if (meta.creator_translator.length > 0) { output ~= " creator.translator: " ~ meta.creator_translator; - if (meta.date_published.length > 0) + } + if (meta.date_published.length > 0) { output ~= " date.published: " ~ meta.date_published; - if (meta.date_created.length > 0) + } + if (meta.date_created.length > 0) { output ~= " date.created: " ~ meta.date_created; - if (meta.date_issued.length > 0) + } + if (meta.date_issued.length > 0) { output ~= " date.issued: " ~ meta.date_issued; - if (meta.date_available.length > 0) + } + if (meta.date_available.length > 0) { output ~= " date.available: " ~ meta.date_available; - if (meta.date_modified.length > 0) + } + if (meta.date_modified.length > 0) { output ~= " date.modified: " ~ meta.date_modified; - if (meta.date_valid.length > 0) + } + if (meta.date_valid.length > 0) { output ~= " date.valid: " ~ meta.date_valid; - if (meta.rights_copyright.length > 0) + } + if (meta.rights_copyright.length > 0) { output ~= " rights.copyright: " ~ meta.rights_copyright; - if (meta.rights_license.length > 0) + } + if (meta.rights_license.length > 0) { output ~= " rights.license: " ~ meta.rights_license; - if (meta.classify_topic_register.length > 0) + } + if (meta.classify_topic_register.length > 0) { output ~= " classify.topic_register: " ~ meta.classify_topic_register; - if (meta.classify_subject.length > 0) + } + if (meta.classify_subject.length > 0) { output ~= " classify.subject: " ~ meta.classify_subject; - if (meta.classify_keywords.length > 0) + } + if (meta.classify_keywords.length > 0) { output ~= " classify.keywords: " ~ meta.classify_keywords; - if (meta.classify_loc.length > 0) + } + if (meta.classify_loc.length > 0) { output ~= " classify.loc: " ~ meta.classify_loc; - if (meta.classify_dewey.length > 0) + } + if (meta.classify_dewey.length > 0) { output ~= " classify.dewey: " ~ meta.classify_dewey; - if (meta.identifier_isbn.length > 0) + } + if (meta.identifier_isbn.length > 0) { output ~= " identifier.isbn: " ~ meta.identifier_isbn; - if (meta.identifier_oclc.length > 0) + } + if (meta.identifier_oclc.length > 0) { output ~= " identifier.oclc: " ~ meta.identifier_oclc; - if (meta.language_document.length > 0) + } + if (meta.language_document.length > 0) { output ~= " language.document: " ~ meta.language_document; - if (meta.notes_abstract.length > 0) + } + if (meta.notes_abstract.length > 0) { output ~= " notes.abstract: " ~ meta.notes_abstract; - if (meta.notes_description.length > 0) + } + if (meta.notes_description.length > 0) { output ~= " notes.description: " ~ meta.notes_description; - if (meta.notes_summary.length > 0) + } + if (meta.notes_summary.length > 0) { output ~= " notes.summary: " ~ meta.notes_summary; + } // check output ~= "}"; output ~= ""; /+ ↓ @make block +/ output ~= "@make {"; auto make = doc_matters.conf_make_meta.make; - if (make.doc_type.length > 0) + if (make.doc_type.length > 0) { output ~= " doc_type: " ~ make.doc_type; - if (make.auto_num_top_at_level.length > 0) + } + if (make.auto_num_top_at_level.length > 0) { output ~= " auto_num_top_at_level: " ~ make.auto_num_top_at_level; + } // check output ~= " auto_num_top_lv: " ~ make.auto_num_top_lv.to!string; output ~= " auto_num_depth: " ~ make.auto_num_depth.to!string; output ~= "}"; @@ -140,9 +171,9 @@ template spineAbstractionTxt() { string[] section_order = ["head", "toc", "body", "endnotes", "glossary", "bibliography", "bookindex", "blurb"]; foreach (section; section_order) { - if (section !in doc_abstraction) continue; + if (section !in doc_abstraction) { continue; } auto section_objs = doc_abstraction[section]; - if (section_objs.length == 0) continue; + if (section_objs.length == 0) { continue; } output ~= "@" ~ section ~ " {"; output ~= ""; foreach (obj; section_objs) { @@ -160,15 +191,33 @@ template spineAbstractionTxt() { } output ~= obj_decl; /+ ↓ properties (only non-default values) +/ - if (obj.metainfo.is_of_part.length > 0) + if (obj.metainfo.is_of_part.length > 0) { output ~= ".part: " ~ obj.metainfo.is_of_part; + } if (obj.metainfo.is_of_section.length > 0 - && obj.metainfo.is_of_section != section) + && obj.metainfo.is_of_section != section) { output ~= ".section: " ~ obj.metainfo.is_of_section; - if (obj.metainfo.parent_ocn != 0) + } + /+ ↓ parent: emitted for every object except: + - the document root, the one object that has no parent + - toc entries, generated furniture rather than authored objects, + whose place is given by their indent level; the toc heading + itself does carry its parent (the document root) + A parent ocn of 0 is not "no parent recorded", it is a parent + heading the author has made non-substantive (ocn suppressed, or a + dummy heading introduced to segment an output); it is structurally + truthful and is stated explicitly rather than omitted so that the + two cases remain distinguishable in the file + +/ + if (!(obj.metainfo.is_a == "heading" + && obj.metainfo.heading_lev_markup == 0) + && obj.metainfo.is_a != "toc" + ) { output ~= ".parent: " ~ obj.metainfo.parent_ocn.to!string; - if (obj.metainfo.last_descendant_ocn != 0) + } + if (obj.metainfo.last_descendant_ocn != 0) { output ~= ".last_descendant: " ~ obj.metainfo.last_descendant_ocn.to!string; + } /+ ↓ child headings (from pre-computed map) +/ if (obj.metainfo.children_headings.length > 0) { string[] ch; @@ -186,7 +235,7 @@ template spineAbstractionTxt() { if (has_anc) { string anc; foreach (i, a; obj.metainfo.markedup_ancestors) { - if (i > 0) anc ~= " "; + if (i > 0) { anc ~= " "; } anc ~= a.to!string; } output ~= ".ancestors: " ~ anc; @@ -216,7 +265,7 @@ template spineAbstractionTxt() { if (has_dom) { string ds; foreach (i, d; obj.metainfo.dom_structure_markedup_tags_status) { - if (i > 0) ds ~= " "; + if (i > 0) { ds ~= " "; } ds ~= d.to!string; } output ~= ".dom_status: " ~ ds; @@ -230,30 +279,39 @@ template spineAbstractionTxt() { if (has_dom_c) { string ds; foreach (i, d; obj.metainfo.dom_structure_collapsed_tags_status) { - if (i > 0) ds ~= " "; + if (i > 0) { ds ~= " "; } ds ~= d.to!string; } output ~= ".dom_status_collapsed: " ~ ds; } } - if (obj.metainfo.heading_lev_collapsed < 9) + if (obj.metainfo.heading_lev_collapsed < 9) { output ~= ".heading_lev_collapsed: " ~ obj.metainfo.heading_lev_collapsed.to!string; - if (obj.metainfo.parent_lev_markup != 0) + } + if (obj.metainfo.parent_lev_markup != 0) { output ~= ".parent_lev: " ~ obj.metainfo.parent_lev_markup.to!string; - if (obj.metainfo.dummy_heading) + } + if (obj.metainfo.dummy_heading) { output ~= ".dummy: true"; - if (obj.metainfo.object_number_off) + } + if (obj.metainfo.object_number_off) { output ~= ".ocn_off: true"; - if (obj.metainfo.o_n_type != 0) + } + if (obj.metainfo.o_n_type != 0) { output ~= ".o_n_type: " ~ obj.metainfo.o_n_type.to!string; - if (obj.metainfo.is_of_type.length > 0) + } + if (obj.metainfo.is_of_type.length > 0) { output ~= ".is_of_type: " ~ obj.metainfo.is_of_type; - if (obj.metainfo.attrib.length > 0) + } + if (obj.metainfo.attrib.length > 0) { output ~= ".attrib: " ~ obj.metainfo.attrib; - if (obj.metainfo.lang.length > 0) + } + if (obj.metainfo.lang.length > 0) { output ~= ".meta_lang: " ~ obj.metainfo.lang; - if (obj.metainfo.syntax.length > 0) + } + if (obj.metainfo.syntax.length > 0) { output ~= ".meta_syntax: " ~ obj.metainfo.syntax; + } /+ ↓ sha256 digest +/ { bool has_sha = false; @@ -291,23 +349,27 @@ template spineAbstractionTxt() { } } /+ ↓ text attributes +/ - if (obj.attrib.indent_base != 0 || obj.attrib.indent_hang != 0) + if (obj.attrib.indent_base != 0 || obj.attrib.indent_hang != 0) { output ~= ".indent: " ~ obj.attrib.indent_base.to!string ~ " " ~ obj.attrib.indent_hang.to!string; - if (obj.attrib.bullet) + } + if (obj.attrib.bullet) { output ~= ".bullet: true"; - if (obj.attrib.language.length > 0) + } + if (obj.attrib.language.length > 0) { output ~= ".lang: " ~ obj.attrib.language; + } /+ ↓ has flags +/ { string[] has_flags; - if (obj.has.inline_links) has_flags ~= "links"; - if (obj.has.inline_notes_reg) has_flags ~= "notes_reg"; - if (obj.has.inline_notes_star) has_flags ~= "notes_star"; - if (obj.has.images) has_flags ~= "images"; - if (obj.has.image_without_dimensions) has_flags ~= "images_no_dim"; - if (has_flags.length > 0) + if (obj.has.inline_links) { has_flags ~= "links"; } + if (obj.has.inline_notes_reg) { has_flags ~= "notes_reg"; } + if (obj.has.inline_notes_star) { has_flags ~= "notes_star"; } + if (obj.has.images) { has_flags ~= "images"; } + if (obj.has.image_without_dimensions) { has_flags ~= "images_no_dim"; } + if (has_flags.length > 0) { output ~= ".has: " ~ has_flags.join(" "); + } } /+ ↓ table properties +/ if (obj.metainfo.is_a == "table" && obj.table.number_of_columns > 0) { @@ -320,39 +382,50 @@ template spineAbstractionTxt() { if (obj.table.column_aligns.length > 0) { output ~= ".table_aligns: " ~ obj.table.column_aligns.join(" "); } - if (obj.table.heading) + if (obj.table.heading) { output ~= ".table_header: true"; - if (obj.table.walls) + } + if (obj.table.walls) { output ~= ".table_walls: true"; + } } /+ ↓ code block properties +/ if (obj.metainfo.is_a == "code") { - if (obj.code_block.syntax.length > 0) + if (obj.code_block.syntax.length > 0) { output ~= ".code_syntax: " ~ obj.code_block.syntax; - if (obj.code_block.linenumbers) + } + if (obj.code_block.linenumbers) { output ~= ".code_linenumbers: true"; + } } /+ ↓ stow (extracted links) +/ if (obj.stow.link.length > 0) { foreach (lnk; obj.stow.link) { - if (lnk.length > 0) + if (lnk.length > 0) { output ~= ".stow_link: " ~ lnk; + } } } /+ ↓ tag properties +/ - if (obj.tags.in_segment_html.length > 0) + if (obj.tags.in_segment_html.length > 0) { output ~= ".segment: " ~ obj.tags.in_segment_html; + } if (obj.tags.anchor_tag_html.length > 0 - && obj.tags.anchor_tag_html != obj.tags.in_segment_html) + && obj.tags.anchor_tag_html != obj.tags.in_segment_html) { output ~= ".anchor: " ~ obj.tags.anchor_tag_html; - if (obj.tags.segname_prev.length > 0) + } + if (obj.tags.segname_prev.length > 0) { output ~= ".segment_prev: " ~ obj.tags.segname_prev; - if (obj.tags.segname_next.length > 0) + } + if (obj.tags.segname_next.length > 0) { output ~= ".segment_next: " ~ obj.tags.segname_next; - if (obj.tags.heading_lev_anchor_tag.length > 0) + } + if (obj.tags.heading_lev_anchor_tag.length > 0) { output ~= ".heading_lev_anchor: " ~ obj.tags.heading_lev_anchor_tag; - if (obj.tags.segment_anchor_tag_epub.length > 0) + } + if (obj.tags.segment_anchor_tag_epub.length > 0) { output ~= ".segment_epub: " ~ obj.tags.segment_anchor_tag_epub; + } /+ ↓ heading ancestors text +/ { bool has_hat = false; @@ -366,15 +439,17 @@ template spineAbstractionTxt() { /+ ↓ lev4 subtoc +/ if (obj.tags.lev4_subtoc.length > 0) { foreach (st; obj.tags.lev4_subtoc) { - if (st.length > 0) + if (st.length > 0) { output ~= ".lev4_subtoc: " ~ st; + } } } /+ ↓ anchor tags +/ if (obj.tags.anchor_tags.length > 0) { foreach (at; obj.tags.anchor_tags) { - if (at.length > 0) + if (at.length > 0) { output ~= ".anchor_tag: " ~ at; + } } } /+ ↓ text content +/ diff --git a/src/sisudoc/ocda/abstraction/ssp.d b/src/sisudoc/ocda/abstraction/ssp.d index 1d1ea22..5f510f3 100644 --- a/src/sisudoc/ocda/abstraction/ssp.d +++ b/src/sisudoc/ocda/abstraction/ssp.d @@ -69,73 +69,104 @@ template spineAbstractionTxt() { /+ ↓ @meta block +/ output ~= "@meta {"; auto meta = doc_matters.conf_make_meta.meta; - if (meta.title_main.length > 0) + if (meta.title_main.length > 0) { output ~= " title.main: " ~ meta.title_main; - if (meta.title_subtitle.length > 0) + } + if (meta.title_subtitle.length > 0) { output ~= " title.subtitle: " ~ meta.title_subtitle; - if (meta.title_full.length > 0) + } + if (meta.title_full.length > 0) { output ~= " title.full: " ~ meta.title_full; - if (meta.title_language.length > 0) + } + if (meta.title_language.length > 0) { output ~= " title.language: " ~ meta.title_language; - if (meta.creator_author.length > 0) + } + if (meta.creator_author.length > 0) { output ~= " creator.author: " ~ meta.creator_author; - if (meta.creator_author_surname.length > 0) + } + if (meta.creator_author_surname.length > 0) { output ~= " creator.author_surname: " ~ meta.creator_author_surname; - if (meta.creator_author_surname_fn.length > 0) + } + if (meta.creator_author_surname_fn.length > 0) { output ~= " creator.author_surname_fn: " ~ meta.creator_author_surname_fn; - if (meta.creator_author_email.length > 0) + } + if (meta.creator_author_email.length > 0) { output ~= " creator.author_email: " ~ meta.creator_author_email; - if (meta.creator_illustrator.length > 0) + } + if (meta.creator_illustrator.length > 0) { output ~= " creator.illustrator: " ~ meta.creator_illustrator; - if (meta.creator_translator.length > 0) + } + if (meta.creator_translator.length > 0) { output ~= " creator.translator: " ~ meta.creator_translator; - if (meta.date_published.length > 0) + } + if (meta.date_published.length > 0) { output ~= " date.published: " ~ meta.date_published; - if (meta.date_created.length > 0) + } + if (meta.date_created.length > 0) { output ~= " date.created: " ~ meta.date_created; - if (meta.date_issued.length > 0) + } + if (meta.date_issued.length > 0) { output ~= " date.issued: " ~ meta.date_issued; - if (meta.date_available.length > 0) + } + if (meta.date_available.length > 0) { output ~= " date.available: " ~ meta.date_available; - if (meta.date_modified.length > 0) + } + if (meta.date_modified.length > 0) { output ~= " date.modified: " ~ meta.date_modified; - if (meta.date_valid.length > 0) + } + if (meta.date_valid.length > 0) { output ~= " date.valid: " ~ meta.date_valid; - if (meta.rights_copyright.length > 0) + } + if (meta.rights_copyright.length > 0) { output ~= " rights.copyright: " ~ meta.rights_copyright; - if (meta.rights_license.length > 0) + } + if (meta.rights_license.length > 0) { output ~= " rights.license: " ~ meta.rights_license; - if (meta.classify_topic_register.length > 0) + } + if (meta.classify_topic_register.length > 0) { output ~= " classify.topic_register: " ~ meta.classify_topic_register; - if (meta.classify_subject.length > 0) + } + if (meta.classify_subject.length > 0) { output ~= " classify.subject: " ~ meta.classify_subject; - if (meta.classify_keywords.length > 0) + } + if (meta.classify_keywords.length > 0) { output ~= " classify.keywords: " ~ meta.classify_keywords; - if (meta.classify_loc.length > 0) + } + if (meta.classify_loc.length > 0) { output ~= " classify.loc: " ~ meta.classify_loc; - if (meta.classify_dewey.length > 0) + } + if (meta.classify_dewey.length > 0) { output ~= " classify.dewey: " ~ meta.classify_dewey; - if (meta.identifier_isbn.length > 0) + } + if (meta.identifier_isbn.length > 0) { output ~= " identifier.isbn: " ~ meta.identifier_isbn; - if (meta.identifier_oclc.length > 0) + } + if (meta.identifier_oclc.length > 0) { output ~= " identifier.oclc: " ~ meta.identifier_oclc; - if (meta.language_document.length > 0) + } + if (meta.language_document.length > 0) { output ~= " language.document: " ~ meta.language_document; - if (meta.notes_abstract.length > 0) + } + if (meta.notes_abstract.length > 0) { output ~= " notes.abstract: " ~ meta.notes_abstract; - if (meta.notes_description.length > 0) + } + if (meta.notes_description.length > 0) { output ~= " notes.description: " ~ meta.notes_description; - if (meta.notes_summary.length > 0) + } + if (meta.notes_summary.length > 0) { output ~= " notes.summary: " ~ meta.notes_summary; + } // check output ~= "}"; output ~= ""; /+ ↓ @make block +/ output ~= "@make {"; auto make = doc_matters.conf_make_meta.make; - if (make.doc_type.length > 0) + if (make.doc_type.length > 0) { output ~= " doc_type: " ~ make.doc_type; - if (make.auto_num_top_at_level.length > 0) + } + if (make.auto_num_top_at_level.length > 0) { output ~= " auto_num_top_at_level: " ~ make.auto_num_top_at_level; + } // check output ~= " auto_num_top_lv: " ~ make.auto_num_top_lv.to!string; output ~= " auto_num_depth: " ~ make.auto_num_depth.to!string; output ~= "}"; @@ -158,9 +189,9 @@ template spineAbstractionTxt() { string[] section_order = ["head", "toc", "body", "endnotes", "glossary", "bibliography", "bookindex", "blurb"]; foreach (section; section_order) { - if (section !in doc_abstraction) continue; + if (section !in doc_abstraction) { continue; } auto section_objs = doc_abstraction[section]; - if (section_objs.length == 0) continue; + if (section_objs.length == 0) { continue; } output ~= "@" ~ section ~ " {"; output ~= ""; foreach (obj; section_objs) { @@ -178,15 +209,33 @@ template spineAbstractionTxt() { } output ~= obj_decl; /+ ↓ properties (only non-default values) +/ - if (obj.metainfo.is_of_part.length > 0) + if (obj.metainfo.is_of_part.length > 0) { output ~= ".part: " ~ obj.metainfo.is_of_part; + } if (obj.metainfo.is_of_section.length > 0 - && obj.metainfo.is_of_section != section) + && obj.metainfo.is_of_section != section) { output ~= ".section: " ~ obj.metainfo.is_of_section; - if (obj.metainfo.parent_ocn != 0) + } + /+ ↓ parent: emitted for every object except: + - the document root, the one object that has no parent + - toc entries, generated furniture rather than authored objects, + whose place is given by their indent level; the toc heading + itself does carry its parent (the document root) + A parent ocn of 0 is not "no parent recorded", it is a parent + heading the author has made non-substantive (ocn suppressed, or a + dummy heading introduced to segment an output); it is structurally + truthful and is stated explicitly rather than omitted so that the + two cases remain distinguishable in the file + +/ + if (!(obj.metainfo.is_a == "heading" + && obj.metainfo.heading_lev_markup == 0) + && obj.metainfo.is_a != "toc" + ) { output ~= ".parent: " ~ obj.metainfo.parent_ocn.to!string; - if (obj.metainfo.last_descendant_ocn != 0) + } + if (obj.metainfo.last_descendant_ocn != 0) { output ~= ".last_descendant: " ~ obj.metainfo.last_descendant_ocn.to!string; + } /+ ↓ child headings (from pre-computed map) +/ if (obj.metainfo.children_headings.length > 0) { string[] ch; @@ -204,7 +253,7 @@ template spineAbstractionTxt() { if (has_anc) { string anc; foreach (i, a; obj.metainfo.markedup_ancestors) { - if (i > 0) anc ~= " "; + if (i > 0) { anc ~= " "; } anc ~= a.to!string; } output ~= ".ancestors: " ~ anc; @@ -234,7 +283,7 @@ template spineAbstractionTxt() { if (has_dom) { string ds; foreach (i, d; obj.metainfo.dom_structure_markedup_tags_status) { - if (i > 0) ds ~= " "; + if (i > 0) { ds ~= " "; } ds ~= d.to!string; } output ~= ".dom_status: " ~ ds; @@ -248,30 +297,39 @@ template spineAbstractionTxt() { if (has_dom_c) { string ds; foreach (i, d; obj.metainfo.dom_structure_collapsed_tags_status) { - if (i > 0) ds ~= " "; + if (i > 0) { ds ~= " "; } ds ~= d.to!string; } output ~= ".dom_status_collapsed: " ~ ds; } } - if (obj.metainfo.heading_lev_collapsed < 9) + if (obj.metainfo.heading_lev_collapsed < 9) { output ~= ".heading_lev_collapsed: " ~ obj.metainfo.heading_lev_collapsed.to!string; - if (obj.metainfo.parent_lev_markup != 0) + } + if (obj.metainfo.parent_lev_markup != 0) { output ~= ".parent_lev: " ~ obj.metainfo.parent_lev_markup.to!string; - if (obj.metainfo.dummy_heading) + } + if (obj.metainfo.dummy_heading) { output ~= ".dummy: true"; - if (obj.metainfo.object_number_off) + } + if (obj.metainfo.object_number_off) { output ~= ".ocn_off: true"; - if (obj.metainfo.o_n_type != 0) + } + if (obj.metainfo.o_n_type != 0) { output ~= ".o_n_type: " ~ obj.metainfo.o_n_type.to!string; - if (obj.metainfo.is_of_type.length > 0) + } + if (obj.metainfo.is_of_type.length > 0) { output ~= ".is_of_type: " ~ obj.metainfo.is_of_type; - if (obj.metainfo.attrib.length > 0) + } + if (obj.metainfo.attrib.length > 0) { output ~= ".attrib: " ~ obj.metainfo.attrib; - if (obj.metainfo.lang.length > 0) + } + if (obj.metainfo.lang.length > 0) { output ~= ".meta_lang: " ~ obj.metainfo.lang; - if (obj.metainfo.syntax.length > 0) + } + if (obj.metainfo.syntax.length > 0) { output ~= ".meta_syntax: " ~ obj.metainfo.syntax; + } /+ ↓ sha256 digest +/ { bool has_sha = false; @@ -309,23 +367,27 @@ template spineAbstractionTxt() { } } /+ ↓ text attributes +/ - if (obj.attrib.indent_base != 0 || obj.attrib.indent_hang != 0) + if (obj.attrib.indent_base != 0 || obj.attrib.indent_hang != 0) { output ~= ".indent: " ~ obj.attrib.indent_base.to!string ~ " " ~ obj.attrib.indent_hang.to!string; - if (obj.attrib.bullet) + } + if (obj.attrib.bullet) { output ~= ".bullet: true"; - if (obj.attrib.language.length > 0) + } + if (obj.attrib.language.length > 0) { output ~= ".lang: " ~ obj.attrib.language; + } /+ ↓ has flags +/ { string[] has_flags; - if (obj.has.inline_links) has_flags ~= "links"; - if (obj.has.inline_notes_reg) has_flags ~= "notes_reg"; - if (obj.has.inline_notes_star) has_flags ~= "notes_star"; - if (obj.has.images) has_flags ~= "images"; - if (obj.has.image_without_dimensions) has_flags ~= "images_no_dim"; - if (has_flags.length > 0) + if (obj.has.inline_links) { has_flags ~= "links"; } + if (obj.has.inline_notes_reg) { has_flags ~= "notes_reg"; } + if (obj.has.inline_notes_star) { has_flags ~= "notes_star"; } + if (obj.has.images) { has_flags ~= "images"; } + if (obj.has.image_without_dimensions) { has_flags ~= "images_no_dim"; } + if (has_flags.length > 0) { output ~= ".has: " ~ has_flags.join(" "); + } } /+ ↓ table properties +/ if (obj.metainfo.is_a == "table" && obj.table.number_of_columns > 0) { @@ -338,39 +400,50 @@ template spineAbstractionTxt() { if (obj.table.column_aligns.length > 0) { output ~= ".table_aligns: " ~ obj.table.column_aligns.join(" "); } - if (obj.table.heading) + if (obj.table.heading) { output ~= ".table_header: true"; - if (obj.table.walls) + } + if (obj.table.walls) { output ~= ".table_walls: true"; + } } /+ ↓ code block properties +/ if (obj.metainfo.is_a == "code") { - if (obj.code_block.syntax.length > 0) + if (obj.code_block.syntax.length > 0) { output ~= ".code_syntax: " ~ obj.code_block.syntax; - if (obj.code_block.linenumbers) + } + if (obj.code_block.linenumbers) { output ~= ".code_linenumbers: true"; + } } /+ ↓ stow (extracted links) +/ if (obj.stow.link.length > 0) { foreach (lnk; obj.stow.link) { - if (lnk.length > 0) + if (lnk.length > 0) { output ~= ".stow_link: " ~ lnk; + } } } /+ ↓ tag properties +/ - if (obj.tags.in_segment_html.length > 0) + if (obj.tags.in_segment_html.length > 0) { output ~= ".segment: " ~ obj.tags.in_segment_html; + } if (obj.tags.anchor_tag_html.length > 0 - && obj.tags.anchor_tag_html != obj.tags.in_segment_html) + && obj.tags.anchor_tag_html != obj.tags.in_segment_html) { output ~= ".anchor: " ~ obj.tags.anchor_tag_html; - if (obj.tags.segname_prev.length > 0) + } + if (obj.tags.segname_prev.length > 0) { output ~= ".segment_prev: " ~ obj.tags.segname_prev; - if (obj.tags.segname_next.length > 0) + } + if (obj.tags.segname_next.length > 0) { output ~= ".segment_next: " ~ obj.tags.segname_next; - if (obj.tags.heading_lev_anchor_tag.length > 0) + } + if (obj.tags.heading_lev_anchor_tag.length > 0) { output ~= ".heading_lev_anchor: " ~ obj.tags.heading_lev_anchor_tag; - if (obj.tags.segment_anchor_tag_epub.length > 0) + } + if (obj.tags.segment_anchor_tag_epub.length > 0) { output ~= ".segment_epub: " ~ obj.tags.segment_anchor_tag_epub; + } /+ ↓ heading ancestors text +/ { bool has_hat = false; @@ -384,15 +457,17 @@ template spineAbstractionTxt() { /+ ↓ lev4 subtoc +/ if (obj.tags.lev4_subtoc.length > 0) { foreach (st; obj.tags.lev4_subtoc) { - if (st.length > 0) + if (st.length > 0) { output ~= ".lev4_subtoc: " ~ st; + } } } /+ ↓ anchor tags +/ if (obj.tags.anchor_tags.length > 0) { foreach (at; obj.tags.anchor_tags) { - if (at.length > 0) + if (at.length > 0) { output ~= ".anchor_tag: " ~ at; + } } } /+ ↓ text content +/ diff --git a/src/sisudoc/ocda/meta/metadoc_from_src.d b/src/sisudoc/ocda/meta/metadoc_from_src.d index dec00c6..229bff1 100644 --- a/src/sisudoc/ocda/meta/metadoc_from_src.d +++ b/src/sisudoc/ocda/meta/metadoc_from_src.d @@ -763,7 +763,7 @@ template docAbstraction() { comp_obj_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; comp_obj_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1to4"]; comp_obj_.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_.metainfo.object_number_off = (obj_cite_digits.off == 0) ? true : false; // TODO + comp_obj_.metainfo.object_number_off = obj_cite_digits.off; comp_obj_.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_.metainfo.object_number_type = obj_cite_digits.type; comp_obj_.attrib.indent_hang = indent["hang_position"]; -- cgit v1.2.3