From 4ff01a81f048c0b496cc03627324b69b7aebd368 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 7 Sep 2017 16:54:23 -0400 Subject: 0.19.0 conf make meta, composite struct, instead of associative array * remove conf make meta associative arrays, including native doc header (which revisit) --- src/sdp/meta/defaults.d | 279 +++++++++++++++++++++++++----------------------- 1 file changed, 144 insertions(+), 135 deletions(-) (limited to 'src/sdp/meta/defaults.d') diff --git a/src/sdp/meta/defaults.d b/src/sdp/meta/defaults.d index 4880f5b..ede1523 100644 --- a/src/sdp/meta/defaults.d +++ b/src/sdp/meta/defaults.d @@ -22,142 +22,151 @@ template SiSUregisters() { std.uni, std.utf, std.conv : to; - static string[string][string] conf_aa_empty() { - auto conf_ = [ - "webserv": [ - "url_root" : "", - "path" : "~/sdp_www" , - "images" : "" , - "cgi" : "/usr/local/lib/sdp-cgi" - ], - "webserv_cgi": [ - "host" : "localhost", - "base_path" : "", - "port" : "8081", - "user" : "", - "file_links" : "www.sisudoc.org" - ], - "processing": [ - "path" : "~", - "dir" : "_sisu_processing", - "concord_max" : "400000" - ], - "flag": [ - "act0" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest --verbose", - "act1" : "--digest --text --html --manifest", - "act2" : "--digest --text --html --epub --pdf --manifest", - "act3" : "--digest --qrcode --text --html --epub --concordance --pdf --manifest", - "act4" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --manifest", - "act5" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --sqlite --manifest", - "act6" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest", - "act7" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --source --sisupod --manifest", - "act8" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --manifest", - "act9" : "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --source --sisupod --manifest" - ], - "default": [ - "papersize" : "a4,letter", - "text_wrap" : "78", - "emphasis" : "bold", - "language" : "en", - "digest" : "sha256" - ], - "permission": [ - "share_source" : "" - ], - "program_select": [ - "editor" : "vim", - "epub_viewer" : "ebook-viewer", - "html_viewer" : "xombrero", - "odf_viewer" : "lowriter", - "pdf_viewer" : "evince", - "xml_viewer" : "xml-viewer" - ], - "search": [ - "flag" : "", - "action" : "", - "db" : "", - "title" : "" - ], - "make": [ - "bold" : "", - "breaks" : "", - "cover_image" : "", - "css" : "", - "emphasis" : "", - "footer" : "", - "headings" : "", - "home_button_image" : "", - "home_button_text" : "", - "italics" : "", - "num_top" : "", - "num_depth" : "", - "substitute" : "", - "texpdf_font" : "" - ], - ]; - return conf_; + struct ConfCompositeMake { + string bold = ""; + string breaks = ""; + string cover_image = ""; + string css = ""; + string emphasis = ""; + string footer = ""; + string headings = ""; + string home_button_image = ""; + string home_button_text = ""; + string italics = ""; + string num_top = ""; + string num_depth = ""; + string substitute = ""; + string texpdf_font = ""; } - static string[string][string] meta_aa_empty() { - auto meta_ = [ - "classify": [ - "dewey" : "", - "keywords" : "", - "loc" : "", - "subject" : "", - "topic_register" : "" - ], - "creator": [ - "author" : "", - "author_email" : "", - "illustrator" : "", - "translator" : "" - ], - "date": [ - "added_to_site" : "", - "available" : "", - "created" : "", - "issued" : "", - "modified" : "", - "published" : "", - "valid" : "" - ], - "identifier": [ - "isbn" : "", - "oclc" : "", - "pg" : "" - ], - "links": [ - "link" : "" - ], - "notes": [ - "abstract" : "", - "description" : "" - ], - "original": [ - "language" : "", - "source" : "", - "title" : "" - ], - "publisher": [ - "name" : "" - ], - "rights": [ - "copyright" : "", - "cover" : "", - "illustrations" : "", - "license" : "" - ], - "title": [ - "edition" : "", - "full" : "", - "language" : "", - "main" : "", - "note" : "", - "sub" : "", - "subtitle" : "" - ] - ]; - return meta_; + struct ConfCompositeMakeStr { + string bold = ""; + string breaks = ""; + string cover_image = ""; + string css = ""; + string emphasis = ""; + string footer = ""; + string headings = ""; + string home_button_image = ""; + string home_button_text = ""; + string italics = ""; + string num_top = ""; + string num_depth = ""; + string substitute = ""; + string texpdf_font = ""; + } + struct ConfCompositeSiteLocal { + string webserv_url_root = ""; + string webserv_path = ""; + string webserv_images = ""; + string webserv_cgi = ""; + string webserv_cgi_host = ""; + string webserv_cgi_host_path = ""; + string webserv_cgi_port = ""; + string webserv_cgi_user = ""; + string webserv_cgi_file_links = ""; + string processing_path = ""; + string processing_dir = ""; + string processing_concord_max = ""; + string flag_act0 = ""; + string flag_act1 = ""; + string flag_act2 = ""; + string flag_act3 = ""; + string flag_act4 = ""; + string flag_act5 = ""; + string flag_act6 = ""; + string flag_act7 = ""; + string flag_act8 = ""; + string flag_act9 = ""; + string default_papersize = ""; + string default_text_wrap = ""; + string default_emphasis = ""; + string default_language = ""; + string default_digest = ""; + string permission_share_source = ""; + string search_flag = ""; + string search_action = ""; + string search_db = ""; + string search_title = ""; + } + struct MetaComposite { + string classify_dewey = ""; + string classify_keywords = ""; + string classify_loc = ""; + string classify_subject = ""; + string classify_topic_register = ""; + string creator_author = ""; + string creator_author_email = ""; + string creator_illustrator = ""; + string creator_translator = ""; + string date_added_to_site = ""; + string date_available = ""; + string date_created = ""; + string date_issued = ""; + string date_modified = ""; + string date_published = ""; + string date_valid = ""; + string identifier_isbn = ""; + string identifier_oclc = ""; + string identifier_pg = ""; + string links = ""; + string notes_abstract = ""; + string notes_description = ""; + string original_language = ""; + string original_source = ""; + string original_title = ""; + string publisher = ""; + string rights_copyright = ""; + string rights_cover = ""; + string rights_illustrations = ""; + string rights_license = ""; + string title_edition = ""; + string title_full = ""; + string title_language = ""; + string title_main = ""; + string title_note = ""; + string title_sub = ""; + string title_subtitle = ""; + } + struct ConfComposite { + MetaComposite meta; + ConfCompositeMake make; + ConfCompositeSiteLocal conf; + } + struct ConfCompositePlus { + MetaComposite meta; + ConfCompositeMake make; + ConfCompositeMakeStr make_str; + ConfCompositeSiteLocal conf; + } + string extractSDLangTabOrAttrib(S)(S conf_sdlang, string maintab, string atab) { + string _conf_composite_string = ""; + if (maintab in conf_sdlang.maybe.tags) { + auto _maintag = conf_sdlang.getTag(maintab); + if ((atab in _maintag.maybe.tags) + && (_maintag.getTagValues(atab).length > 0)) { + debug(configsdlang) { + writeln(__LINE__, ": make:", atab, ": ", _maintag.getTagValues(atab)[0]); + } + if (_maintag.getTagValues(atab).length == 1) { + writeln((_maintag.getTagValues(atab)[0]).to!string); + _conf_composite_string = (_maintag.getTagValues(atab)[0]).to!string; + } else if (_maintag.getTagValues(atab).length > 1) { + string _tmp = ""; + foreach (st; _maintag.getTagValues(atab)) { + writeln(st.to!string, ";"); + _tmp ~= st.to!string ~ ";"; + } + _conf_composite_string = _tmp; + } + } else if ((atab in _maintag.maybe.attributes) + && (_maintag.maybe.attributes[atab][0].value.length > 0)) { + debug(configsdlang) { + writeln(__LINE__, ": make:", atab, ": ", conf_sdlang.tags[maintag][0].attributes[atab][0].value); + } + _conf_composite_string = (_maintag.attributes[atab][0].value).to!string; + } + } + return _conf_composite_string; } static auto ptr_head_main = [ -- cgit v1.2.3