From 4bc9e4921afac5ddf9e84c2f1873639179be86ef Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 29 May 2018 18:11:26 -0400 Subject: 0.26.2 image(s) without dimensions --- src/sdp/output/html.d | 4 ++-- src/sdp/output/paths_source.d | 22 +++++++++++-------- src/sdp/output/rgx.d | 1 + src/sdp/output/sqlite.d | 49 +------------------------------------------ src/sdp/output/xmls.d | 23 ++++++++++---------- src/sdp/output/xmls_css.d | 3 +++ 6 files changed, 31 insertions(+), 71 deletions(-) (limited to 'src/sdp/output') diff --git a/src/sdp/output/html.d b/src/sdp/output/html.d index d4770e7..ddd3c9f 100644 --- a/src/sdp/output/html.d +++ b/src/sdp/output/html.d @@ -180,9 +180,9 @@ template outputHTML() { } writeln(" ", pth_html.fn_scroll(doc_matters.src.filename)); } - void seg(D,I)( + void seg(D,M)( auto return ref const D doc_abstraction, - auto return ref I doc_matters, + auto ref M doc_matters, ) { mixin SiSUoutputRgxInit; auto rgx = Rgx(); diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d index 8f14b8e..e7233f0 100644 --- a/src/sdp/output/paths_source.d +++ b/src/sdp/output/paths_source.d @@ -295,18 +295,22 @@ template PathMatters() { return _dir; } auto image_dir_path() { - string _img_pth(string _possible_img_pth) { - return asNormalizedPath(file_with_absolute_path.dirName ~ "/" ~ _possible_img_pth).array; - } string _paths; string[] _possible_img_pths = [ "./image", "../image", "../../image" ]; string _img_pth_found = ""; - foreach(_possible_img_pth; _possible_img_pths) { - if (exists(_img_pth(_possible_img_pth))) { - _img_pth_found = _img_pth(_possible_img_pth); - break; - } else { - _paths ~= " " ~ _img_pth(_possible_img_pth); + if (is_pod) { + _img_pth_found = asNormalizedPath(file_with_absolute_path.dirName ~ "/../../image").array; + } else { + string _img_pth(string _possible_img_pth) { + return asNormalizedPath(file_with_absolute_path.dirName ~ "/" ~ _possible_img_pth).array; + } + foreach(_possible_img_pth; _possible_img_pths) { + if (exists(_img_pth(_possible_img_pth))) { + _img_pth_found = _img_pth(_possible_img_pth); + break; + } else { + _paths ~= " " ~ _img_pth(_possible_img_pth); + } } } if (_img_pth_found.empty) { diff --git a/src/sdp/output/rgx.d b/src/sdp/output/rgx.d index 60f15cf..a62791c 100644 --- a/src/sdp/output/rgx.d +++ b/src/sdp/output/rgx.d @@ -62,6 +62,7 @@ static template SiSUoutputRgxInit() { static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); /+ inline markup footnotes endnotes +/ static inline_image = ctRegex!(`(?P
┥)☼(?P(?P\S+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+))\s*(?P.*?┝┤.+?├)`, "mg");
+    static inline_image_without_dimensions                = ctRegex!(`(?P
┥)☼(?P(?P\S+?\.(?:jpg|gif|png)),w(?P0)h(?P0))\s*(?P.*?┝┤.+?├)`, "mg");
     static inline_link                                    = ctRegex!(`┥(?P.+?)┝┤(?P.+?)├`, "mg");
     static inline_link_clean                              = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
     static inline_a_url                                   = ctRegex!(`(┤)(\S+?)(├)`, "mg");
diff --git a/src/sdp/output/sqlite.d b/src/sdp/output/sqlite.d
index fc1843f..e9667ae 100644
--- a/src/sdp/output/sqlite.d
+++ b/src/sdp/output/sqlite.d
@@ -682,24 +682,9 @@ template SQLiteTablesReCreate() {
         ocns                             VARCHAR(6),
         clean                            TEXT NULL,
         body                             TEXT NULL,
-        book_idx                         TEXT NULL,
         seg                              VARCHAR(256) NULL,
         lev_an                           VARCHAR(1),
         lev                              SMALLINT NULL,
-        lev0                             SMALLINT,
-        lev1                             SMALLINT,
-        lev2                             SMALLINT,
-        lev3                             SMALLINT,
-        lev4                             SMALLINT,
-        lev5                             SMALLINT,
-        lev6                             SMALLINT,
-        lev7                             SMALLINT,
-        en_a                             SMALLINT NULL,
-        en_z                             SMALLINT NULL,
-        en_a_asterisk                    SMALLINT NULL,
-        en_z_asterisk                    SMALLINT NULL,
-        en_a_plus                        SMALLINT NULL,
-        en_z_plus                        SMALLINT NULL,
         t_of                             VARCHAR(16),
         t_is                             VARCHAR(16),
         node                             VARCHAR(16) NULL,
@@ -712,13 +697,6 @@ template SQLiteTablesReCreate() {
       CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);
       CREATE INDEX idx_digest_all ON doc_objects(digest_all);
       CREATE INDEX idx_clean ON doc_objects(clean);
-      CREATE INDEX idx_lev0 ON doc_objects(lev0);
-      CREATE INDEX idx_lev1 ON doc_objects(lev1);
-      CREATE INDEX idx_lev2 ON doc_objects(lev2);
-      CREATE INDEX idx_lev3 ON doc_objects(lev3);
-      CREATE INDEX idx_lev4 ON doc_objects(lev4);
-      CREATE INDEX idx_lev5 ON doc_objects(lev5);
-      CREATE INDEX idx_lev6 ON doc_objects(lev6);
       CREATE INDEX idx_title ON metadata_and_text(title);
       CREATE INDEX idx_author ON metadata_and_text(creator_author);
       CREATE INDEX idx_filename ON metadata_and_text(src_filename);
@@ -1006,16 +984,13 @@ template SQLiteInsertDocObjectsLoop() {
           }
           break;
         case "backmatter":
-          assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail", part);
+          assert(part == "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail", part);
           switch (obj.is_of) {
           case "para":
             switch (obj.is_a) {
             case "heading":
               obj_txt = format_and_sqlite_load.heading(obj);
               break;
-            case "endnote":              assert(part == "endnotes", part);
-              obj_txt = format_and_sqlite_load.para(obj);
-              break;
             case "glossary":             assert(part == "glossary", part);
               obj_txt = format_and_sqlite_load.para(obj);
               break;
@@ -1195,24 +1170,9 @@ template SQLiteTablesCreate() {
             ocns                             VARCHAR(6),
             clean                            TEXT NULL,
             body                             TEXT NULL,
-            book_idx                         TEXT NULL,
             seg                              VARCHAR(256) NULL,
             lev_an                           VARCHAR(1),
             lev                              SMALLINT NULL,
-            lev0                             SMALLINT,
-            lev1                             SMALLINT,
-            lev2                             SMALLINT,
-            lev3                             SMALLINT,
-            lev4                             SMALLINT,
-            lev5                             SMALLINT,
-            lev6                             SMALLINT,
-            lev7                             SMALLINT,
-            en_a                             SMALLINT NULL,
-            en_z                             SMALLINT NULL,
-            en_a_asterisk                    SMALLINT NULL,
-            en_z_asterisk                    SMALLINT NULL,
-            en_a_plus                        SMALLINT NULL,
-            en_z_plus                        SMALLINT NULL,
             t_of                             VARCHAR(16),
             t_is                             VARCHAR(16),
             node                             VARCHAR(16) NULL,
@@ -1225,13 +1185,6 @@ template SQLiteTablesCreate() {
           CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);
           CREATE INDEX idx_digest_all ON doc_objects(digest_all);
           CREATE INDEX idx_clean ON doc_objects(clean);
-          CREATE INDEX idx_lev0 ON doc_objects(lev0);
-          CREATE INDEX idx_lev1 ON doc_objects(lev1);
-          CREATE INDEX idx_lev2 ON doc_objects(lev2);
-          CREATE INDEX idx_lev3 ON doc_objects(lev3);
-          CREATE INDEX idx_lev4 ON doc_objects(lev4);
-          CREATE INDEX idx_lev5 ON doc_objects(lev5);
-          CREATE INDEX idx_lev6 ON doc_objects(lev6);
           CREATE INDEX idx_title ON metadata_and_text(title);
           CREATE INDEX idx_author ON metadata_and_text(creator_author);
           CREATE INDEX idx_filename ON metadata_and_text(src_filename);
diff --git a/src/sdp/output/xmls.d b/src/sdp/output/xmls.d
index 1621732..785d87e 100644
--- a/src/sdp/output/xmls.d
+++ b/src/sdp/output/xmls.d
@@ -100,8 +100,8 @@ template outputXHTMLs() {
       }
       return tags;
     }
-    auto header_metadata(Dm)(
-      Dm doc_matters,
+    auto header_metadata(M)(
+      M  doc_matters,
     ) {
       string _title="Title";
       string _author="Author";
@@ -149,8 +149,8 @@ template outputXHTMLs() {
       );
       return o;
     }
-    auto site_info_button(Dm)(
-      Dm doc_matters,
+    auto site_info_button(M)(
+      M  doc_matters,
     ) {
       string _locations;
       if (doc_matters.conf_make_meta.make.home_button_text.length > 0) {
@@ -173,8 +173,8 @@ template outputXHTMLs() {
       );
       return o;
     }
-    auto inline_search_form(Dm)(
-      Dm doc_matters,
+    auto inline_search_form(M)(
+      M  doc_matters,
     ) {
       string _action="http://www.sisudoc.org/cgi-bin/search.cgi";
       string _db="SiSU.7a.manual";
@@ -197,8 +197,8 @@ template outputXHTMLs() {
       );
       return o;
     }
-    auto html_head(Dm)(
-      Dm doc_matters,
+    auto html_head(M)(
+      M  doc_matters,
       string type,
     ) {
       string o;
@@ -244,8 +244,8 @@ template outputXHTMLs() {
       );
       return o;
     }
-    auto epub3_seg_head(Dm)(
-      Dm doc_matters,
+    auto epub3_seg_head(M)(
+      M  doc_matters,
     ) {
       string html_base = format(q"¶
     ¶",
@@ -326,8 +326,7 @@ template outputXHTMLs() {
         _img_pth = "../../../image/";
       }
       if (_txt.match(rgx.inline_image)) {
-        _txt = (_txt)
-          .replaceAll( // TODO bug where image dimensions (w or h) not given & consequently set to 0; should not be used (calculate earlier, abstraction)
+        _txt = _txt.replaceAll( // TODO bug where image dimensions (w or h) not given & consequently set to 0; should not be used (calculate earlier, abstraction)
             rgx.inline_image,
             ("$1