diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-12-17 13:22:51 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2020-01-13 16:06:43 -0500 |
commit | 9c42b4567f35aceacce1298a6d4789d6789e5bfe (patch) | |
tree | 90d698066a2f895a152bb942ecdeed5faeff50af /src/doc_reform/io_out | |
parent | present per document metadata (diff) |
specify Tuple content for read in files, remove traits.std
Diffstat (limited to 'src/doc_reform/io_out')
-rw-r--r-- | src/doc_reform/io_out/latex.d | 32 | ||||
-rw-r--r-- | src/doc_reform/io_out/odt.d | 18 | ||||
-rw-r--r-- | src/doc_reform/io_out/package.d | 1 | ||||
-rw-r--r-- | src/doc_reform/io_out/sqlite.d | 10 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls.d | 66 |
5 files changed, 62 insertions, 65 deletions
diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index a97a697..ceab202 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -569,24 +569,24 @@ auto tablarize(O)( string _tablenote; foreach(row_idx, row; _table_rows) { _table_cols = row.split(rgx.table_delimiter_col); - _table ~= ""; - foreach(col_idx, cell; _table_cols) { - if ((_table_cols.length == 1) - && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx) - _tablenote ~= cell; - } else { - // // _table ~= "\\bfseries "; - // _table ~= cell; - // _table ~= (_table_cols.length > (col_idx + 1)) ? "&" : ""; - _table ~= format(q"┃%s%s┃", - cell, - (_table_cols.length > (col_idx + 1)) ? "&" : "" - ); - } + _table ~= ""; + foreach(col_idx, cell; _table_cols) { + if ((_table_cols.length == 1) + && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx) + _tablenote ~= cell; + } else { + // // _table ~= "\\bfseries "; + // _table ~= cell; + // _table ~= (_table_cols.length > (col_idx + 1)) ? "&" : ""; + _table ~= format(q"┃%s%s┃", + cell, + (_table_cols.length > (col_idx + 1)) ? "&" : "" + ); } - _table ~= "\\\\"; } - auto t = tuple( + _table ~= "\\\\"; + } + Tuple!(string, string) t = tuple( _table, _tablenote, ); diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d index 6e792a5..1a553d1 100644 --- a/src/doc_reform/io_out/odt.d +++ b/src/doc_reform/io_out/odt.d @@ -243,13 +243,13 @@ template formatODT() { .replaceAll(rgx.inline_strike, "<del>$1</del>") .replaceAll(rgx.inline_insert, "<ins>$1</ins>") .replaceAll(rgx.inline_cite, "<cite>$1</cite>") - .replaceAll(rgx.inline_emphasis, format(q"┃<text:span text:style-name="Span_bold">%s</text:span>┃","$1")) - .replaceAll(rgx.inline_bold, format(q"┃<text:span text:style-name="Span_bold">%s</text:span>┃","$1")) - .replaceAll(rgx.inline_italics, format(q"┃<text:span text:style-name="Span_italic">%s</text:span>┃","$1")) - .replaceAll(rgx.inline_underscore, format(q"┃<text:span text:style-name="Span_underscore">%s</text:span>┃","$1")) + .replaceAll(rgx.inline_emphasis, format(q"┃<text:span text:style-name="Span_bold">%s</text:span>┃", "$1")) + .replaceAll(rgx.inline_bold, format(q"┃<text:span text:style-name="Span_bold">%s</text:span>┃", "$1")) + .replaceAll(rgx.inline_italics, format(q"┃<text:span text:style-name="Span_italic">%s</text:span>┃", "$1")) + .replaceAll(rgx.inline_underscore, format(q"┃<text:span text:style-name="Span_underscore">%s</text:span>┃", "$1")) .replaceAll(rgx.inline_superscript, format(q"┃<text:span text:style-name="Span_superscript">%s</text:span>┃","$1")) - .replaceAll(rgx.inline_subscript, format(q"┃<text:span text:style-name="Span_subscript">%s</text:span>┃","$1")) - .replaceAll(rgx.inline_mono, format(q"┃<text:span text:style-name="Span_monospace">%s</text:span>┃","$1")); + .replaceAll(rgx.inline_subscript, format(q"┃<text:span text:style-name="Span_subscript">%s</text:span>┃", "$1")) + .replaceAll(rgx.inline_mono, format(q"┃<text:span text:style-name="Span_monospace">%s</text:span>┃", "$1")); return _txt; } auto _obj_num(O)(O obj) @safe { // NOT USED YET @@ -519,7 +519,7 @@ template formatODT() { _o_txt_odt = _block; return _o_txt_odt; } - auto tablarize(O)( + Tuple!(string, string) tablarize(O)( const O obj, string _txt, ) @safe { @@ -547,7 +547,7 @@ template formatODT() { } _table ~= "</table:table-row>"; } - auto t = tuple( + Tuple!(string, string) t = tuple( _table, _tablenote, ); @@ -563,7 +563,7 @@ template formatODT() { assert(obj.metainfo.is_of_type == "block"); assert(obj.metainfo.is_a == "table"); string _o_txt_odt = markup(obj); - auto t = tablarize(obj, _o_txt_odt); + Tuple!(string, string) t = tablarize(obj, _o_txt_odt); string _note = t[1]; _o_txt_odt = format(q"┃ <table:table table:name="Table%s" table:style-name="Table1"> diff --git a/src/doc_reform/io_out/package.d b/src/doc_reform/io_out/package.d index 1f11046..6bc66ea 100644 --- a/src/doc_reform/io_out/package.d +++ b/src/doc_reform/io_out/package.d @@ -10,7 +10,6 @@ public import std.regex, std.stdio, std.string, - std.traits, std.typecons, // std.uni, std.utf; diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d index 0995fe1..c779e00 100644 --- a/src/doc_reform/io_out/sqlite.d +++ b/src/doc_reform/io_out/sqlite.d @@ -406,7 +406,7 @@ template SQLiteFormatAndLoadObject() { } return _txt; } - auto inline_notes_seg(M,O)( + Tuple!(string, string) inline_notes_seg(M,O)( M doc_matters, const O obj, string _txt, @@ -439,7 +439,7 @@ template SQLiteFormatAndLoadObject() { writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text); } } - auto t = tuple( + Tuple!(string, string) t = tuple( _txt, _endnotes, ); @@ -582,7 +582,7 @@ template SQLiteFormatAndLoadObject() { assert(obj.metainfo.is_of_section == "body"); assert(obj.metainfo.is_of_type == "block"); assert(obj.metainfo.is_a == "table"); - auto _tablarize(O)( + Tuple!(string, string) _tablarize(O)( const O obj, string _txt, ) { @@ -617,14 +617,14 @@ template SQLiteFormatAndLoadObject() { } _table ~= "</tr>"; } - auto t = tuple( + Tuple!(string, string) t = tuple( _table, _tablenote, ); return t; } string _txt = munge_html(doc_matters, obj); - auto t = _tablarize(obj, _txt); + Tuple!(string, string) t = _tablarize(obj, _txt); _txt = t[0]; string _note = t[1]; string o = format(q"┃<p class="%s"> diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 4cb7507..739c379 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -176,9 +176,7 @@ template outputXHTMLs() { _db, ); } else { - _form = format(q"┃%s┃", - "", - ); + _form = format(q"┃%s┃", ""); } o = format(q"┃<div class="flex-menu-option">%s </div>┃", @@ -467,7 +465,7 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_seg(O,M)( + Tuple!(string, string[]) inline_notes_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -525,7 +523,7 @@ template outputXHTMLs() { writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text); } } - auto t = tuple( + Tuple!(string, string[]) t = tuple( _txt, _endnotes, ); @@ -754,7 +752,7 @@ template outputXHTMLs() { string o = heading(_txt, obj, doc_matters); return o; } - auto heading_seg(O,M)( + Tuple!(string, string[]) heading_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -765,7 +763,7 @@ template outputXHTMLs() { _txt = t[0]; string[] _endnotes = t[1]; string o = heading(_txt, obj, doc_matters, _xml_type); - auto u = tuple( + Tuple!(string, string[]) u = tuple( o, _endnotes, ); @@ -830,7 +828,7 @@ template outputXHTMLs() { string o = para(_txt, obj, doc_matters); return o; } - auto para_seg(O,M)( + Tuple!(string, string[]) para_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -841,7 +839,7 @@ template outputXHTMLs() { _txt = t[0].to!string; string[] _endnotes = t[1]; string o = para(_txt, obj, doc_matters); - auto u = tuple( + Tuple!(string, string[]) u = tuple( o, _endnotes, ); @@ -893,7 +891,7 @@ template outputXHTMLs() { string o = quote(_txt, obj, doc_matters); return o; } - auto quote_seg(O,M)( + Tuple!(string, string[]) quote_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -904,7 +902,7 @@ template outputXHTMLs() { _txt = t[0].to!string; string[] _endnotes = t[1]; string o = quote(_txt, obj, doc_matters); - auto u = tuple( + Tuple!(string, string[]) u = tuple( o, _endnotes, ); @@ -957,7 +955,7 @@ template outputXHTMLs() { string o = group(_txt, obj, doc_matters); return o; } - auto group_seg(O,M)( + Tuple!(string, string[]) group_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -968,7 +966,7 @@ template outputXHTMLs() { _txt = t[0].to!string; string[] _endnotes = t[1]; string o = group(_txt, obj, doc_matters); - auto u = tuple( + Tuple!(string, string[]) u = tuple( o, _endnotes, ); @@ -1017,7 +1015,7 @@ template outputXHTMLs() { string o = block(_txt, obj, doc_matters); return o; } - auto block_seg(O,M)( + Tuple!(string, string[]) block_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -1028,7 +1026,7 @@ template outputXHTMLs() { _txt = t[0].to!string; string[] _endnotes = t[1]; string o = block(_txt, obj, doc_matters); - auto u = tuple( + Tuple!(string, string[]) u = tuple( o, _endnotes, ); @@ -1077,7 +1075,7 @@ template outputXHTMLs() { string o = verse(_txt, obj, doc_matters); return o; } - auto verse_seg(O,M)( + Tuple!(string, string[]) verse_seg(O,M)( string _txt, const O obj, M doc_matters, @@ -1088,13 +1086,13 @@ template outputXHTMLs() { _txt = t[0].to!string; string[] _endnotes = t[1]; string o = verse(_txt, obj, doc_matters); - auto u = tuple( + Tuple!(string, string[]) u = tuple( o, _endnotes, ); return u; } - auto tablarize(O)( + Tuple!(string, string) tablarize(O)( string _txt, const O obj, ) @safe { @@ -1104,24 +1102,24 @@ template outputXHTMLs() { string _tablenote; foreach(row_idx, row; _table_rows) { _table_cols = row.split(rgx.table_delimiter_col); - _table ~= "<tr>"; - foreach(col_idx, cell; _table_cols) { - if ((_table_cols.length == 1) - && (_table_rows.length <= row_idx+2)) { - _tablenote ~= cell; - } else { - string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td"; - string _align = ("style=\"text-align:" - ~ ((obj.table.column_aligns[col_idx] == "l") - ? "left\"" : "right\"")); - _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table.column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">"; - _table ~= cell; - _table ~= "</" ~ _col_is ~ ">"; - } + _table ~= "<tr>"; + foreach(col_idx, cell; _table_cols) { + if ((_table_cols.length == 1) + && (_table_rows.length <= row_idx+2)) { + _tablenote ~= cell; + } else { + string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td"; + string _align = ("style=\"text-align:" + ~ ((obj.table.column_aligns[col_idx] == "l") + ? "left\"" : "right\"")); + _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table.column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">"; + _table ~= cell; + _table ~= "</" ~ _col_is ~ ">"; } - _table ~= "</tr>"; } - auto t = tuple( + _table ~= "</tr>"; + } + Tuple!(string, string) t = tuple( _table, _tablenote, ); |