diff options
Diffstat (limited to 'src/doc_reform')
-rw-r--r-- | src/doc_reform/output/epub3.d | 20 | ||||
-rw-r--r-- | src/doc_reform/output/paths_output.d | 192 | ||||
-rw-r--r-- | src/doc_reform/output/sqlite.d | 239 |
3 files changed, 237 insertions, 214 deletions
diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d index cdfd2a6..09dea3d 100644 --- a/src/doc_reform/output/epub3.d +++ b/src/doc_reform/output/epub3.d @@ -79,7 +79,7 @@ template outputEPub3() { _uuid, _uuid, _uuid, - (pth_epub3.fn_oebps_css(doc_matters.src.filename)).chompPrefix("OEBPS/"), + (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"), ); content ~= " " ~ "<!-- Content Documents -->" ~ "\n "; content ~= parts["manifest_documents"]; @@ -89,7 +89,7 @@ template outputEPub3() { content ~= format(q"┃ <item id="%s" href="%s/%s" media-type="image/%s" /> ┃", image.baseName.stripExtension, - (pth_epub3.doc_oebps_image(doc_matters.src.filename)).chompPrefix("OEBPS/"), + (pth_epub3.doc_oebps_image).chompPrefix("OEBPS/"), image, image.extension.chompPrefix("."), ); @@ -659,7 +659,7 @@ template outputEPub3() { } { /+ OEBPS/[segments].xhtml (the document contents) +/ foreach (seg_filename; doc_matters.has.segnames_lv_0_to_4) { - string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename); + string fn = pth_epub3.fn_oebps_content_xhtml(seg_filename); auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); @@ -699,7 +699,7 @@ template outputEPub3() { File(fn_dbg, "w").writeln(epub_write.mimetypes); } } - fn = pth_epub3.fn_mimetypes(doc_matters.src.filename); + fn = pth_epub3.fn_mimetypes; EPUBzip(epub_write.mimetypes, fn); } { /+ META-INF/container.xml (identify doc root) +/ @@ -709,7 +709,7 @@ template outputEPub3() { File(fn_dbg, "w").writeln(epub_write.meta_inf_container_xml); } } - fn = pth_epub3.fn_dmi_container_xml(doc_matters.src.filename); + fn = pth_epub3.fn_dmi_container_xml; EPUBzip(epub_write.meta_inf_container_xml, fn); } { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/ @@ -719,7 +719,7 @@ template outputEPub3() { File(fn_dbg, "w").writeln(epub_write.oebps_toc_nav_xhtml); } } - fn = pth_epub3.fn_oebps_toc_nav_xhtml(doc_matters.src.filename); + fn = pth_epub3.fn_oebps_toc_nav_xhtml; EPUBzip(epub_write.oebps_toc_nav_xhtml, fn); } { /+ OEBPS/toc.ncx (navigation toc epub2) +/ @@ -729,7 +729,7 @@ template outputEPub3() { File(fn_dbg, "w").writeln(epub_write.oebps_toc_ncx); } } - fn = pth_epub3.fn_oebps_toc_ncx(doc_matters.src.filename); + fn = pth_epub3.fn_oebps_toc_ncx; EPUBzip(epub_write.oebps_toc_ncx, fn); } { /+ OEBPS/content.opf (doc manifest) +/ @@ -739,7 +739,7 @@ template outputEPub3() { File(fn_dbg, "w").writeln(epub_write.oebps_content_opf); } } - fn = pth_epub3.fn_oebps_content_opf(doc_matters.src.filename); + fn = pth_epub3.fn_oebps_content_opf; EPUBzip(epub_write.oebps_content_opf, fn); } { /+ OEBPS/_sisu/image (images) +/ @@ -759,7 +759,7 @@ template outputEPub3() { } } auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image; - auto fn_out = pth_epub3.doc_oebps_image(doc_matters.src.filename.to!string) ~ "/" ~ image; + auto fn_out = pth_epub3.doc_oebps_image ~ "/" ~ image; if (exists(fn_src)) { { auto zip_arc_member_file = new ArchiveMember(); @@ -783,7 +783,7 @@ template outputEPub3() { : File(fn_dbg, "w").writeln(css.dark.epub); } } - fn = pth_epub3.fn_oebps_css(doc_matters.src.filename); + fn = pth_epub3.fn_oebps_css; auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d index 795da4c..0ca9fa7 100644 --- a/src/doc_reform/output/paths_output.d +++ b/src/doc_reform/output/paths_output.d @@ -77,45 +77,11 @@ template DocReformOutPathsFnPd() { return _PathsStruct(); } } -template DocReformPathsUrl() { - import std.format; - mixin DocReformRgxInit; - static auto rgx = Rgx(); - auto DocReformPathsUrl(M)(M doc_matters) { - struct _UrlPathsStruct { - string doc_root() { - string _doc_root = (doc_matters.conf_make_meta.conf.webserv_url_doc_path.length > 0) - ? doc_matters.conf_make_meta.conf.webserv_url_doc_root - : "file://" ~ doc_matters.output_path; - return _doc_root; - } - string html_seg(string html_segname, string obj_id) { // TODO bespoke for sqlite - string _url = format(q"┃%s/%s/html/%s/%s.html#%s┃", - doc_root, - doc_matters.src.language, - doc_matters.src.filename_base, - html_segname, - obj_id - ); - if (html_segname.empty || obj_id.empty) { - if ( - doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose - ) { - writeln("sqlite object missing segname or object id: ", _url); - } - _url = ""; - } - return _url; - } - } - return _UrlPathsStruct(); - } -} + template DocReformDocRootTreeHTML() { mixin DocReformRgxInit; static auto rgx = Rgx(); - auto DocReformDocRootTreeHTML(Lng)(Lng lng) { + auto DocReformDocRootTreeHTML()(string lng) { auto lng_pth = DocReformOutPaths!()("", lng); string base_dir = "html"; string suffix = ".html"; @@ -129,7 +95,7 @@ template DocReformDocRootTreeHTML() { string base_filename_seg(string fn_src) { return base_filename(fn_src) ~ "." ~ lng; } - string docroot() { + string doc_root() { return asNormalizedPath(lng_pth.output_root).array; } string base() { @@ -172,19 +138,19 @@ template DocReformDocRootTreeHTML() { template DocReformPathsHTML() { mixin DocReformRgxInit; static auto rgx = Rgx(); - auto DocReformPathsHTML(Po,Lng)( - Po root_pth, - Lng lng, + auto DocReformPathsHTML()( + string root_pth, + string lng, ) { auto doc_tree = DocReformDocRootTreeHTML!()(lng); string base_dir = "html"; string suffix = ".html"; struct _PathsStruct { - string docroot() { - return asNormalizedPath(root_pth.chainPath(doc_tree.docroot)).array; + string doc_root() { + return asNormalizedPath(root_pth.chainPath(doc_tree.doc_root)).array; } string harvest(string fn_harvest) { - return docroot ~ "/" ~ fn_harvest; + return doc_root ~ "/" ~ fn_harvest; } string base() { return asNormalizedPath(root_pth.chainPath(doc_tree.base)).array; @@ -223,46 +189,88 @@ template DocReformPathsHTML() { return _PathsStruct(); } } -template DocReformUrlPathsHTML() { +template DocReformUrlsHTML() { + import std.format; mixin DocReformRgxInit; static auto rgx = Rgx(); - auto DocReformUrlPathsHTML(Po,Lng)( - Po root_pth, - Lng lng, + auto DocReformUrlsHTML()( + string url_doc_root, + string lng, ) { auto doc_tree = DocReformDocRootTreeHTML!()(lng); string base_dir = "html"; string suffix = ".html"; struct _PathsStruct { - string docroot() { - return asNormalizedPath(root_pth.chainPath(doc_tree.docroot)).array; + string doc_root() { + return url_doc_root ~ asNormalizedPath(doc_tree.doc_root).array; } string harvest(string fn_harvest) { - return docroot ~ "/" ~ fn_harvest; + return format(q"┃%s/%s┃", + doc_root, + fn_harvest, + ); } string base() { - return asNormalizedPath(root_pth.chainPath(doc_tree.base)).array; + return format(q"┃%s/%s┃", + url_doc_root, + asNormalizedPath(doc_tree.base).array, + ); } string image() { - return asNormalizedPath(root_pth.chainPath(doc_tree.image)).array; + return format(q"┃%s/%s┃", + url_doc_root, + asNormalizedPath(doc_tree.image).array, + ); } string css() { - return asNormalizedPath(root_pth.chainPath(doc_tree.css)).array; + return format(q"┃%s/%s┃", + url_doc_root, + asNormalizedPath(doc_tree.css).array, + ); } string fn_seg_css() { - return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg_css)).array; + return format(q"┃%s/%s┃", + url_doc_root, + asNormalizedPath(doc_tree.fn_seg_css).array, + ); } string fn_scroll_css() { - return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll_css)).array; + return format(q"┃%s/%s┃", + url_doc_root, + asNormalizedPath(doc_tree.fn_scroll_css).array, + ); } string seg(string fn_src) { - return asNormalizedPath(root_pth.chainPath(doc_tree.seg(fn_src))).array; + return format(q"┃%s/%s┃", + url_doc_root, + asNormalizedPath(doc_tree.seg(fn_src)).array, + ); } string fn_scroll(string fn_src) { - return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll(fn_src))).array; + return format(q"┃%s/%s┃", + url_doc_root, + asNormalizedPath(doc_tree.fn_scroll(fn_src)).array, + ); } string fn_seg(string fn_src, string seg_filename) { - return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).array; + return format(q"┃%s/%s┃", + url_doc_root, + asNormalizedPath(doc_tree.fn_seg(fn_src, seg_filename)).array, + ); + } + string fn_scroll_obj_num(string fn_src, string obj_num) { + return format(q"┃%s/%s#%s┃", + url_doc_root, + asNormalizedPath(doc_tree.fn_scroll(fn_src)).array, + obj_num, + ); + } + string fn_seg_obj_num(string fn_src, string seg_filename, string obj_num) { + return format(q"┃%s/%s#%s┃", + url_doc_root, + asNormalizedPath(doc_tree.fn_seg(fn_src, seg_filename)).array, + obj_num, + ); } string tail_seg(string fn_src) { return doc_tree.tail_seg(fn_src); @@ -280,9 +288,9 @@ template DocReformUrlPathsHTML() { template DocReformPathsEPUB() { mixin DocReformRgxInit; static auto rgx = Rgx(); - auto DocReformPathsEPUB(Po,Lng)( - Po output_pth_root, - Lng lng, + auto DocReformPathsEPUB()( + string output_pth_root, + string lng, ) { auto out_pth = DocReformOutPaths!()(output_pth_root, lng); string base_dir = "epub"; @@ -293,44 +301,50 @@ template DocReformPathsEPUB() { string base_filename(string fn_src) { return fn_src.baseName.stripExtension ~ "." ~ lng; } - string epub_file(string fn_src) { - return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array; + string base_filename(string fn_src) { + return fn_src.baseName.stripExtension; } - string dirtop() { - return "".chainPath("").array; + string base_filename_epub(string fn_src) { + return base_filename(fn_src) ~ "." ~ lng; } - string doc_meta_inf(string fn_src) { - return asNormalizedPath(dirtop.chainPath("META-INF")).array; + string doc_meta_inf() { + return asNormalizedPath("META-INF").array; } - string doc_oebps(string fn_src) { - return asNormalizedPath(dirtop.chainPath("OEBPS")).array; + string doc_oebps() { + return asNormalizedPath("OEBPS").array; } - string doc_oebps_css(string fn_src) { - return asNormalizedPath(doc_oebps(fn_src).chainPath("css")).array; + string doc_oebps_css() { + return asNormalizedPath(doc_oebps.chainPath("css")).array; } - string doc_oebps_image(string fn_src) { - return asNormalizedPath(doc_oebps(fn_src).chainPath("image")).array; + string doc_oebps_image() { + return asNormalizedPath(doc_oebps.chainPath("image")).array; } - string fn_mimetypes(string fn_src) { + string epub_file(string fn_src) { + return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array; + } + string dirtop() { + return "".chainPath("").array; + } + string fn_mimetypes() { return asNormalizedPath(dirtop.chainPath("mimetypes")).array; } - string fn_dmi_container_xml(string fn_src) { - return asNormalizedPath(doc_meta_inf(fn_src).chainPath("container.xml")).array; + string fn_dmi_container_xml() { + return asNormalizedPath(doc_meta_inf.chainPath("container.xml")).array; } - string fn_oebps_toc_nav_xhtml(string fn_src) { - return asNormalizedPath(doc_oebps(fn_src).chainPath("toc_nav.xhtml")).array; + string fn_oebps_toc_nav_xhtml() { + return asNormalizedPath(doc_oebps.chainPath("toc_nav.xhtml")).array; } - string fn_oebps_toc_ncx(string fn_src) { - return asNormalizedPath(doc_oebps(fn_src).chainPath("toc.ncx")).array; + string fn_oebps_toc_ncx() { + return asNormalizedPath(doc_oebps.chainPath("toc.ncx")).array; } - string fn_oebps_content_opf(string fn_src) { - return asNormalizedPath(doc_oebps(fn_src).chainPath("content.opf")).array; + string fn_oebps_content_opf() { + return asNormalizedPath(doc_oebps.chainPath("content.opf")).array; } - string fn_oebps_content_xhtml(string fn_src, string seg_filename) { - return asNormalizedPath(doc_oebps(fn_src).chainPath(seg_filename ~ ".xhtml")).array; + string fn_oebps_content_xhtml(string seg_filename) { + return asNormalizedPath(doc_oebps.chainPath(seg_filename ~ ".xhtml")).array; } - string fn_oebps_css(string fn_src) { - return asNormalizedPath(doc_oebps_css(fn_src).chainPath("epub.css")).array; + string fn_oebps_css() { + return asNormalizedPath(doc_oebps_css.chainPath("epub.css")).array; } /+ debug +/ string dbg_docdir(string fn_src) { @@ -472,9 +486,9 @@ template DocReformPathsLaTeX() { template DocReformPathsSQLiteDiscrete() { mixin DocReformRgxInit; static auto rgx = Rgx(); - auto DocReformPathsSQLiteDiscrete(Po,Lng)( - Po output_pth_root, - Lng lng, + auto DocReformPathsSQLiteDiscrete()( + string output_pth_root, + string lng, ) { struct _PathsStruct { string base_filename(string fn_src) { diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d index 57c90e0..5bc1551 100644 --- a/src/doc_reform/output/sqlite.d +++ b/src/doc_reform/output/sqlite.d @@ -7,7 +7,9 @@ import import d2sqlite3; import std.typecons : Nullable; mixin DocReformOutputRgxInit; +mixin InternalMarkup; static auto rgx = Rgx(); +static auto mkup = InlineMarkup(); long _metadata_tid_lastrowid; template SQLiteHubBuildTablesAndPopulate() { void SQLiteHubBuildTablesAndPopulate(D,M)( @@ -61,6 +63,7 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { const D doc_abstraction, M doc_matters, ) { + auto url_html = DocReformUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language); auto pth_sqlite = DocReformPathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language); pth_sqlite.base.mkdirRecurse; auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename)); @@ -867,18 +870,18 @@ template SQLiteTablesReCreate() { DROP INDEX IF EXISTS idx_language_document_char; DROP INDEX IF EXISTS idx_classify_topic_register; DROP TABLE IF EXISTS metadata_and_text; + DROP TABLE IF EXISTS topic_register; DROP TABLE IF EXISTS doc_objects; DROP TABLE IF EXISTS urls; CREATE TABLE metadata_and_text ( - uid VARCHAR(256) UNIQUE, /* filename, language char, pod/txt (decide on delimiter [,;:/]) */ - src_composite_id_per_txt VARCHAR(256) NOT NULL, /* UNIQUE, /* z pod name if any + src filename + language code */ - src_composite_id_per_pod VARCHAR(256) NOT NULL, /* z pod name if any + src filename */ + uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/]) + src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code + src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename title VARCHAR(800) NOT NULL, title_main VARCHAR(400) NOT NULL, title_sub VARCHAR(400) NULL, title_short VARCHAR(400) NULL, title_edition VARCHAR(10) NULL, - title_note VARCHAR(2500) NULL, title_language VARCHAR(100) NULL, title_language_char VARCHAR(6) NULL, creator_author VARCHAR(600) NOT NULL, @@ -908,14 +911,13 @@ template SQLiteTablesReCreate() { date_translated VARCHAR(10) NULL, date_original_publication VARCHAR(10) NULL, date_generated VARCHAR(10) NULL, - publisher VARCHAR(600) NULL, + original_title VARCHAR(800) NULL, original_publisher VARCHAR(600) NULL, original_language VARCHAR(100) NULL, original_language_char VARCHAR(6) NULL, original_source VARCHAR(600) NULL, original_institution VARCHAR(600) NULL, original_nationality VARCHAR(100) NULL, - original_title VARCHAR(800) NULL, rights_copyright VARCHAR(2500) NULL, rights_copyright_audio VARCHAR(2500) NULL, rights_copyright_cover VARCHAR(2500) NULL, @@ -944,16 +946,34 @@ template SQLiteTablesReCreate() { notes_prefix_a TEXT NULL, notes_prefix_b TEXT NULL, notes_suffix TEXT NULL, + publisher VARCHAR(600) NULL, src_filename VARCHAR(256) NOT NULL, src_fingerprint VARCHAR(256) NULL, src_filesize VARCHAR(10) NULL, src_wordcount VARCHAR(10) NULL, - pod_name VARCHAR(256) NULL, /* zipped pod, work to be done here */ - pod_fingerprint VARCHAR(256) NULL, /* zipped pod, work to be done here */ - pod_size VARCHAR(10) NULL, /* zipped pod, work to be done here */ - site_url_doc_root VARCHAR(256) NULL, /* url path to doc root */ + pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here + pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here + pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here + site_url_doc_root VARCHAR(256) NULL, -- url path to doc root + site_url_html_toc VARCHAR(256) NULL, + site_url_html_scroll VARCHAR(256) NULL, + site_url_epub VARCHAR(256) NULL, links TEXT NULL ); + CREATE TABLE topic_register ( + -- tid BIGINT PRIMARY KEY, + uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE, + -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code + -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename + topic_register_lv0 VARCHAR(250) NOT NULL, + topic_register_lv1 VARCHAR(250) NULL, + topic_register_lv2 VARCHAR(250) NULL, + topic_register_lv3 VARCHAR(250) NULL, + topic_register_lv4 VARCHAR(250) NULL, + site_url_doc_root VARCHAR(256) NULL, -- url path to doc root + site_url_html_toc VARCHAR(256) NULL, + site_url_html_scroll VARCHAR(256) NULL + ); CREATE TABLE doc_objects ( lid BIGINT PRIMARY KEY, uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE, @@ -968,7 +988,7 @@ template SQLiteTablesReCreate() { lev SMALLINT NULL, node VARCHAR(16) NULL, parent VARCHAR(16) NULL, - last_decendant VARCHAR(16) NULL, /* headings only */ + last_decendant VARCHAR(16) NULL, -- headings only digest_clean CHAR(256), digest_all CHAR(256), html_seg_url CHAR(256), @@ -1022,15 +1042,12 @@ template SQLiteInsertMetadata() { title_short, title_edition, title_language, - classify_dewey, - classify_keywords, - classify_loc, - classify_subject, - classify_topic_register, creator_author, creator_author_email, creator_illustrator, creator_translator, + language_document, + language_document_char, date_added_to_site, date_available, date_created, @@ -1038,18 +1055,6 @@ template SQLiteInsertMetadata() { date_modified, date_published, date_valid, - identifier_isbn, - identifier_oclc, - language_document, - language_document_char, - notes_abstract, - notes_description, - original_publisher, - original_language, - original_language_char, - original_source, - original_title, - publisher, rights_copyright, rights_copyright_audio, rights_copyright_cover, @@ -1059,57 +1064,25 @@ template SQLiteInsertMetadata() { rights_copyright_translation, rights_copyright_video, rights_license, + identifier_oclc, + identifier_isbn, + classify_dewey, + classify_keywords, + classify_loc, + classify_subject, + classify_topic_register, + original_title, + original_publisher, + original_language, + original_language_char, + original_source, + notes_abstract, + notes_description, + publisher, site_url_doc_root ) VALUES ( - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s' + '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ); ┃", _uid, @@ -1122,15 +1095,12 @@ template SQLiteInsertMetadata() { SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_short), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_edition), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_language), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_dewey), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_keywords), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_loc), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_subject), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_topic_register), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_email), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_illustrator), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_translator), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document_char), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_added_to_site), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_available), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_created), @@ -1138,18 +1108,6 @@ template SQLiteInsertMetadata() { SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_modified), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_published), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_valid), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_isbn), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_oclc), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document_char), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_abstract), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_description), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_publisher), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language_char), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_source), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_title), - SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.publisher), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_audio), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_cover), @@ -1159,8 +1117,50 @@ template SQLiteInsertMetadata() { SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_translation), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_video), SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_license), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_oclc), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_isbn), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_dewey), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_keywords), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_loc), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_subject), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_topic_register), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_abstract), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_description), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_title), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_publisher), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language_char), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_source), + SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.publisher), SQLinsertDelimiter!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root) ); + if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { + + string _insert_topics; + foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr) { + string[] subject_tree = topic.split(mkup.sep); + _insert_topics ~= format(q"┃ + INSERT INTO topic_register ( + uid_metadata_and_text, + topic_register_lv0, + topic_register_lv1, + topic_register_lv2, + topic_register_lv3, + topic_register_lv4 + ) + VALUES ( + '%s', '%s', '%s', '%s', '%s', '%s' + ); + ┃", + _uid, + (subject_tree.length > 0) ? subject_tree[0] : "", + (subject_tree.length > 1) ? subject_tree[1] : "", + (subject_tree.length > 2) ? subject_tree[2] : "", + (subject_tree.length > 3) ? subject_tree[3] : "", + (subject_tree.length > 4) ? subject_tree[4] : "" + ); + } + } return _insert_metadata; } } @@ -1170,7 +1170,7 @@ template SQLiteInsertDocObjectsLoop() { M doc_matters, ) { string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); - auto site_url = DocReformPathsUrl!()(doc_matters); + auto url_html = DocReformUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language); string insertDocObjectsRow(O)(O obj) { string _insert_doc_objects_row = format(q"┃ INSERT INTO doc_objects ( @@ -1185,15 +1185,7 @@ template SQLiteInsertDocObjectsLoop() { html_seg_url ) VALUES ( - '%s', - %s, - '%s', - '%s', - '%s', - %s, - '%s', - '%s', - '%s' + '%s', %s, '%s', '%s', '%s', %s, '%s', '%s', '%s' ); ┃", _uid, @@ -1204,7 +1196,7 @@ template SQLiteInsertDocObjectsLoop() { obj.metainfo.heading_lev_markup, obj.metainfo.is_of_type, obj.metainfo.is_a, - site_url.html_seg(obj.tags.html_segment_anchor_tag_is, obj.metainfo.identifier), + url_html.fn_seg_obj_num(doc_matters.src.filename, obj.tags.html_segment_anchor_tag_is, obj.metainfo.identifier), ); return _insert_doc_objects_row; } @@ -1403,18 +1395,18 @@ template SQLiteTablesCreate() { DROP INDEX IF EXISTS idx_language_document_char; DROP INDEX IF EXISTS idx_classify_topic_register; DROP TABLE IF EXISTS metadata_and_text; + DROP TABLE IF EXISTS topic_register; DROP TABLE IF EXISTS doc_objects; DROP TABLE IF EXISTS urls; CREATE TABLE metadata_and_text ( - uid VARCHAR(256) UNIQUE, /* filename, language char, pod/txt (decide on delimiter [,;:/]) */ - src_composite_id_per_txt VARCHAR(256) NOT NULL, /* UNIQUE, /* z pod name if any + src filename + language code */ - src_composite_id_per_pod VARCHAR(256) NOT NULL, /* z pod name if any + src filename */ + uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/]) + src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code + src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename title VARCHAR(800) NOT NULL, title_main VARCHAR(400) NOT NULL, title_sub VARCHAR(400) NULL, title_short VARCHAR(400) NULL, title_edition VARCHAR(10) NULL, - title_note VARCHAR(2500) NULL, title_language VARCHAR(100) NULL, title_language_char VARCHAR(6) NULL, creator_author VARCHAR(600) NOT NULL, @@ -1444,14 +1436,13 @@ template SQLiteTablesCreate() { date_translated VARCHAR(10) NULL, date_original_publication VARCHAR(10) NULL, date_generated VARCHAR(10) NULL, - publisher VARCHAR(600) NULL, + original_title VARCHAR(800) NULL, original_publisher VARCHAR(600) NULL, original_language VARCHAR(100) NULL, original_language_char VARCHAR(6) NULL, original_source VARCHAR(600) NULL, original_institution VARCHAR(600) NULL, original_nationality VARCHAR(100) NULL, - original_title VARCHAR(800) NULL, rights_copyright VARCHAR(2500) NULL, rights_copyright_audio VARCHAR(2500) NULL, rights_copyright_cover VARCHAR(2500) NULL, @@ -1480,16 +1471,34 @@ template SQLiteTablesCreate() { notes_prefix_a TEXT NULL, notes_prefix_b TEXT NULL, notes_suffix TEXT NULL, + publisher VARCHAR(600) NULL, src_filename VARCHAR(256) NOT NULL, src_fingerprint VARCHAR(256) NULL, src_filesize VARCHAR(10) NULL, src_wordcount VARCHAR(10) NULL, - pod_name VARCHAR(256) NULL, /* zipped pod, work to be done here */ - pod_fingerprint VARCHAR(256) NULL, /* zipped pod, work to be done here */ - pod_size VARCHAR(10) NULL, /* zipped pod, work to be done here */ - site_url_doc_root VARCHAR(256) NULL, /* url path to doc root */ + pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here + pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here + pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here + site_url_doc_root VARCHAR(256) NULL, -- url path to doc root + site_url_html_toc VARCHAR(256) NULL, + site_url_html_scroll VARCHAR(256) NULL, + site_url_epub VARCHAR(256) NULL, links TEXT NULL ); + CREATE TABLE topic_register ( + -- tid BIGINT PRIMARY KEY, + uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE, + -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code + -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename + topic_register_lv0 VARCHAR(250) NOT NULL, + topic_register_lv1 VARCHAR(250) NULL, + topic_register_lv2 VARCHAR(250) NULL, + topic_register_lv3 VARCHAR(250) NULL, + topic_register_lv4 VARCHAR(250) NULL, + site_url_doc_root VARCHAR(256) NULL, -- url path to doc root + site_url_html_toc VARCHAR(256) NULL, + site_url_html_scroll VARCHAR(256) NULL + ); CREATE TABLE doc_objects ( lid BIGINT PRIMARY KEY, uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE, @@ -1504,7 +1513,7 @@ template SQLiteTablesCreate() { lev SMALLINT NULL, node VARCHAR(16) NULL, parent VARCHAR(16) NULL, - last_decendant VARCHAR(16) NULL, /* headings only */ + last_decendant VARCHAR(16) NULL, -- headings only digest_clean CHAR(256), digest_all CHAR(256), html_seg_url CHAR(256), |