From dcbc43ba94c484c7b5741bc9efc88b51e9b04e31 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 1 Jan 2019 13:28:27 -0500 Subject: doc generator info related --- org/doc_reform.org | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) (limited to 'org') diff --git a/org/doc_reform.org b/org/doc_reform.org index bef16f0..422d25c 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -125,6 +125,7 @@ void main(string[] args) { #+NAME: imports_doc_reform #+BEGIN_SRC d import + std.datetime, std.getopt, std.file, std.path, @@ -594,6 +595,21 @@ auto _opt_action = OptActions(); #+NAME: doc_reform_args #+BEGIN_SRC d +auto program_info() { + struct ProgramInfo { + string name() { + return program_name; + } + auto ver() { + string ver_ = format( + "%s.%s.%s", + _ver.major, _ver.minor, _ver.patch, + ); + return ver_; + } + } + return ProgramInfo(); +} auto _env = [ "pwd" : environment["PWD"], "home" : environment["HOME"], @@ -751,7 +767,7 @@ if ((_opt_action.debug_do) ) { writeln("--->\nstepX commence → (document abstraction)"); } -auto t = DocReformAbstraction!()(_env, _opt_action, manifest); +auto t = DocReformAbstraction!()(_env, program_info, _opt_action, manifest); static assert(!isTypeTuple!(t)); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; @@ -843,8 +859,9 @@ template DocReformAbstraction() { enum makeMeta { make, meta } enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, tag_assoc, images } static auto rgx = Rgx(); - auto DocReformAbstraction(E,O,M)( + auto DocReformAbstraction(E,P,O,M)( E _env, + P program_info, O _opt_action, M _manifest ){ @@ -1011,6 +1028,47 @@ if ((_opt_action.debug_do) struct DocumentMatters { #+END_SRC +**** generator related + +#+NAME: doc_reform_each_file_do_document_matters +#+BEGIN_SRC d + auto generator_program() { + struct Prog_ { + auto name() { + return program_info.name; + } + auto ver() { + return program_info.ver; + } + auto name_and_version() { + return format( + "%s-%s", + program_info.name, + program_info.ver, + ); + } + auto url_home() { + return "http://sisudoc.org"; + } + auto url_git() { + return "https://git.sisudoc.org/software/sisu"; + } + } + return Prog_(); + } + auto generated_time() { + auto _st = Clock.currTime(UTC()); + 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 ~ "]" + ~ " " ~ _st.hour.to!string + ~ ":" ~ _st.minute.to!string + ~ ":" ~ _st.second.to!string; + return _time; + } +#+END_SRC + **** config make & meta #+NAME: doc_reform_each_file_do_document_matters -- cgit v1.2.3