aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc')
-rw-r--r--src/sisudoc/ocda/abstraction/ssp.d32
-rw-r--r--src/sisudoc/outputs/io_out/create_abstraction_db.d6
2 files changed, 36 insertions, 2 deletions
diff --git a/src/sisudoc/ocda/abstraction/ssp.d b/src/sisudoc/ocda/abstraction/ssp.d
index 5e9347f..1ec2d41 100644
--- a/src/sisudoc/ocda/abstraction/ssp.d
+++ b/src/sisudoc/ocda/abstraction/ssp.d
@@ -195,7 +195,10 @@ template spineAbstractionTxt() {
output ~= "@" ~ section ~ " {";
output ~= "";
foreach (obj; section_objs) {
- /+ ↓ object declaration line +/
+ /+ ↓ object declaration line. a heading carries its identifier here,
+ on the declaration line, where it is not the ocn; every other
+ object carries it as .identifier below, on the same condition
+ +/
string obj_decl = "[" ~ obj.metainfo.ocn.to!string ~ "] ";
if (obj.metainfo.is_a == "heading") {
string lev = obj.metainfo.marked_up_level;
@@ -209,6 +212,11 @@ template spineAbstractionTxt() {
}
output ~= obj_decl;
/+ ↓ properties (only non-default values) +/
+ if (obj.metainfo.is_a != "heading"
+ && obj.metainfo.identifier.length > 0
+ && obj.metainfo.identifier != obj.metainfo.ocn.to!string) {
+ output ~= ".identifier: " ~ obj.metainfo.identifier;
+ }
if (obj.metainfo.is_of_part.length > 0) {
output ~= ".part: " ~ obj.metainfo.is_of_part;
}
@@ -315,6 +323,9 @@ template spineAbstractionTxt() {
if (obj.metainfo.object_number_off) {
output ~= ".ocn_off: true";
}
+ // 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) {
output ~= ".is_of_type: " ~ obj.metainfo.is_of_type;
}
@@ -399,10 +410,16 @@ template spineAbstractionTxt() {
}
if (obj.table.heading) {
output ~= ".table_header: true";
- }
+ }
+ // if (obj.table.walls) {
+ // output ~= ".table_walls: true";
+ // }
}
/+ ↓ code block properties +/
if (obj.metainfo.is_a == "code") {
+ // if (obj.code_block.syntax.length > 0) {
+ // output ~= ".code_syntax: " ~ obj.code_block.syntax;
+ // }
if (obj.code_block.linenumbers) {
output ~= ".code_linenumbers: true";
}
@@ -435,6 +452,17 @@ template spineAbstractionTxt() {
if (obj.tags.segment_anchor_tag_epub.length > 0) {
output ~= ".segment_epub: " ~ obj.tags.segment_anchor_tag_epub;
}
+ /+ ↓ the segment an object belongs to, as opposed to the segment a
+ heading opens. .segment (in_segment_html) is set on headings
+ only, so without these two a reader cannot tell which segment a
+ paragraph is in; the sqlite search writer reads the html one
+ +/
+ if (obj.tags.html_segment_anchor_tag_is.length > 0) {
+ output ~= ".segment_html_is: " ~ obj.tags.html_segment_anchor_tag_is;
+ }
+ if (obj.tags.epub_segment_anchor_tag_is.length > 0) {
+ output ~= ".segment_epub_is: " ~ obj.tags.epub_segment_anchor_tag_is;
+ }
/+ ↓ heading ancestors text +/
{
bool has_hat = false;
diff --git a/src/sisudoc/outputs/io_out/create_abstraction_db.d b/src/sisudoc/outputs/io_out/create_abstraction_db.d
index 539dd55..3a6a85e 100644
--- a/src/sisudoc/outputs/io_out/create_abstraction_db.d
+++ b/src/sisudoc/outputs/io_out/create_abstraction_db.d
@@ -157,6 +157,8 @@ template spineAbstractionDb() {
segment_prev TEXT,
segment_next TEXT,
segment_epub TEXT,
+ segment_html_is TEXT,
+ segment_epub_is TEXT,
anchor TEXT,
heading_lev_anchor TEXT,
heading_ancestors_text TEXT
@@ -335,6 +337,7 @@ template spineAbstractionDb() {
~ "indent_base, indent_hang, bullet, lang,"
~ "has_links, has_notes_reg, has_notes_star, has_images, has_images_no_dim,"
~ "segment, segment_prev, segment_next, segment_epub,"
+ ~ "segment_html_is, segment_epub_is,"
~ "anchor, heading_lev_anchor, heading_ancestors_text,"
~ "table_cols, table_widths, table_aligns, table_header,"
~ "code_linenumbers, text"
@@ -349,6 +352,7 @@ template spineAbstractionDb() {
~ ":indent_base, :indent_hang, :bullet, :lang,"
~ ":has_links, :has_notes_reg, :has_notes_star, :has_images, :has_images_no_dim,"
~ ":segment, :segment_prev, :segment_next, :segment_epub,"
+ ~ ":segment_html_is, :segment_epub_is,"
~ ":anchor, :heading_lev_anchor, :heading_ancestors_text,"
~ ":table_cols, :table_widths, :table_aligns, :table_header,"
~ ":code_linenumbers, :text"
@@ -490,6 +494,8 @@ template spineAbstractionDb() {
bindStr(":segment_prev", obj.tags.segname_prev);
bindStr(":segment_next", obj.tags.segname_next);
bindStr(":segment_epub", obj.tags.segment_anchor_tag_epub);
+ bindStr(":segment_html_is", obj.tags.html_segment_anchor_tag_is);
+ bindStr(":segment_epub_is", obj.tags.epub_segment_anchor_tag_is);
bindStr(":anchor", obj.tags.anchor_tag_html);
bindStr(":heading_lev_anchor", obj.tags.heading_lev_anchor_tag);
bindJsonStrs(":heading_ancestors_text", obj.tags.heading_ancestors_text);