aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/out_src_abstraction_ocda_peg_ssp.org21
-rw-r--r--org/out_src_abstraction_sqlite_db.org6
-rw-r--r--org/tests_for_document_abstraction_shell_scripts.org6
3 files changed, 30 insertions, 3 deletions
diff --git a/org/out_src_abstraction_ocda_peg_ssp.org b/org/out_src_abstraction_ocda_peg_ssp.org
index 0156b89..6fa7168 100644
--- a/org/out_src_abstraction_ocda_peg_ssp.org
+++ b/org/out_src_abstraction_ocda_peg_ssp.org
@@ -177,7 +177,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;
@@ -191,6 +194,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;
}
@@ -426,6 +434,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/org/out_src_abstraction_sqlite_db.org b/org/out_src_abstraction_sqlite_db.org
index 6fb5ffc..3daf045 100644
--- a/org/out_src_abstraction_sqlite_db.org
+++ b/org/out_src_abstraction_sqlite_db.org
@@ -139,6 +139,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
@@ -317,6 +319,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"
@@ -331,6 +334,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"
@@ -472,6 +476,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);
diff --git a/org/tests_for_document_abstraction_shell_scripts.org b/org/tests_for_document_abstraction_shell_scripts.org
index df02509..f8563c7 100644
--- a/org/tests_for_document_abstraction_shell_scripts.org
+++ b/org/tests_for_document_abstraction_shell_scripts.org
@@ -303,6 +303,8 @@ heading_ancestors_text|heading_ancestors_text IS NOT NULL
segment|segment IS NOT NULL
segment_prev|segment_prev IS NOT NULL
segment_next|segment_next IS NOT NULL
+segment_html_is|segment_html_is IS NOT NULL
+segment_epub_is|segment_epub_is IS NOT NULL
segment_epub|segment_epub IS NOT NULL
anchor|anchor IS NOT NULL AND anchor != segment
heading_lev_anchor|heading_lev_anchor IS NOT NULL
@@ -361,8 +363,8 @@ for ssp in "$OUT_DIR"/*/abstraction/*.ssp; do
echo "$CHECKS" | while IFS='|' read -r prop pred; do
[ -z "$prop" ] && continue
case "$prop" in
- *": true") s_n=$(grep -c "^\.$prop\$" "$ssp" || true) ;;
- *) s_n=$(grep -c "^\.$prop: " "$ssp" || true) ;;
+ ,*": true") s_n=$(grep -c "^\.$prop\$" "$ssp" || true) ;;
+ ,*) s_n=$(grep -c "^\.$prop: " "$ssp" || true) ;;
esac
d_n=$(sqlite3 "$db" "select count(*) from objects where $pred;" 2>/dev/null || echo ERR)
if [ "$s_n" != "$d_n" ]; then