diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-11-01 10:06:47 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | 0079c34ce7a524d4b93ed56191b5e7cf6a380975 (patch) | |
tree | af9d3fad63937e1b8d5eefa2bdabbcea2325ce91 /src/sdp/ao_conf_make_meta_sdlang.d | |
parent | sync, fix level :A split info (diff) |
0.8.0 the document parts (& org babel tangle)
Diffstat (limited to 'src/sdp/ao_conf_make_meta_sdlang.d')
-rw-r--r-- | src/sdp/ao_conf_make_meta_sdlang.d | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/sdp/ao_conf_make_meta_sdlang.d b/src/sdp/ao_conf_make_meta_sdlang.d index 3855e7c..a53cbd7 100644 --- a/src/sdp/ao_conf_make_meta_sdlang.d +++ b/src/sdp/ao_conf_make_meta_sdlang.d @@ -211,7 +211,7 @@ template SiSUheaderExtractSDLang() { } private auto headerSDLangGet(in char[] src_header) { char[][] source_header_arr = - split(cast(char[]) src_header, rgx.line_delimiter); + split(cast(char[]) src_header, rgx.newline_eol_delimiter); char[] header_clean; // TODO foreach(header_line; source_header_arr) { @@ -236,6 +236,31 @@ template SiSUheaderExtractSDLang() { private auto headerSDLangToAAmake(Tag header_sdlang, string[string][string] dochead_make) { dochead_make = sdlangToAAmake(dochead_make, header_sdlang); auto dochead_meta = sdlangToAAmake(meta_aa, header_sdlang); + if (dochead_meta["title"]["main"].empty) { + dochead_meta["title"]["main"] = + to!string(header_sdlang.maybe.tags["title"][0].values[0]); // test that this exists + } + if (!(dochead_meta["title"]["subtitle"].empty) + && (dochead_meta["title"]["sub"].empty)) { + dochead_meta["title"]["sub"] ~= dochead_meta["title"]["subtitle"]; + } + dochead_meta["title"].remove("subtitle"); + if (dochead_meta["title"]["sub"].empty) { + dochead_meta["title"]["full"] ~= dochead_meta["title"]["main"]; + } else { + dochead_meta["title"]["full"] ~= format( + "%s - %s", + dochead_meta["title"]["main"], + dochead_meta["title"]["sub"], + ); + } + dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"]; + string[] authors_arr; + auto authors_raw_arr = split(dochead_meta["creator"]["author"], rgx.arr_delimiter); + foreach (author_raw; authors_raw_arr) { + authors_arr ~= replace(author_raw, rgx.raw_author_munge, "$2 $1"); + } + dochead_meta["creator"]["author"] = join(authors_arr, ", ").chomp.chomp; auto t = tuple(dochead_make, dochead_meta); static assert(t.length==2); return t; |