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 spineHarvest; mixin InternalMarkup; mixin spineRgxInit; template spineMetaDocHarvestsAuthors() { auto mkup = InlineMarkup(); void spineMetaDocHarvestsAuthors(H,M,O)( H harvests, M _make_and_meta_struct, O _opt_action, ) { string theme_dark_0 = format(q"┃ body { color : #CCCCCC; background : #000000; background-color : #000000; } a:link { color : #FFFFFF; text-decoration : none; } a:visited { color : #999999; text-decoration : none; } a:hover { color : #000000; background-color : #555555; } a:hover img { background-color : #000000; } a:active { color : #888888; text-decoration : underline; } a.lev0:hover { color : #FFFFFF; background-color : #000000; } a.lev1:hover { color : #FFFFFF; background : #333333; } a.lev2:hover { color : #FFFFFF; background : #555555; } a.lev3:hover { color : #FFFFFF; background : #777777; } ┃"); string theme_light_0 = format(q"┃ body { color : #000000; background : #FFFFFF; background-color : #FFFFFF; } a:link { color : #003399; text-decoration : none; } a:visited { color : #003399; text-decoration : none; } a:hover { color : #000000; background-color : #f9f9aa; } a:hover img { background-color : #FFFFFF; } a:active { color : #003399; text-decoration : underline; } a.lev0:hover { color : #000000; background-color : #FFFFFF; } a.lev1:hover { color : #FFFFFF; background : #444444; } a.lev2:hover { background : #888888; } a.lev3:hover { background : #BBBBBB; } ┃"); string theme_dark_1 = format(q"┃ h1 { color : #FFFFFF; background : #000000; } p.letter { color : #FFFFFF; background : #333333; } p.lev0 { color : #FFFFFF; background : #000000; } p.lev1 { color : #FFFFFF; background : #333333; } p.lev2 { background : #555555; } p.lev3 { background : #777777; } p.lev4 { background : #AAAAAA; } p.lev5 { } ┃"); string theme_light_1 = format(q"┃ h1 { color : #FFFFFF; background : #000088; } p.letter { color : #FFFFFF; background : #880000; } p.lev0 { color : #FFFFFF; background : #000000; } p.lev1 { color : #FFFFFF; background : #444444; } p.lev2 { background : #888888; } p.lev3 { background : #BBBBBB; } p.lev4 { background : #EEEEEE; } p.lev5 { } ┃"); string[] authors = []; authors ~= format(q"┃ Metadata Harvest - Authors

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

[ HOME ] [ Metadata Harvest - Topics ]


ABCDEFGHIJKLMNOPQRSTUVWXYZ,  ┃", _opt_action.css_theme_default ? theme_light_0 : theme_dark_0, _opt_action.css_theme_default ? theme_light_1 : theme_dark_1, ) ~ "\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.translate([' ' : "_"]), doc_harvest.author_surname_fn, (doc_harvest.date_published.length > 0) ? doc_harvest.date_published : "", doc_harvest.path_html_segtoc, doc_harvest.title, doc_harvest.path_html_metadata, 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 : "", doc_harvest.path_html_segtoc, doc_harvest.title, doc_harvest.path_html_metadata, doc_harvest.language, ); } _author_date_title ~= format(q"┃%s %s "%s" [ %s ]%s┃", doc_harvest.author_surname_fn, (doc_harvest.date_published.length > 0) ? "(" ~ doc_harvest.date_published ~ ")" : "", doc_harvest.title, doc_harvest.path_html_metadata, doc_harvest.language, (_opt_action.very_verbose) ? "\n " ~ doc_harvest.path_abs_html_scroll : "", ); } 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"; import doc_reform.io_out.paths_output; auto out_pth = spinePathsHTML!()(_make_and_meta_struct.conf.output_path, ""); try { auto f = File(out_pth.harvest("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); } } } }