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 /src/doc_reform/io_out | |
parent | latex doc headers moved to .sty files in ./sty dir (diff) |
generated-by header, latex, html, epub
- consider, implementation quite messy
Diffstat (limited to 'src/doc_reform/io_out')
-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 |
3 files changed, 59 insertions, 26 deletions
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; |