From 9a91485c10e059dee1374e152e4b068cd9d3866c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 5 Dec 2019 11:41:09 -0500 Subject: 0.9.2 @safe & @trusted first pass --- org/in_source_files.org | 16 +++--- org/meta_conf_make_meta.org | 4 +- org/metaverse.org | 118 +++++++++++++++++++++---------------------- org/out_harvest_metadata.org | 2 +- org/out_latex.org | 38 +++++++------- org/out_odt.org | 76 ++++++++++++++-------------- org/out_xmls.org | 106 +++++++++++++++++++------------------- org/out_xmls_css.org | 4 +- org/spine.org | 110 ++++++++++++++++++++-------------------- 9 files changed, 239 insertions(+), 235 deletions(-) (limited to 'org') diff --git a/org/in_source_files.org b/org/in_source_files.org index 4c61ecc..907820c 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -267,7 +267,7 @@ static template spineRawMarkupContent() { mixin spineRgxInit; static auto rgx = Rgx(); string[] _images=[]; - auto _extract_images(S)(S content_block) { + auto _extract_images(S)(S content_block) @safe { string[] images_; string _content_block = content_block.to!string; if (auto m = _content_block.matchAll(rgx.image)) { @@ -276,7 +276,7 @@ static template spineRawMarkupContent() { return images_; } auto rawsrc = RawMarkupContent(); - auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { + auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) @safe { auto _0_header_1_body_content_2_insert_filelist_tuple = rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src); return _0_header_1_body_content_2_insert_filelist_tuple; @@ -288,7 +288,11 @@ static template spineRawMarkupContent() { = raw.markupSourceReadIn(fn_src); return source_txt_str; } - final auto sourceContentSplitIntoHeaderAndBody(O)(O _opt_action, in string source_txt_str, in string fn_src="") { + final auto sourceContentSplitIntoHeaderAndBody(O)( + O _opt_action, + in string source_txt_str, + in string fn_src="" + ) { auto raw = MarkupRawUnit(); string[] insert_file_list; string[] images_list; @@ -402,7 +406,7 @@ split is on first match of level A~ (which is required) #+name: meta_markup_source_raw_doc_header_and_content_split #+BEGIN_SRC d -final private char[][] header0Content1(in string src_text) { +final private char[][] header0Content1(in string src_text) @trusted { // cast(char[]) /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/ char[][] header_and_content; auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a); @@ -421,7 +425,7 @@ final private char[][] header0Content1(in string src_text) { #+name: meta_markup_source_raw_source_line_array #+BEGIN_SRC d -final private char[][] markupSourceLineArray(in char[] src_text) { +final private char[][] markupSourceLineArray(in char[] src_text) @trusted { // cast(char[]) char[][] source_line_arr = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); return source_line_arr; @@ -457,7 +461,7 @@ auto markupSourceReadIn(in string fn_src) { #+name: meta_markup_source_raw_tuple_of_header_and_body #+BEGIN_SRC d -auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) { +auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) @safe { string[] file_insert_list = []; string[] images_list = []; char[][] hc = header0Content1(source_txt_str); diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index 056985b..9fad67a 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -78,7 +78,7 @@ auto mkup = InlineMarkup(); #+name: meta_defaults_template_structs #+BEGIN_SRC d -string url_markup(string line) { +string url_markup(string line) @safe { string line_ = line .replaceAll( rgx.smid_inline_link_markup_regular, @@ -1161,7 +1161,7 @@ static template contentJSONtoSpineStruct() { doc_reform.meta.defaults, doc_reform.meta.rgx; ConfComposite _struct_composite; - auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) { + auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) @safe { mixin spineRgxInit; static auto rgx = Rgx(); debug (json) { diff --git a/org/metaverse.org b/org/metaverse.org index 538e12b..f184d9e 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -38,7 +38,7 @@ template docAbstraction() { <> <> /+ ↓ abstract marked up document +/ - auto docAbstraction(CMM,Opt,Mf)( + auto docAbstraction(CMM,Opt,Mf) ( char[][] markup_sourcefile_content, CMM conf_make_meta, Opt opt_action, @@ -3075,7 +3075,7 @@ functions used in document abstraction #+name: abs_functions_object_reset #+BEGIN_SRC d -static string[string] object_reset()(string[string] an_object) { +static string[string] object_reset()(string[string] an_object) @safe { an_object.remove("body_nugget"); an_object.remove("substantive"); an_object.remove("is"); @@ -3109,7 +3109,7 @@ void flow_common_reset_()( static int[string] _check_ocn_status_()( char[] line, int[string] obj_type_status, -) { +) @safe { static auto rgx = Rgx(); if (!(line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) @@ -3175,7 +3175,7 @@ static int[string] _check_ocn_status_()( char[] _doc_header_and_make_substitutions_(CMM)( char[] line, CMM conf_make_meta, -) { +) @safe { enum Substitute { match, markup, } if (conf_make_meta.make.substitute) { foreach(substitution_pair; conf_make_meta.make.substitute) { @@ -3196,7 +3196,7 @@ char[] _doc_header_and_make_substitutions_(CMM)( char[] _doc_header_and_make_substitutions_fontface_(CMM)( char[] line, CMM conf_make_meta, -) { +) @safe { enum Substitute { match, markup, } if ( conf_make_meta.make.bold) { line = line.replaceAll( @@ -3231,7 +3231,7 @@ void flow_txt_block_start()( return ref int[string] obj_type_status, return ref uint[string] dochas, return ref string[string] object_number_poem -) { +) @safe { #+END_SRC ****** block (various) curly open :curly: @@ -3514,7 +3514,7 @@ void flow_txt_block_code()( char[] line, return ref string[string] an_object, return ref int[string] obj_type_status -) { +) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { @@ -3750,7 +3750,7 @@ string[string] flow_txt_block_quote()( char[] line, string[string] an_object, return ref int[string] obj_type_status -) { +) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { @@ -3798,7 +3798,7 @@ string[string] flow_txt_block_group()( char[] line, string[string] an_object, return ref int[string] obj_type_status -) { +) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { @@ -3847,7 +3847,7 @@ string[string] flow_txt_block_block()( char[] line, string[string] an_object, return ref int[string] obj_type_status -) { +) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { @@ -3898,7 +3898,7 @@ string[string] flow_txt_block_poem(CMM)( string[string] object_number_poem, CMM conf_make_meta, string[string] tag_in_seg, -) { +) @safe { static auto rgx = Rgx(); if (obj_type_status["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { @@ -4694,7 +4694,7 @@ string[string] flow_heading_found_()( string[] _make_unmarked_headings, return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status -) { +) @safe { static auto rgx = Rgx(); if ((_make_unmarked_headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ @@ -4780,7 +4780,7 @@ char[] flow_heading_make_set_()( int[string] line_occur, return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status -) { +) @safe { if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) @@ -4846,7 +4846,7 @@ string[string] flow_heading_matched_(CMM)( return ref int[string] collapsed_lev, return ref int[string] obj_type_status, return ref CMM conf_make_meta, -) { +) @safe { static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ ++line_occur["heading"]; @@ -5004,7 +5004,7 @@ string[string] flow_para_match_()( return ref bool bullet, return ref int[string] obj_type_status, return ref int[string] line_occur, -) { +) @safe { static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); @@ -5057,7 +5057,7 @@ string[string] flow_para_match_()( #+BEGIN_SRC d char[] font_faces_line()( char[] textline, -) { +) @safe { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); if (textline.match(rgx.inline_faces_line)) { @@ -5087,7 +5087,7 @@ char[] font_faces_line()( ObjGenericComposite flow_table_instructions(H)( return ref ObjGenericComposite table_object, H table_head, -) { +) @safe { static auto rgx = Rgx(); table_object.metainfo.is_of_part = "body"; table_object.metainfo.is_of_section = "body"; @@ -5118,7 +5118,7 @@ ObjGenericComposite flow_table_instructions(H)( ObjGenericComposite flow_table_array_munge(T)( return ref ObjGenericComposite table_object, return ref T table_array, -) { +) @safe { static auto rgx = Rgx(); static auto mng = InlineMarkup(); string _table_substantive; @@ -5295,7 +5295,7 @@ pure struct OCNemitter { int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_; string object_identifier; bool ocn_is_off; - auto ocn_emitter(int ocn_status_flag) { + auto ocn_emitter(int ocn_status_flag) @safe { OCNset ocn; assert(ocn_status_flag <= OCNstatus.reset); ocn_object_number = ocn_bkidx = 0; @@ -5355,7 +5355,7 @@ static struct ObjInlineMarkupMunge { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); int stage_reset_note_numbers = true; - private auto initialize_note_numbers() { + private auto initialize_note_numbers() @safe { n_foot = 0; n_foot_reg = 0; n_foot_sp_asterisk = 0; @@ -5365,7 +5365,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - static auto images()(string obj_txt_in) { + static auto images()(string obj_txt_in) @safe { static auto mng = InlineMarkup(); /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented @@ -5401,7 +5401,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { + auto footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) @safe { /+ endnotes (regular) +/ bool flg_notes_reg = false; bool flg_notes_star = false; @@ -5474,7 +5474,7 @@ static struct ObjInlineMarkupMunge { private auto object_notes_and_links_()( string obj_txt_in, bool reset_note_numbers=false - ) { + ) @safe { obj_txt_out = ""; bool urls = false; bool images_without_dimensions = false; @@ -5545,7 +5545,7 @@ static struct ObjInlineMarkupMunge { auto munge_heading()( string obj_txt_in, bool reset_note_numbers=false - ) { + ) @safe { obj_txt["munge"] = obj_txt_in .replaceFirst(rgx.heading, "") .replaceFirst(rgx.object_number_off_all, "") @@ -5573,7 +5573,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_para()(string obj_txt_in) { + auto munge_para()(string obj_txt_in) @safe { obj_txt["munge"]=(obj_txt_in) .replaceFirst(rgx.para_attribs, "") .replaceFirst(rgx.object_number_off_all, ""); @@ -5592,7 +5592,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_quote()(string obj_txt_in) { + string munge_quote()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5611,7 +5611,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_group(string obj_txt_in) { + auto munge_group(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5631,7 +5631,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_block()(string obj_txt_in) { + auto munge_block()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5651,7 +5651,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_verse()(string obj_txt_in) { + auto munge_verse()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5670,7 +5670,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_code()(string obj_txt_in) { + string munge_code()(string obj_txt_in) @safe { obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); obj_txt["munge"] = obj_txt_in; return obj_txt["munge"]; @@ -5685,7 +5685,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_table()(string obj_txt_in) { + string munge_table()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5697,7 +5697,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_comment()(string obj_txt_in) { + string munge_comment()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5733,7 +5733,7 @@ static struct ObjInlineMarkup { string obj_key_, CMM conf_make_meta, Flag!"_new_doc" _new_doc - ) { + ) @safe { obj_txt["munge"] = obj_[obj_key_].dup; obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] @@ -5829,7 +5829,7 @@ static struct ObjInlineMarkup { #+BEGIN_SRC d auto _clean_heading_toc_()( char[] heading_toc_, - ) { + ) @safe { auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading); heading_toc_ = (m.post).replaceAll( rgx.inline_notes_curly_gen, @@ -5843,7 +5843,7 @@ static struct ObjInlineMarkup { string _anchor_tag, return ref string[][string] lev4_subtoc, ObjGenericComposite[] the_table_of_contents_section, - ) { + ) @safe { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; static auto mkup = InlineMarkup(); @@ -5938,7 +5938,7 @@ private: string[string] obj_, CMM conf_make_meta, bool _new_doc, - ) { + ) @safe { if (_new_doc) { heading_num = [ 0, 0, 0, 0 ]; heading_number_auto_composite = ""; @@ -6087,7 +6087,7 @@ private: string munge_, string lev_, bool _new_doc - ) { + ) @safe { if (!(munge_.match(rgx.heading_anchor_tag))) { if (munge_.match(rgx.heading_identify_anchor_tag)) { if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { @@ -6142,7 +6142,7 @@ struct ObjAttributes { string obj_is_, string obj_raw, ObjGenericComposite _comp_obj_heading, - ) { + ) @safe { scope(exit) { destroy(obj_is_); destroy(obj_raw); @@ -6243,7 +6243,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_heading()(string obj_txt_in) { + string txt_heading()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"heading\""; @@ -6257,7 +6257,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_para()(string obj_txt_in) { + string txt_para()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"para\""; @@ -6271,7 +6271,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_quote()(string obj_txt_in) { + string txt_quote()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"quote\""; @@ -6285,7 +6285,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_group()(string obj_txt_in) { + string txt_group()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"group\""; @@ -6299,7 +6299,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_block()(string obj_txt_in) { + string txt_block()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"block\""; @@ -6313,7 +6313,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_verse()(string obj_txt_in) { + string txt_verse()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"verse\""; @@ -6327,7 +6327,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_code()(string obj_txt_in) { + string txt_code()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"code\""; @@ -6341,7 +6341,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_table()(string obj_txt_in) { + string txt_table()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"table\""; @@ -6355,7 +6355,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_comment()(string obj_txt_in) { + string txt_comment()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"comment\"," ~ " \"of\": \"comment\"," ~ " \"is\": \"comment\""; @@ -6373,7 +6373,7 @@ struct ObjAttributes { string _obj_attrib, string obj_is_, ObjGenericComposite _comp_obj_heading, - ) { + ) @safe { JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) @@ -6416,7 +6416,7 @@ struct BookIndexNuggetHash { string bookindex_section, N obj_cite_digits, S tag_in_seg, - ) { + ) @safe { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -6490,7 +6490,7 @@ struct BookIndexReportIndent { int mkn, skn; void bookindex_report_indented()( string[][string][string] bookindex_unordered_hashes - ) { + ) @safe { auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { @@ -6531,7 +6531,7 @@ struct BookIndexReportSection { #+BEGIN_SRC d void bookindex_write_section()( string[][string][string] bookindex_unordered_hashes - ) { + ) @safe { auto mainkeys = bookindex_unordered_hashes.byKey.array .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; @@ -6749,7 +6749,7 @@ struct NotesSection { ObjGenericComposite[] contents_am, string[string] tag_in_seg, int cntr, - ) { + ) @safe { assert((contents_am[cntr].metainfo.is_a == "para") || (contents_am[cntr].metainfo.is_a == "heading") || (contents_am[cntr].metainfo.is_a == "quote") @@ -6831,7 +6831,7 @@ struct NotesSection { #+name: meta_emitters_endnotes #+BEGIN_SRC d - private auto gathered_notes() { + private auto gathered_notes() @safe { string[][string] endnotes_; if (object_notes.length > 1) { endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -6851,7 +6851,7 @@ struct NotesSection { private auto endnote_objects(N,O)( N obj_cite_digits, O opt_action, - ) { + ) @safe { mixin spineNode; ObjGenericComposite[] the_endnotes_section; auto endnotes_ = gathered_notes(); @@ -7108,7 +7108,7 @@ struct NodeStructureMetadata { int cntr_, int ptr_, string is_ - ) { + ) @safe { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -7176,7 +7176,7 @@ struct NodeStructureMetadata { fNr flag_notes_reg, fNs flag_notes_star, fL flag_links, - ) { + ) @safe { debug(asserts) { static assert(is(typeof(lev) == string)); static assert(is(typeof(obj_cite_digits.object_number) == int)); @@ -7372,7 +7372,7 @@ struct NodeStructureMetadata { pure void assertions_doc_structure()( string[string] an_object, int[string] lv -) { +) @safe { if (lv["h3"] > State.off) { assert(lv["h0"] > State.off); assert(lv["h1"] > State.off); @@ -7550,7 +7550,7 @@ pure void assertions_doc_structure()( #+name: abs_functions_assertions #+BEGIN_SRC d -pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) { +pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) @safe { assert( (obj_type_status["code"] == TriState.off) || (obj_type_status["code"] == TriState.closing), @@ -7579,7 +7579,7 @@ pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_ty #+name: template_doc_sect_keys_seq #+BEGIN_SRC d template docSectKeysSeq() { - auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { + auto docSectKeysSeq(string[][string] document_section_keys_sequenced) @safe { struct doc_sect_keys_seq { string[] scroll() { return document_section_keys_sequenced["scroll"]; diff --git a/org/out_harvest_metadata.org b/org/out_harvest_metadata.org index d893e26..35b48e9 100644 --- a/org/out_harvest_metadata.org +++ b/org/out_harvest_metadata.org @@ -25,7 +25,7 @@ template spineMetaDocHarvest() { auto spineMetaDocHarvest(T,H)( T doc_matters, H hvst, - ) { + ) @safe { <> mixin InternalMarkup; <> diff --git a/org/out_latex.org b/org/out_latex.org index 5f2021c..4e0ff3e 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -129,7 +129,7 @@ import #+BEGIN_SRC d auto paper() { struct PaperType { - auto a4() { + auto a4() @safe { struct A4 { auto portrait() { struct V { @@ -150,7 +150,7 @@ import } return A4(); } - auto a5() { + auto a5() @safe { struct A5 { auto portrait() { struct V { @@ -171,7 +171,7 @@ import } return A5(); } - auto b4() { + auto b4() @safe { struct B4 { auto portrait() { struct V { @@ -192,7 +192,7 @@ import } return B4(); } - auto letter() { + auto letter() @safe { struct Letter { auto portrait() { struct V { @@ -213,7 +213,7 @@ import } return Letter(); } - auto legal() { + auto legal() @safe { struct Legal { auto portrait() { struct V { @@ -247,7 +247,7 @@ import string sp_char_esc(O)( string _txt, const O obj, -) { +) @safe { string _unescape_sp_char_esc()(string _txt) { _txt = _txt .replaceAll(rgx.latex_special_char_escaped, @@ -275,7 +275,7 @@ string sp_char_esc(O)( #+BEGIN_SRC d string sp_char_esc_txt()( string _txt, -) { +) @safe { string _unescape_sp_char_esc()(string _txt) { _txt = _txt .replaceAll(rgx.latex_special_char_escaped, @@ -302,7 +302,7 @@ string sp_char_esc_txt()( #+BEGIN_SRC d string sp_char_esc()( string _txt, -) { +) @safe { _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char); return _txt; } @@ -317,7 +317,7 @@ string sp_char_esc()( #+BEGIN_SRC d string fontface()( string _txt, -) { +) @safe { _txt = _txt .replaceAll(rgx.inline_emphasis, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1")) .replaceAll(rgx.inline_bold, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1")) @@ -340,7 +340,7 @@ _txt = _txt #+BEGIN_SRC d string leading_hardspaces()( string _txt, -) { +) @safe { string hardspaces(string _spaces) { _spaces = _spaces .replaceAll(rgx.space, "\\hardspace "); @@ -355,7 +355,7 @@ string leading_hardspaces()( #+name: output_latex_shared #+BEGIN_SRC d -string nbsp_char()(string _txt) { +string nbsp_char()(string _txt) @safe { if (_txt.match(rgx.nbsp_char)) { _txt = _txt.replaceAll(rgx.nbsp_char, "\\hardspace "); } @@ -367,7 +367,7 @@ string nbsp_char()(string _txt) { #+name: output_latex_shared #+BEGIN_SRC d -string nbsp_char_to_space()(string _txt) { +string nbsp_char_to_space()(string _txt) @safe { if (_txt.match(rgx.nbsp_char)) { _txt = _txt.replaceAll(rgx.nbsp_char, " "); } @@ -384,7 +384,7 @@ string links_and_images(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { if (obj.has.inline_links) { // TODO some images do not have inline links ... image without link string _width_adjust(string _width) { if (_width.to!int > 300) { _width = "300"; } // will need to vary max with papersize & orientation @@ -434,7 +434,7 @@ string links_and_images(O,M)( #+BEGIN_SRC d string footnotes()( string _txt, -) { +) @safe { if (_txt.match(rgx.inline_notes_al_gen)) { string _tex_note = q"┃\hypertarget{noteref_%s}{}\footnote[%s]{%% \label{note_%s}%s}┃"; @@ -455,7 +455,7 @@ string footnotes()( #+BEGIN_SRC d string remove_footnotes()( string _txt, -) { +) @safe { if (_txt.match(rgx.inline_notes_al_gen)) { _txt = replaceAll!(m => "")(_txt, rgx.inline_notes_al_gen); } @@ -471,7 +471,7 @@ string remove_footnotes()( string para(O)( string _txt, O obj, -) { +) @safe { if (obj.metainfo.is_of_type == "para") { string _tex_para; _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s┃"; @@ -492,7 +492,7 @@ string para(O)( string bookindex(O)( string _txt, O obj, -) { +) @safe { if (obj.metainfo.is_of_type == "para" && obj.metainfo.is_a == "bookindex" ) { @@ -513,7 +513,7 @@ string bookindex(O)( string bullets_and_indentation(O)( string _txt, O obj, -) { +) @safe { string _tex_para; string _hang; string _indent; int _paper_margin = -10; @@ -560,7 +560,7 @@ string bullets_and_indentation(O)( O obj, M doc_matters, string _part = "" - ) { + ) @safe { if (obj.metainfo.is_a == "heading") { string _tex_para; string _pg_break; diff --git a/org/out_odt.org b/org/out_odt.org index 61879a3..59e731c 100644 --- a/org/out_odt.org +++ b/org/out_odt.org @@ -89,7 +89,7 @@ template outputODT() { #+name: odt_format_objects #+BEGIN_SRC d -string _tags(O)(const O obj){ +string _tags(O)(const O obj) @safe { string _tags = ""; if (obj.tags.anchor_tags.length > 0) { foreach (tag_; obj.tags.anchor_tags) { @@ -113,7 +113,7 @@ string _tags(O)(const O obj){ #+name: odt_format_objects #+BEGIN_SRC d -string _xhtml_anchor_tags(O)(O obj) { +string _xhtml_anchor_tags(O)(O obj) @safe { const(string[]) anchor_tags = obj.tags.anchor_tags; string tags=""; if (anchor_tags.length > 0) { @@ -131,7 +131,7 @@ string _xhtml_anchor_tags(O)(O obj) { #+name: odt_format_objects #+BEGIN_SRC d -string obj_num(O)(const O obj){ // TODO +string obj_num(O)(const O obj) @safe { // TODO string _on; _on = (obj.metainfo.object_number.empty) ? "" @@ -147,7 +147,7 @@ string obj_num(O)(const O obj){ // TODO #+name: odt_format_objects #+begin_src d -string _footnotes()(string _txt){ +string _footnotes()(string _txt) @safe { static auto rgx = Rgx(); _txt = _txt.replaceAll( rgx.inline_notes_al_regular_number_note, @@ -172,7 +172,7 @@ string _footnotes()(string _txt){ #+name: odt_format_objects #+BEGIN_SRC d -string _bullet(O)(const O obj){ +string _bullet(O)(const O obj) @safe { string _b = ""; if (obj.attrib.bullet) { _b = format(q"┃● ┃",); @@ -185,7 +185,7 @@ string _bullet(O)(const O obj){ #+name: odt_format_objects #+BEGIN_SRC d -string _indent(O)(string _txt, const O obj) { // TODO +string _indent(O)(string _txt, const O obj) @safe { // TODO // if (obj.attrib.indent_base > 0 || // obj.attrib.indent_hang > 0 // ) { @@ -299,7 +299,7 @@ string _indent(O)(string _txt, const O obj) { // TODO #+name: odt_format_objects #+BEGIN_SRC d -string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO +string _block_type_delimiters(O)(string[] _block_lines, const O obj) @safe { // TODO string _block = ""; foreach (i, _line; _block_lines) { _line = _footnotes(_line); @@ -340,7 +340,7 @@ string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO #+name: odt_format_objects #+BEGIN_SRC d -string _special_characters(O)(string _txt, const O obj) { +string _special_characters(O)(string _txt, const O obj) @safe { _txt = _txt .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_quotation, """) @@ -355,7 +355,7 @@ string _special_characters(O)(string _txt, const O obj) { #+name: odt_format_objects #+BEGIN_SRC d -string _preserve_white_spaces(O)(string _txt, const O obj) { +string _preserve_white_spaces(O)(string _txt, const O obj) @safe { if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") { _txt = _txt .replaceAll(rgx.space, " "); @@ -388,9 +388,9 @@ string _font_face(string _txt){ #+name: odt_format_objects #+BEGIN_SRC d -auto _obj_num(O)(O obj) { // NOT USED YET +auto _obj_num(O)(O obj) @safe { // NOT USED YET struct objNum { - string reference() { + string reference() @safe { return format(q"┃ @@ -399,7 +399,7 @@ auto _obj_num(O)(O obj) { // NOT USED YET obj.object_number, ); } - string display() { + string display() @safe { return format(q"┃ %s%s%s ┃", @@ -417,7 +417,7 @@ auto _obj_num(O)(O obj) { // NOT USED YET #+name: odt_format_objects #+BEGIN_SRC d -string _break_page()() { +string _break_page()() @safe { return format(q"┃ ┃", @@ -426,7 +426,7 @@ string _break_page()() { #+END_SRC #+BEGIN_SRC d -string _break_page()() { +string _break_page()() @safe { return format(q"┃ ┃", @@ -438,7 +438,7 @@ string _break_page()() { #+name: odt_format_objects #+BEGIN_SRC d -string _empty_line_break(O)(string _txt, const O obj) { +string _empty_line_break(O)(string _txt, const O obj) @safe { if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") { _txt = _txt .replaceAll(rgx.br_empty_line, "
"); @@ -451,7 +451,7 @@ string _empty_line_break(O)(string _txt, const O obj) { #+name: odt_format_objects #+BEGIN_SRC d -string _links(O)(string _txt, const O obj) { +string _links(O)(string _txt, const O obj) @safe { if (obj.metainfo.is_a != "code") { if (obj.metainfo.is_a == "toc") { _txt = replaceAll!(m => @@ -497,7 +497,7 @@ string _links(O)(string _txt, const O obj) { #+name: odt_format_objects #+BEGIN_SRC d -string _images(O)(string _txt, const O obj) { +string _images(O)(string _txt, const O obj) @safe { if (_txt.match(rgx.inline_image)) { _txt = _txt .replaceAll(rgx.inline_image, @@ -514,7 +514,7 @@ string _images(O)(string _txt, const O obj) { #+name: odt_format_objects #+BEGIN_SRC d -string markup(O)(const O obj) { +string markup(O)(const O obj) @safe { /+ markup TODO +/ string _txt = obj.text; _txt = _special_characters(_txt, obj); // TODO & why both obj & obj.text, consider also in output_xmls.org @@ -539,7 +539,7 @@ string markup(O)(const O obj) { string heading(O,M)( const O obj, const M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "para"); @@ -589,7 +589,7 @@ string heading(O,M)( string para(O,M)( const O obj, const M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "para"); @@ -615,7 +615,7 @@ string para(O,M)( string quote(O,M)( const O obj, const M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -636,7 +636,7 @@ string quote(O,M)( string group(O,M)( const O obj, const M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -671,7 +671,7 @@ string group(O,M)( string block(O,M)( const O obj, const M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -694,7 +694,7 @@ string block(O,M)( string verse(O,M)( const O obj, const M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -713,7 +713,7 @@ string verse(O,M)( string code(O,M)( const O obj, const M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); @@ -767,7 +767,7 @@ string code(O,M)( auto tablarize(O)( const O obj, string _txt, -) { +) @safe { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; string _table; @@ -808,7 +808,7 @@ int _table_number = 0; string table(O,M)( const O obj, const M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); @@ -1011,7 +1011,7 @@ void dirtree(I)( #+name: output_odt_fixed_mimetype #+BEGIN_SRC d -string mimetype() { +string mimetype() @safe { string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃"); return mimetype_; } @@ -1021,7 +1021,7 @@ string mimetype() { #+name: output_odt_fixed_manifest_rdf #+BEGIN_SRC d -string manifest_rdf() { +string manifest_rdf() @safe { string _manifest_rdf = format(q"┃ #+END_SRC @@ -1057,7 +1057,7 @@ string manifest_rdf() { #+name: output_odt_fixed_settings_xml #+BEGIN_SRC d -string settings_xml() { +string settings_xml() @safe { string _settings_xml = format(q"┃ #+END_SRC @@ -1171,7 +1171,7 @@ string settings_xml() { #+name: output_odt_fixed_styles_xml #+BEGIN_SRC d -string styles_xml() { +string styles_xml() @safe { string _styles_xml = format(q"┃ #+END_SRC @@ -2084,7 +2084,7 @@ string styles_xml() { #+name: output_odt_variable_content_xml #+BEGIN_SRC d -string odt_head(I)(I doc_matters) { +string odt_head(I)(I doc_matters) @safe { string _has_tables = format(q"┃ #+END_SRC @@ -2226,7 +2226,7 @@ string odt_head(I)(I doc_matters) { string odt_body(D,I)( const D doc_abstraction, I doc_matters, -) { +) @safe { mixin formatODT; auto odt_format = formatODT(); string delimit = ""; @@ -2390,7 +2390,7 @@ string odt_body(D,I)( #+name: output_odt_variable_content_xml #+BEGIN_SRC d -string odt_tail() { +string odt_tail() @safe { string _odt_tail = format(q"┃spine: <www.doc_reform.org> and <www.sisudoc.org> ┃",); return _odt_tail; @@ -2404,7 +2404,7 @@ string odt_tail() { string content_xml(D,I)( const D doc_abstraction, I doc_matters, -) { +) @safe { string _content_xml; string break_line = (doc_matters.opt.action.debug_do) ? "\n" : ""; string odt_break_page = format(q"┃┃",); @@ -2424,7 +2424,7 @@ string content_xml(D,I)( #+BEGIN_SRC d string manifest_xml(M)( auto ref M doc_matters, -) { +) @safe { string _bullet = format(q"┃┃"); string[] _images = [ _bullet ]; foreach (image; doc_matters.srcs.image_list) { @@ -2462,7 +2462,7 @@ _images.join("\n"), #+BEGIN_SRC d string meta_xml(M)( auto ref M doc_matters, -) { +) @safe { /+ (meta_xml includes output time-stamp) +/ string _meta_xml = format(q"┃ #+END_SRC @@ -2496,7 +2496,7 @@ doc_matters.generated_time, #+BEGIN_SRC d void images_cp(M)( auto ref M doc_matters, -) { +) @safe { { /+ (copy odt images) +/ auto pth_odt = spinePathsODT!()(doc_matters); foreach (image; doc_matters.srcs.image_list) { diff --git a/org/out_xmls.org b/org/out_xmls.org index e875330..52a0ac1 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -61,7 +61,7 @@ import string div_delimit( string part, return ref string previous_part -){ +) @safe { string delimit = ""; string delimit_ = ""; if (part != previous_part) { @@ -94,7 +94,7 @@ string div_delimit( #+name: xhtml_format_objects #+BEGIN_SRC d -string special_characters_text(string _txt){ +string special_characters_text(string _txt) @safe { _txt = _txt .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_quotation, """) @@ -111,7 +111,7 @@ string special_characters_text(string _txt){ #+BEGIN_SRC d string special_characters(O)( const O obj, -){ +) @safe { string _txt = special_characters_text(obj.text); if (!(obj.metainfo.is_a == "code")) { _txt = (_txt) @@ -125,7 +125,7 @@ string special_characters(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -string font_face(string _txt){ +string font_face(string _txt) @safe { _txt = _txt .replaceAll(rgx.inline_emphasis, ("$1")) .replaceAll(rgx.inline_bold, ("$1")) @@ -145,7 +145,7 @@ string font_face(string _txt){ #+name: xhtml_format_objects #+BEGIN_SRC d -string _xhtml_anchor_tags(O)(O obj) { +string _xhtml_anchor_tags(O)(O obj) @safe { const(string[]) anchor_tags = obj.tags.anchor_tags; string tags=""; if (anchor_tags.length > 0) { @@ -166,7 +166,7 @@ string _xhtml_anchor_tags(O)(O obj) { #+BEGIN_SRC d string header_metadata(M)( M doc_matters, -) { +) @safe { string _publisher="Publisher"; // TODO string o; o = format(q"┃ @@ -209,7 +209,7 @@ string header_metadata(M)( #+BEGIN_SRC d string site_info_button(M)( M doc_matters, -) { +) @safe { string _locations; if (doc_matters.conf_make_meta.make.home_button_text.length > 0) { _locations = (doc_matters.conf_make_meta.make.home_button_text) @@ -239,7 +239,7 @@ string site_info_button(M)( #+BEGIN_SRC d string inline_search_form(M)( M doc_matters, -) { +) @safe { string _action="http://www.sisudoc.org/cgi-bin/search.cgi"; string _db="spine.7a.manual"; string o; @@ -281,7 +281,7 @@ string inline_search_form(M)( string html_head(M)( M doc_matters, string type, -) { +) @safe { string _manifest = ""; if (doc_matters.opt.action.workon) { _manifest = format(q"┃ @@ -341,7 +341,7 @@ if (doc_matters.opt.action.workon) { #+BEGIN_SRC d string epub3_seg_head(M)( M doc_matters, -) { +) @safe { string html_base = format(q"┃ ┃", ); @@ -413,7 +413,7 @@ string epub3_seg_head(M)( #+name: xhtml_format_objects #+BEGIN_SRC d -string tail() { +string tail() @safe { string o; o = format(q"┃ @@ -435,7 +435,7 @@ string inline_images(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "seg", -) { +) @safe { string _img_pth; if (_xml_type == "epub") { _img_pth = "image/"; @@ -469,7 +469,7 @@ string inline_links(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "seg", -) { +) @safe { string seg_lvs; if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { @@ -565,7 +565,7 @@ string inline_notes_scroll(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { if (obj.has.inline_notes_reg) { _txt = font_face(_txt); _txt = _txt.replaceAll( @@ -602,7 +602,7 @@ auto inline_notes_seg(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { string[] _endnotes; if (obj.has.inline_notes_star) { _txt = font_face(_txt); @@ -674,7 +674,7 @@ string inline_markup_scroll(O,M)( const O obj, M doc_matters, string _suffix = ".html", -) { +) @safe { if (obj.metainfo.dummy_heading && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) { _txt = ""; @@ -697,7 +697,7 @@ auto inline_markup_seg(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "seg", -) { +) @safe { if (obj.metainfo.dummy_heading && ((_xml_type == "epub" && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) @@ -721,7 +721,7 @@ auto inline_markup_seg(O,M)( string lev4_heading_subtoc(O,M)( const O obj, M doc_matters, -) { +) @safe { char[] lev4_subtoc; lev4_subtoc ~= "
\n"; foreach (subtoc; obj.tags.lev4_subtoc) { @@ -754,7 +754,7 @@ string lev4_heading_subtoc(O,M)( auto nav_pre_next_svg(O,M)( const O obj, M doc_matters, -) { +) @safe { string prev, next, toc; string harvest_link = (doc_matters.opt.action.harvest_link) ? format(q"┃

[ T | A ]

┃") @@ -848,7 +848,7 @@ string heading(O,M)( const O obj, M doc_matters, string _xml_type = "html", -) { +) @safe { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "para"); @@ -919,7 +919,7 @@ string heading_scroll(O,M)( const O obj, M doc_matters, string _suffix = ".html", -) { +) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = heading(_txt, obj, doc_matters); return o; @@ -936,7 +936,7 @@ auto heading_seg(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0]; string[] _endnotes = t[1]; @@ -958,7 +958,7 @@ string para(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "para"); @@ -1011,7 +1011,7 @@ string para_scroll(O,M)( const O obj, M doc_matters, string _suffix = ".html", -) { +) @safe { if (obj.metainfo.is_a == "toc" && _txt.match(rgx.inline_link_toc_to_backmatter)) { _txt = _txt.replaceAll(rgx.inline_link_toc_to_backmatter, "┤#section_$1├"); } @@ -1031,7 +1031,7 @@ auto para_seg(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -1053,7 +1053,7 @@ string quote(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -1096,7 +1096,7 @@ string quote_scroll(O,M)( const O obj, M doc_matters, string _suffix = ".html", -) { +) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = quote(_txt, obj, doc_matters); return o; @@ -1113,7 +1113,7 @@ auto quote_seg(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -1135,7 +1135,7 @@ string group(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -1179,7 +1179,7 @@ string group_scroll(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = group(_txt, obj, doc_matters); return o; @@ -1196,7 +1196,7 @@ auto group_seg(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -1218,7 +1218,7 @@ string block(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -1258,7 +1258,7 @@ string block_scroll(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = block(_txt, obj, doc_matters); return o; @@ -1275,7 +1275,7 @@ auto block_seg(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -1297,7 +1297,7 @@ string verse(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); assert(obj.metainfo.is_of_type == "block"); @@ -1337,7 +1337,7 @@ string verse_scroll(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = verse(_txt, obj, doc_matters); return o; @@ -1354,7 +1354,7 @@ auto verse_seg(O,M)( M doc_matters, string _suffix = ".html", string _xml_type = "html", -) { +) @safe { auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; @@ -1375,7 +1375,7 @@ string code(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); @@ -1446,7 +1446,7 @@ align="left|right|center" auto tablarize(O)( string _txt, const O obj, -) { +) @safe { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; string _table; @@ -1486,7 +1486,7 @@ string table(O,M)( string _txt, const O obj, M doc_matters, -) { +) @safe { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); @@ -1541,7 +1541,7 @@ template outputHTML() { void scroll(D,M)( const D doc_abstraction, M doc_matters, -) { +) @safe { mixin spineOutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); @@ -1747,7 +1747,7 @@ void scroll(D,M)( void scroll_write_output(D,M)( D doc, M doc_matters, -) { +) @trusted { debug(asserts) { static assert(is(typeof(doc) == string[])); } @@ -1777,7 +1777,7 @@ void scroll_write_output(D,M)( void seg(D,M)( const D doc_abstraction, M doc_matters, -) { +) @safe { mixin spineOutputRgxInit; auto rgx = Rgx(); auto xhtml_format = outputXHTMLs(); @@ -2079,7 +2079,7 @@ void seg_write_output(D,E,M)( D doc_html, E doc_html_endnotes, M doc_matters, -) { +) @trusted { // @system? debug(asserts) { static assert(is(typeof(doc_html) == string[][string])); } @@ -2115,7 +2115,7 @@ void seg_write_output(D,E,M)( #+name: output_html_css #+BEGIN_SRC d -void css(M)(M doc_matters) { +void css(M)(M doc_matters) @safe { auto css = spineCss(doc_matters); auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); try { @@ -2138,7 +2138,7 @@ void css(M)(M doc_matters) { #+BEGIN_SRC d void images_cp(M)( M doc_matters, -) { +) @trusted { // @system { /+ (copy html images) +/ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); @@ -2205,7 +2205,7 @@ template outputEPub3() { #+name: output_epub3_fixed #+BEGIN_SRC d -string epub3_mimetypes() { +string epub3_mimetypes() @safe { string o; o = format(q"┃application/epub+zip┃") ~ "\n"; return o; @@ -2218,7 +2218,7 @@ string epub3_mimetypes() { #+name: output_epub3_fixed #+BEGIN_SRC d -string epub3_container_xml() { +string epub3_container_xml() @safe { string o; o = format(q"┃┃") ~ "\n"; o ~= format(q"┃ #+name: output_epub3_constructs #+BEGIN_SRC d -string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { +string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) @safe { auto xhtml_format = outputXHTMLs(); auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! @@ -2346,7 +2346,7 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { #+name: output_epub3_constructs #+BEGIN_SRC d -string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { +string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) @safe { enum DomTags { none, open, close, close_and_open, open_still, } auto markup = InlineMarkup(); auto rgx = Rgx(); @@ -2434,7 +2434,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { #+name: output_epub3_constructs #+BEGIN_SRC d -string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { +string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) @safe { int counter = 0; string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere auto markup = InlineMarkup(); @@ -2533,7 +2533,7 @@ string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { void outputEPub3(D,I)( const D doc_abstraction, I doc_matters, -) { +) { // @trusted mixin spineOutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); @@ -2890,7 +2890,7 @@ void outputEPub3(D,I)( void epub3_write_output_files(W,M)( W epub_write, M doc_matters, -) { +) { // @trusted debug(asserts) { static assert(is(typeof(epub_write.doc_epub3) == string[][string])); static assert(is(typeof(epub_write.mimetypes) == string)); diff --git a/org/out_xmls_css.org b/org/out_xmls_css.org index 104dc34..d827e30 100644 --- a/org/out_xmls_css.org +++ b/org/out_xmls_css.org @@ -28,7 +28,7 @@ module doc_reform.io_out.xmls_css; template spineCss() { import std.format; - auto spineCss(M)(M doc_matters) { + auto spineCss(M)(M doc_matters) @safe { <> <> string _css_light_html_seg = format(q"┃ @@ -79,7 +79,7 @@ template spineCss() { _css_indent, _color_ocn_dark, ); - auto css_() { + auto css_() @safe { struct _CSS { string html_seg = "/* spine css html seg stylesheet */\n"; string html_scroll = "/* spine css html scroll stylesheet */\n"; diff --git a/org/spine.org b/org/spine.org index 848dfcd..256311d 100644 --- a/org/spine.org +++ b/org/spine.org @@ -28,7 +28,7 @@ struct Version { int minor; int patch; } -enum _ver = Version(0, 9, 1); +enum _ver = Version(0, 9, 2); #+END_SRC ** compilation restrictions (supported compilers) @@ -60,7 +60,7 @@ version (Posix) { - process file - output -** 0. spine src/spine :template: +** 0. spine src/spine :template: - process files (act according to requirements of each type) - by sourcefilename @@ -458,16 +458,16 @@ if (helpInfo.helpWanted) { #+BEGIN_SRC d enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff } struct OptActions { - bool assertions() { + bool assertions() @trusted { return opts["assertions"]; } - bool concordance() { + bool concordance() @trusted { return opts["concordance"]; } auto config_path_set() { return settings["config"]; } - bool css_theme_default() { + bool css_theme_default() @trusted { bool _is_light; if (opts["light"] || opts["theme-light"]) { _is_light = true; @@ -478,94 +478,94 @@ struct OptActions { } return _is_light; } - bool debug_do() { + bool debug_do() @trusted { return opts["debug"]; } - bool digest() { + bool digest() @trusted { return opts["digest"]; } - bool epub() { + bool epub() @trusted { return opts["epub"]; } - bool harvest_link() { + bool harvest_link() @trusted { return (opts["harvest-link"]) ? true : false; } - bool harvest() { + bool harvest() @trusted { return (opts["harvest"] || opts["harvest-authors"] || opts["harvest-topics"]) ? true : false; } - bool harvest_authors() { + bool harvest_authors() @trusted { return (opts["harvest"] || opts["harvest-authors"]) ? true : false; } - bool harvest_topics() { + bool harvest_topics() @trusted { return (opts["harvest"] || opts["harvest-topics"]) ? true : false; } - bool html() { + bool html() @trusted { return (opts["html"] || opts["html-seg"] || opts["html-scroll"]) ? true : false; } - bool html_seg() { + bool html_seg() @trusted { return (opts["html"] || opts["html-seg"]) ? true : false; } - bool html_scroll() { + bool html_scroll() @trusted { return (opts["html"] || opts["html-scroll"]) ? true : false; } - bool html_stuff() { + bool html_stuff() @trusted { return (opts["html"] || opts["html-scroll"] || opts["html-seg"]) ? true : false; } - bool latex() { + bool latex() @trusted { return (opts["latex"] || opts["pdf"]) ? true : false; } - bool odt() { + bool odt() @trusted { return (opts["odf"] || opts["odt"]) ? true : false; } - bool manifest() { + bool manifest() @trusted { return opts["manifest"]; } - bool ocn_hidden() { + bool ocn_hidden() @trusted { return opts["hide-ocn"]; } - bool ocn_off() { + bool ocn_off() @trusted { return opts["ocn-off"]; } - bool quiet() { + bool quiet() @trusted { return opts["quiet"]; } - bool pod() { + bool pod() @trusted { return opts["pod"]; } - bool show_summary() { + bool show_summary() @trusted { return opts["show-summary"]; } - bool show_make() { + bool show_make() @trusted { return opts["show-make"]; } - bool show_metadata() { + bool show_metadata() @trusted { return opts["show-metadata"]; } - bool show_config() { + bool show_config() @trusted { return opts["show-config"]; } - bool source() { + bool source() @trusted { return opts["source"]; } - bool source_or_pod() { + bool source_or_pod() @trusted { return (opts["pod"] || opts["source"]) ? true : false; } - bool sqlite_discrete() { + bool sqlite_discrete() @trusted { return opts["sqlite-discrete"]; } - bool sqlite_db_drop() { + bool sqlite_db_drop() @trusted { return (opts["sqlite-db-recreate"] || opts["sqlite-db-drop"]) ? true : false; } - bool sqlite_db_create() { + bool sqlite_db_create() @trusted { return (opts["sqlite-db-recreate"] || opts["sqlite-db-create"]) ? true : false; } - bool sqlite_delete() { + bool sqlite_delete() @trusted { return opts["sqlite-delete"]; } - bool sqlite_update() { + bool sqlite_update() @trusted { return (opts["sqlite-update"] || opts["sqlite-insert"]) ? true : false; } - bool sqlite_shared_db_action() { + bool sqlite_shared_db_action() @trusted { return ( opts["sqlite-db-recreate"] || opts["sqlite-db-create"] @@ -574,46 +574,46 @@ struct OptActions { || opts["sqlite-update"] ) ? true : false; } - bool text() { + bool text() @trusted { return opts["text"]; } - bool verbose() { + bool verbose() @trusted { return (opts["verbose"] || opts["very-verbose"]) ? true : false; } - bool very_verbose() { + bool very_verbose() @trusted { return opts["very-verbose"]; } - bool xhtml() { + bool xhtml() @trusted { return opts["xhtml"]; } - bool section_toc() { + bool section_toc() @trusted { return opts["section_toc"]; } - bool section_body() { + bool section_body() @trusted { return opts["section_body"]; } - bool section_endnotes() { + bool section_endnotes() @trusted { return opts["section_endnotes"]; } - bool section_glossary() { + bool section_glossary() @trusted { return opts["section_glossary"]; } - bool section_biblio() { + bool section_biblio() @trusted { return opts["section_biblio"]; } - bool section_bookindex() { + bool section_bookindex() @trusted { return opts["section_bookindex"]; } - bool section_blurb() { + bool section_blurb() @trusted { return opts["section_blurb"]; } - bool backmatter() { + bool backmatter() @trusted { return opts["backmatter"]; } - bool skip_output() { + bool skip_output() @trusted { return opts["skip-output"]; } - bool workon() { + bool workon() @trusted { return opts["workon"]; } auto languages_set() { @@ -625,7 +625,7 @@ struct OptActions { auto sqlite_filename() { return settings["sqlite-filename"]; } - bool parallelise() { + bool parallelise() @trusted { bool _is; if (opts["parallel"] == true) { _is = true; @@ -649,7 +649,7 @@ struct OptActions { } else { _is = false; } return _is; } - bool parallelise_subprocesses() { + bool parallelise_subprocesses() @trusted { return opts["parallel-subprocesses"]; } auto output_task_scheduler() { @@ -680,7 +680,7 @@ struct OptActions { } return schedule.sort().uniq; } - bool abstraction() { + bool abstraction() @trusted { return ( opts["abstraction"] || concordance @@ -696,7 +696,7 @@ struct OptActions { || sqlite_update ) ? true : false; } - bool meta_processing_general() { + bool meta_processing_general() @trusted { return ( opts["abstraction"] || html @@ -707,7 +707,7 @@ struct OptActions { || sqlite_update ) ? true :false; } - bool meta_processing_xml_dom() { + bool meta_processing_xml_dom() @trusted { return ( opts["abstraction"] || html @@ -1354,7 +1354,7 @@ struct DocumentMatters { string ver() { return program_info.ver; } - string name_and_version() { + string name_and_version() @trusted { return format( "%s-%s", name, -- cgit v1.2.3