diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2022-04-03 18:06:45 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2022-04-04 11:57:11 -0400 |
commit | 5bd8cbc86ab1236d4e891e0711e9a3623f0c51a7 (patch) | |
tree | 9dd42fb198d50d4cd6fa1582c965c2536f69efeb | |
parent | latex doc headers moved to .sty files in ./sty dir (diff) |
generated-by header, latex, html, epub
- consider, implementation quite messy
-rw-r--r-- | org/out_latex.org | 62 | ||||
-rw-r--r-- | org/out_xmls.org | 2 | ||||
-rw-r--r-- | org/output_hub.org | 21 | ||||
-rw-r--r-- | org/spine.org | 33 | ||||
-rw-r--r-- | src/doc_reform/io_out/hub.d | 21 | ||||
-rw-r--r-- | src/doc_reform/io_out/latex.d | 62 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls.d | 2 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc.d | 12 | ||||
-rwxr-xr-x | src/doc_reform/spine.d | 21 |
9 files changed, 170 insertions, 66 deletions
diff --git a/org/out_latex.org b/org/out_latex.org index 9b52a26..1999248 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -145,7 +145,11 @@ template outputLaTeXstyInit() { #+BEGIN_SRC d template outputLaTeXstyStatic() { <<Initialize_output_style>> - string outputLaTeXstyStatic() { + string outputLaTeXstyStatic( + bool generated_by, + string name_version_and_compiler, + string time_output_generated, + ) { <<FmtTxt_output_style_static_set>> return latex_sty; } @@ -158,7 +162,12 @@ template outputLaTeXstyStatic() { #+BEGIN_SRC d template outputLaTeXstyPaperSizeAndOrientation() { <<Initialize_output_style>> - auto outputLaTeXstyPaperSizeAndOrientation(P)(P doc_sty_info) { + auto outputLaTeXstyPaperSizeAndOrientation(P)( + P doc_sty_info, + bool generated_by, + string name_version_and_compiler, + string time_output_generated, + ) { <<FmtTxt_output_style_paper_dimensions_set>> return latex_sty; } @@ -273,38 +282,43 @@ void writeOutputLaTeXstyStatic( #+NAME: Function_output_stylesheets_get_each_written #+BEGIN_SRC d -void outputLaTeXstyInit()(string output_dir,) { - string latex_sty = outputLaTeXstyStatic!(); +void outputLaTeXstyInit()( + string output_dir, + bool generated_by, + string name_version_and_compiler, + string time_output_generated, +) { + string latex_sty = outputLaTeXstyStatic!()(generated_by, name_version_and_compiler, time_output_generated); latex_sty.writeOutputLaTeXstyStatic(output_dir, "spineShared.sty"); auto sty_a4p = paper.a4.portrait; - auto latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4p); + auto latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a4p.stylesheet ~ ".sty"); auto sty_a4l = paper.a4.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a4l.stylesheet ~ ".sty"); auto sty_b4p = paper.b4.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4p); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_b4p.stylesheet ~ ".sty"); auto sty_b4l = paper.b4.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_b4l.stylesheet ~ ".sty"); auto sty_a5p = paper.a5.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5p); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a5p.stylesheet ~ ".sty"); auto sty_a5l = paper.a5.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a5l.stylesheet ~ ".sty"); auto sty_letter_p = paper.letter.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_p); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_letter_p.stylesheet ~ ".sty"); auto sty_letter_l = paper.letter.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_letter_l.stylesheet ~ ".sty"); auto sty_legal_p = paper.legal.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_p); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_legal_p.stylesheet ~ ".sty"); auto sty_legal_l = paper.legal.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_legal_l.stylesheet ~ ".sty"); } #+END_SRC @@ -313,7 +327,8 @@ void outputLaTeXstyInit()(string output_dir,) { #+NAME: FmtTxt_output_style_paper_dimensions_set #+BEGIN_SRC d - string latex_sty = format(q"┃%% - called by .tex document to set paper dimensions (size and orientation) + string latex_sty = format(q"┃%%%% spine LaTeX output%s%s +%% - called by .tex document to set paper dimensions (size and orientation) %% - calls spineShared.sty used/shared by all spine documents \ProvidesPackage{./sty/%s} \usepackage{geometry} @@ -326,6 +341,8 @@ void outputLaTeXstyInit()(string output_dir,) { bottom=%s, } \usepackage{./sty/spineShared}┃", + generated_by ? " " ~ name_version_and_compiler : "", + generated_by ? " (generated " ~ time_output_generated ~ ")" : "", doc_sty_info.stylesheet, doc_sty_info.papersize, doc_sty_info.orient, @@ -362,7 +379,8 @@ fonts to try: #+NAME: FmtTxt_output_style_static_set #+BEGIN_SRC latex - string latex_sty = format(q"┃%% - called by the .sty containing the paper dimensions (size and orientation) to be used + string latex_sty = format(q"┃%%%% spine LaTeX output%s%s +%% - called by the .sty containing the paper dimensions (size and orientation) to be used %% - spineShared.sty used by all spine documents (called indirectly) \ProvidesPackage{./sty/spineShared} \usepackage{multicol} @@ -588,7 +606,10 @@ fonts to try: %% \widowpenalty=300 %% \usepackage{atbegshi} %% http://ctan.org/pkg/atbegshi %% (BUG tmp FIX deal with problem, remove first page which is blank) %% \AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}} %% (BUG tmp FIX deal with problem, remove first page which is blank) -┃"); +┃", + generated_by ? " " ~ name_version_and_compiler : "", + generated_by ? " (generated " ~ time_output_generated ~ ")" : "", +); #+END_SRC * stuff @@ -2026,7 +2047,7 @@ if ( #+NAME: FmtTxtOpen_head_format_tex_set_start_latex_head #+BEGIN_SRC d -string _latex_head = format(q"┃%%%% spine LaTeX output%s%s%s +string _latex_head = format(q"┃%%%% spine LaTeX output%s%s #+END_SRC ***** description comment @@ -2067,9 +2088,8 @@ string _latex_head = format(q"┃%%%% spine LaTeX output%s%s%s #+NAME: FmtTxtClose_head_a_format_string_variables #+BEGIN_SRC d ┃", - doc_matters.opt.action.generated_by ? " " ~ doc_matters.generator_program.name_and_version.strip : "", - doc_matters.opt.action.generated_by ? " (" ~ doc_matters.generator_program.compiler.strip ~ ")" : "", - doc_matters.opt.action.generated_by ? " (LaTeX output last Generated on: " ~ doc_matters.generator_program.stime.strip ~ ")" : "", + doc_matters.opt.action.generated_by ? " " ~ doc_matters.generator_program.name_version_and_compiler : "", + doc_matters.opt.action.generated_by ? " (generated " ~ doc_matters.generator_program.time_output_generated ~ ")" : "", doc_matters.generator_program.project_name.strip, doc_matters.generator_program.url_home.strip, paper_size_orientation_latex.strip, diff --git a/org/out_xmls.org b/org/out_xmls.org index 54a2174..dc5f045 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -318,7 +318,7 @@ import special_characters_text(doc_matters.conf_make_meta.meta.date_modified), doc_matters.src.language, special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - doc_matters.opt.action.debug_do_xmls ? "" : special_characters_text(doc_matters.generator_program.name_and_version), + doc_matters.opt.action.generated_by ? special_characters_text(doc_matters.generator_program.name_and_version) : "", special_characters_text(doc_matters.generator_program.url_home), ); return o; diff --git a/org/output_hub.org b/org/output_hub.org index 11022cb..01263e7 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -72,16 +72,24 @@ template outputHubInitialize() { import doc_reform.io_out, doc_reform.io_out.metadata, doc_reform.io_out.paths_output; - @system void outputHubInitialize(O)(O opt_action) { + @system void outputHubInitialize(O,I)( + O opt_action, + I program_info + ) { if ( opt_action.latex_document_header_sty || ( opt_action.latex && opt_action.output_dir_set.length > 0 && !(isValidPath(opt_action.output_dir_set ~ "/latex/sty"))) - ) { // .sty need to be produced only once (if unchanged per output-dir of which there usually will be one) + ) { // .sty need to be produced only once (if unchanged per output-dir of which there usually will be only one) import doc_reform.io_out.latex; - outputLaTeXstyInit!()(opt_action.output_dir_set); + outputLaTeXstyInit!()( + opt_action.output_dir_set, + opt_action.generated_by, + program_info.name_version_and_compiler, + program_info.time_output_generated, + ); } writeln(opt_action.latex); } @@ -210,7 +218,12 @@ if (sched == outTask.latex) { if ((isValidPath(doc_matters.output_path ~ "/latex/sty")) && (!(exists(doc_matters.output_path ~ "/latex/sty"))) ) { - outputLaTeXstyInit!()(doc_matters.output_path); + outputLaTeXstyInit!()( + doc_matters.output_path, + doc_matters.opt.action.generated_by, + doc_matters.generator_program.name_version_and_compiler, + doc_matters.generator_program.time_output_generated, + ); } outputLaTeX!()(doc_abstraction, doc_matters); msg.vv("latex done"); diff --git a/org/spine.org b/org/spine.org index 94ab675..8604507 100644 --- a/org/spine.org +++ b/org/spine.org @@ -1009,6 +1009,25 @@ OptActions _opt_action = OptActions(); bits, os, ); } + @trusted string name_and_version() { + return format("%s-%s", name, ver); + } + @trusted string name_version_and_compiler() { + return format("%s-%s (%s)", name, ver, compiler); + } + @safe auto time_output_generated() { + auto _st = Clock.currTime(UTC()); + auto _t = TimeOfDay(_st.hour, _st.minute, _st.second); + auto _time = _st.year.to!string + ~ "-" ~ _st.month.to!int.to!string // prefer as month number + ~ "-" ~ _st.day.to!string + ~ " [" ~ _st.isoWeek.to!string ~ "/" ~ _st.dayOfWeek.to!int.to!string ~ "]" + ~ " - " ~ _t.toISOExtString + // ~ " " ~ _st.hour.to!string ~ ":" ~ _st.minute.to!string ~ ":" ~ _st.second.to!string + ~ " UTC"; + return _time; + // return _st.toISOExtString(); + } } return ProgramInfo(); } @@ -1408,7 +1427,7 @@ if (doc_matters.opt.action.debug_do) { #+BEGIN_SRC d /+ ↓ output hub +/ if (!(_opt_action.skip_output)) { - outputHubInitialize!()(_opt_action); + outputHubInitialize!()(_opt_action, program_info); } #+END_SRC @@ -1661,10 +1680,10 @@ struct DocumentMatters { return program_info.ver; } @trusted string name_and_version() { - return format("%s-%s", - name, - ver, - ); + return program_info.name_and_version; + } + @trusted string name_version_and_compiler() { + return program_info.name_version_and_compiler; } @safe string url_home() { return "https://sisudoc.org"; @@ -1675,8 +1694,8 @@ struct DocumentMatters { @safe auto compiler() { return program_info.compiler; } - @safe auto stime() { - return Clock.currTime(UTC()).toSimpleString(); + @safe auto time_output_generated() { + return program_info.time_output_generated; } } return Prog_(); diff --git a/src/doc_reform/io_out/hub.d b/src/doc_reform/io_out/hub.d index d0f5d3c..4c5254b 100644 --- a/src/doc_reform/io_out/hub.d +++ b/src/doc_reform/io_out/hub.d @@ -119,7 +119,12 @@ template outputHub() { if ((isValidPath(doc_matters.output_path ~ "/latex/sty")) && (!(exists(doc_matters.output_path ~ "/latex/sty"))) ) { - outputLaTeXstyInit!()(doc_matters.output_path); + outputLaTeXstyInit!()( + doc_matters.output_path, + doc_matters.opt.action.generated_by, + doc_matters.generator_program.name_version_and_compiler, + doc_matters.generator_program.time_output_generated, + ); } outputLaTeX!()(doc_abstraction, doc_matters); msg.vv("latex done"); @@ -167,16 +172,24 @@ template outputHubInitialize() { import doc_reform.io_out, doc_reform.io_out.metadata, doc_reform.io_out.paths_output; - @system void outputHubInitialize(O)(O opt_action) { + @system void outputHubInitialize(O,I)( + O opt_action, + I program_info + ) { if ( opt_action.latex_document_header_sty || ( opt_action.latex && opt_action.output_dir_set.length > 0 && !(isValidPath(opt_action.output_dir_set ~ "/latex/sty"))) - ) { // .sty need to be produced only once (if unchanged per output-dir of which there usually will be one) + ) { // .sty need to be produced only once (if unchanged per output-dir of which there usually will be only one) import doc_reform.io_out.latex; - outputLaTeXstyInit!()(opt_action.output_dir_set); + outputLaTeXstyInit!()( + opt_action.output_dir_set, + opt_action.generated_by, + program_info.name_version_and_compiler, + program_info.time_output_generated, + ); } writeln(opt_action.latex); } diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index f54bb1a..992887d 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -1139,14 +1139,13 @@ template outputLaTeX() { ){ links_mono_or_color_set = links.mono.strip; } - string _latex_head = format(q"┃%%%% spine LaTeX output%s%s%s + string _latex_head = format(q"┃%%%% spine LaTeX output%s%s %%%% %s %s %s %s ┃", - doc_matters.opt.action.generated_by ? " " ~ doc_matters.generator_program.name_and_version.strip : "", - doc_matters.opt.action.generated_by ? " (" ~ doc_matters.generator_program.compiler.strip ~ ")" : "", - doc_matters.opt.action.generated_by ? " (LaTeX output last Generated on: " ~ doc_matters.generator_program.stime.strip ~ ")" : "", + doc_matters.opt.action.generated_by ? " " ~ doc_matters.generator_program.name_version_and_compiler : "", + doc_matters.opt.action.generated_by ? " (generated " ~ doc_matters.generator_program.time_output_generated ~ ")" : "", doc_matters.generator_program.project_name.strip, doc_matters.generator_program.url_home.strip, paper_size_orientation_latex.strip, @@ -1405,38 +1404,43 @@ template outputLaTeXstyInit() { } } } - void outputLaTeXstyInit()(string output_dir,) { - string latex_sty = outputLaTeXstyStatic!(); + void outputLaTeXstyInit()( + string output_dir, + bool generated_by, + string name_version_and_compiler, + string time_output_generated, + ) { + string latex_sty = outputLaTeXstyStatic!()(generated_by, name_version_and_compiler, time_output_generated); latex_sty.writeOutputLaTeXstyStatic(output_dir, "spineShared.sty"); auto sty_a4p = paper.a4.portrait; - auto latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4p); + auto latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a4p.stylesheet ~ ".sty"); auto sty_a4l = paper.a4.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a4l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a4l.stylesheet ~ ".sty"); auto sty_b4p = paper.b4.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4p); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_b4p.stylesheet ~ ".sty"); auto sty_b4l = paper.b4.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_b4l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_b4l.stylesheet ~ ".sty"); auto sty_a5p = paper.a5.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5p); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a5p.stylesheet ~ ".sty"); auto sty_a5l = paper.a5.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_a5l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_a5l.stylesheet ~ ".sty"); auto sty_letter_p = paper.letter.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_p); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_letter_p.stylesheet ~ ".sty"); auto sty_letter_l = paper.letter.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_letter_l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_letter_l.stylesheet ~ ".sty"); auto sty_legal_p = paper.legal.portrait; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_p); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_p, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_legal_p.stylesheet ~ ".sty"); auto sty_legal_l = paper.legal.landscape; - latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_l); + latex_papersize_and_orientation = outputLaTeXstyPaperSizeAndOrientation!()(sty_legal_l, generated_by, name_version_and_compiler, time_output_generated); latex_papersize_and_orientation.writeOutputLaTeXstyStatic(output_dir, sty_legal_l.stylesheet ~ ".sty"); } } @@ -1444,8 +1448,13 @@ template outputLaTeXstyStatic() { import std.format, std.conv : to; - string outputLaTeXstyStatic() { - string latex_sty = format(q"┃%% - called by the .sty containing the paper dimensions (size and orientation) to be used + string outputLaTeXstyStatic( + bool generated_by, + string name_version_and_compiler, + string time_output_generated, + ) { + string latex_sty = format(q"┃%%%% spine LaTeX output%s%s +%% - called by the .sty containing the paper dimensions (size and orientation) to be used %% - spineShared.sty used by all spine documents (called indirectly) \ProvidesPackage{./sty/spineShared} \usepackage{multicol} @@ -1671,7 +1680,10 @@ template outputLaTeXstyStatic() { %% \widowpenalty=300 %% \usepackage{atbegshi} %% http://ctan.org/pkg/atbegshi %% (BUG tmp FIX deal with problem, remove first page which is blank) %% \AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}} %% (BUG tmp FIX deal with problem, remove first page which is blank) -┃"); +┃", + generated_by ? " " ~ name_version_and_compiler : "", + generated_by ? " (generated " ~ time_output_generated ~ ")" : "", +); return latex_sty; } } @@ -1679,8 +1691,14 @@ template outputLaTeXstyPaperSizeAndOrientation() { import std.format, std.conv : to; - auto outputLaTeXstyPaperSizeAndOrientation(P)(P doc_sty_info) { - string latex_sty = format(q"┃%% - called by .tex document to set paper dimensions (size and orientation) + auto outputLaTeXstyPaperSizeAndOrientation(P)( + P doc_sty_info, + bool generated_by, + string name_version_and_compiler, + string time_output_generated, + ) { + string latex_sty = format(q"┃%%%% spine LaTeX output%s%s +%% - called by .tex document to set paper dimensions (size and orientation) %% - calls spineShared.sty used/shared by all spine documents \ProvidesPackage{./sty/%s} \usepackage{geometry} @@ -1693,6 +1711,8 @@ template outputLaTeXstyPaperSizeAndOrientation() { bottom=%s, } \usepackage{./sty/spineShared}┃", + generated_by ? " " ~ name_version_and_compiler : "", + generated_by ? " (generated " ~ time_output_generated ~ ")" : "", doc_sty_info.stylesheet, doc_sty_info.papersize, doc_sty_info.orient, diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 534ab94..62d8842 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -222,7 +222,7 @@ template outputXHTMLs() { special_characters_text(doc_matters.conf_make_meta.meta.date_modified), doc_matters.src.language, special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), - doc_matters.opt.action.debug_do_xmls ? "" : special_characters_text(doc_matters.generator_program.name_and_version), + doc_matters.opt.action.generated_by ? special_characters_text(doc_matters.generator_program.name_and_version) : "", special_characters_text(doc_matters.generator_program.url_home), ); return o; diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 194890f..16cc6e7 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -112,10 +112,10 @@ template spineAbstraction() { return program_info.ver; } @trusted string name_and_version() { - return format("%s-%s", - name, - ver, - ); + return program_info.name_and_version; + } + @trusted string name_version_and_compiler() { + return program_info.name_version_and_compiler; } @safe string url_home() { return "https://sisudoc.org"; @@ -126,8 +126,8 @@ template spineAbstraction() { @safe auto compiler() { return program_info.compiler; } - @safe auto stime() { - return Clock.currTime(UTC()).toSimpleString(); + @safe auto time_output_generated() { + return program_info.time_output_generated; } } return Prog_(); diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 563de48..06b483c 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -762,6 +762,25 @@ string program_name = "spine"; bits, os, ); } + @trusted string name_and_version() { + return format("%s-%s", name, ver); + } + @trusted string name_version_and_compiler() { + return format("%s-%s (%s)", name, ver, compiler); + } + @safe auto time_output_generated() { + auto _st = Clock.currTime(UTC()); + auto _t = TimeOfDay(_st.hour, _st.minute, _st.second); + auto _time = _st.year.to!string + ~ "-" ~ _st.month.to!int.to!string // prefer as month number + ~ "-" ~ _st.day.to!string + ~ " [" ~ _st.isoWeek.to!string ~ "/" ~ _st.dayOfWeek.to!int.to!string ~ "]" + ~ " - " ~ _t.toISOExtString + // ~ " " ~ _st.hour.to!string ~ ":" ~ _st.minute.to!string ~ ":" ~ _st.second.to!string + ~ " UTC"; + return _time; + // return _st.toISOExtString(); + } } return ProgramInfo(); } @@ -978,7 +997,7 @@ string program_name = "spine"; && _opt_action.abstraction) { /+ ↓ output hub +/ if (!(_opt_action.skip_output)) { - outputHubInitialize!()(_opt_action); + outputHubInitialize!()(_opt_action, program_info); } if (_opt_action.parallelise) { // see else import std.parallelism; |