From 5f9cb0e9724ab4c3f3539ef801b4604504543e4a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 22 Apr 2026 14:00:13 -0400 Subject: .ssp serializer: omit identifier when it equals OCN - For heading objects, the identifier was always emitted on the declaration line (e.g. "[10] heading :1 10") even when it was just the OCN repeated. Now only emits the identifier when it differs from the OCN (i.e. when there is a named segment like "acknowledgments" or "a1"), reducing redundancy. Before: [10] heading :1 10 After: [10] heading :1 Named segments still appear: [0] heading :1 a1 Co-Authored-By: Anthropic Claude Opus 4.6 (1M context) --- org/out_src_abstraction_peg_text.org | 9 ++++++--- src/sisudoc/io_out/create_abstraction_txt.d | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/org/out_src_abstraction_peg_text.org b/org/out_src_abstraction_peg_text.org index 597d8d4..5a8c686 100644 --- a/org/out_src_abstraction_peg_text.org +++ b/org/out_src_abstraction_peg_text.org @@ -162,7 +162,8 @@ template spineAbstractionTxt() { if (obj.metainfo.is_a == "heading") { string lev = obj.metainfo.marked_up_level; obj_decl ~= "heading :" ~ lev; - if (obj.metainfo.identifier.length > 0) { + if (obj.metainfo.identifier.length > 0 + && obj.metainfo.identifier != obj.metainfo.ocn.to!string) { obj_decl ~= " " ~ obj.metainfo.identifier; } } else { @@ -173,7 +174,8 @@ template spineAbstractionTxt() { /+ ↓ properties (only non-default values) +/ 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) + if (obj.metainfo.is_of_section.length > 0 + && obj.metainfo.is_of_section != section) output ~= ".section: " ~ obj.metainfo.is_of_section; if (obj.metainfo.parent_ocn != 0) output ~= ".parent: " ~ obj.metainfo.parent_ocn.to!string; @@ -242,7 +244,8 @@ template spineAbstractionTxt() { /+ ↓ tag properties +/ 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) + if (obj.tags.anchor_tag_html.length > 0 + && obj.tags.anchor_tag_html != obj.tags.in_segment_html) output ~= ".anchor: " ~ obj.tags.anchor_tag_html; if (obj.tags.segname_prev.length > 0) output ~= ".segment_prev: " ~ obj.tags.segname_prev; diff --git a/src/sisudoc/io_out/create_abstraction_txt.d b/src/sisudoc/io_out/create_abstraction_txt.d index a1e8f12..140a27d 100644 --- a/src/sisudoc/io_out/create_abstraction_txt.d +++ b/src/sisudoc/io_out/create_abstraction_txt.d @@ -180,7 +180,8 @@ template spineAbstractionTxt() { if (obj.metainfo.is_a == "heading") { string lev = obj.metainfo.marked_up_level; obj_decl ~= "heading :" ~ lev; - if (obj.metainfo.identifier.length > 0) { + if (obj.metainfo.identifier.length > 0 + && obj.metainfo.identifier != obj.metainfo.ocn.to!string) { obj_decl ~= " " ~ obj.metainfo.identifier; } } else { @@ -191,7 +192,8 @@ template spineAbstractionTxt() { /+ ↓ properties (only non-default values) +/ 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) + if (obj.metainfo.is_of_section.length > 0 + && obj.metainfo.is_of_section != section) output ~= ".section: " ~ obj.metainfo.is_of_section; if (obj.metainfo.parent_ocn != 0) output ~= ".parent: " ~ obj.metainfo.parent_ocn.to!string; @@ -260,7 +262,8 @@ template spineAbstractionTxt() { /+ ↓ tag properties +/ 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) + if (obj.tags.anchor_tag_html.length > 0 + && obj.tags.anchor_tag_html != obj.tags.in_segment_html) output ~= ".anchor: " ~ obj.tags.anchor_tag_html; if (obj.tags.segname_prev.length > 0) output ~= ".segment_prev: " ~ obj.tags.segname_prev; -- cgit v1.2.3