diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-04-22 14:00:13 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-04-22 20:42:31 -0400 |
| commit | 5f9cb0e9724ab4c3f3539ef801b4604504543e4a (patch) | |
| tree | 0c0a3bf636f680804a11ed4535b2d881ab4628e4 /src | |
| parent | include .ssp document abstraction in source pod (diff) | |
.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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/sisudoc/io_out/create_abstraction_txt.d | 9 |
1 files changed, 6 insertions, 3 deletions
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; |
