aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-04-03 18:06:45 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2022-04-04 11:57:11 -0400
commit5bd8cbc86ab1236d4e891e0711e9a3623f0c51a7 (patch)
tree9dd42fb198d50d4cd6fa1582c965c2536f69efeb /org
parentlatex doc headers moved to .sty files in ./sty dir (diff)
generated-by header, latex, html, epub
- consider, implementation quite messy
Diffstat (limited to 'org')
-rw-r--r--org/out_latex.org62
-rw-r--r--org/out_xmls.org2
-rw-r--r--org/output_hub.org21
-rw-r--r--org/spine.org33
4 files changed, 85 insertions, 33 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_();