module doc_reform.meta.metadoc_harvests_authors; import std.algorithm, std.array, std.exception, std.regex, std.stdio, std.string, std.conv : to; import doc_reform.meta.defaults, doc_reform.meta.rgx; mixin DocReformHarvest; mixin InternalMarkup; mixin DocReformRgxInit; template DocReformMetaDocHarvestsAuthors() { auto mkup = InlineMarkup(); void DocReformMetaDocHarvestsAuthors(H,O)( H harvests, O _opt_action, ) { string[] authors = []; authors ~= format(q"┃ Metadata Harvest - Authors

Metadata Harvest - Authors (output organised by language & filetype)

[ HOME ] also see Metadata Harvest - Topics


English   


ABCDEFGHIJKLMNOPQRSTUVWXYZ,  ┃") ~ "\n"; string[string] _au; string[] _auth_date_title; string[] _author_date_title; string _prev_auth = ""; char _prev_k = "_".to!char; foreach(doc_harvest; harvests .multiSort!( "toUpper(a.author_surname_fn) < toUpper(b.author_surname_fn)", "a.date_published < b.date_published", "a.title < b.title", SwapStrategy.unstable ) ) { if (doc_harvest.author_surname_fn != _prev_auth) { _au[doc_harvest.author_surname_fn] = format(q"┃

%s

%s "%s" [%s]

┃", doc_harvest.author_surname, doc_harvest.author_surname_fn, (doc_harvest.date_published.length > 0) ? doc_harvest.date_published : "", "url", doc_harvest.title, doc_harvest.language, ); _prev_auth = doc_harvest.author_surname_fn; } else { _au[doc_harvest.author_surname_fn] ~= format(q"┃

%s "%s" [%s]

┃", (doc_harvest.date_published.length > 0) ? doc_harvest.date_published : "", "url", doc_harvest.title, doc_harvest.language, ); } _author_date_title ~= format(q"┃%s %s "%s" [%s]┃", doc_harvest.author_surname_fn, (doc_harvest.date_published.length > 0) ? "(" ~ doc_harvest.date_published ~ ")" : "", doc_harvest.title, doc_harvest.language, ); } foreach (k; _au.keys.sort) { if (k.toUpper.to!(char[])[0] != _prev_k) { authors ~= format(q"┃

%s

┃", k.toUpper.to!(char[])[0], k.toUpper.to!(char[])[0], ); _prev_k = k.toUpper.to!(char[])[0]; } authors ~= _au[k]; } authors ~= format(q"┃
┃") ~ "\n"; try { auto f = File("authors.html", "w"); foreach (o; authors) { f.writeln(o); } } catch (ErrnoException ex) { // Handle error } if (_opt_action.verbose || _opt_action.very_verbose ) { foreach(_adt; _author_date_title.sort) { writeln(_adt); } } } }