From 5bd8cbc86ab1236d4e891e0711e9a3623f0c51a7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Apr 2022 18:06:45 -0400 Subject: generated-by header, latex, html, epub - consider, implementation quite messy --- src/doc_reform/io_out/latex.d | 62 ++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'src/doc_reform/io_out/latex.d') 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, -- cgit v1.2.3