diff options
Diffstat (limited to 'src/doc_reform/meta')
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 28 | ||||
-rw-r--r-- | src/doc_reform/meta/rgx.d | 3 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 65e0754..28ce990 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -4041,6 +4041,7 @@ template docAbstraction() { return ref CMM conf_make_meta, ) { static auto rgx = RgxI(); + static auto mkup = InlineMarkup(); if (auto m = line.match(rgx.headings)) { /+ heading match +/ ++line_occur["heading"]; pith["txt_is"] = eN.txt_is.heading; @@ -4052,11 +4053,32 @@ template docAbstraction() { assertions_doc_structure(an_object, lv); // includes most of the logic for collapsed levels switch (an_object["lev"]) { case "A": // Title set - if (an_object[an_object_key].match(rgx.variable_doc_title) - && an_object[an_object_key].match(rgx.variable_doc_author)) { + if ((an_object[an_object_key].match(rgx.variable_doc_title_author_date)) + || (an_object[an_object_key].match(rgx.variable_doc_title) + && an_object[an_object_key].match(rgx.variable_doc_author) + && an_object[an_object_key].match(rgx.variable_doc_date))) { + an_object[an_object_key] = an_object[an_object_key] + .replaceFirst(rgx.variable_doc_title_author_date, + (conf_make_meta.meta.title_full + ~ mkup.br_nl + ~ conf_make_meta.meta.creator_author + ~ " (" ~ (conf_make_meta.meta.date_published.replaceFirst(regex(r"(?:-00)+"),"")) ~ ")")) + .replaceFirst(rgx.variable_doc_title, + (conf_make_meta.meta.title_full ~ mkup.br_nl)) + .replaceFirst(rgx.variable_doc_author, + conf_make_meta.meta.creator_author) + .replaceFirst(rgx.variable_doc_date, + " (" ~ (conf_make_meta.meta.date_published.replaceFirst(regex(r"(?:-00)+"),"")) ~ ")"); + } else if ((an_object[an_object_key].match(rgx.variable_doc_title_author)) + || (an_object[an_object_key].match(rgx.variable_doc_title) + && an_object[an_object_key].match(rgx.variable_doc_author))) { an_object[an_object_key] = an_object[an_object_key] + .replaceFirst(rgx.variable_doc_title_author_date, + (conf_make_meta.meta.title_full + ~ mkup.br_nl + ~ conf_make_meta.meta.creator_author)) .replaceFirst(rgx.variable_doc_title, - (conf_make_meta.meta.title_full ~ ", ")) + (conf_make_meta.meta.title_full ~ mkup.br_nl)) .replaceFirst(rgx.variable_doc_author, conf_make_meta.meta.creator_author); } else if (an_object[an_object_key].match(rgx.variable_doc_title)) { diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 5df1e9c..0d2912d 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -91,8 +91,11 @@ static template spineRgxIn() { static comment = ctRegex!(`^%+ `); /+ header +/ /+ header +/ + static variable_doc_title_author_date = ctRegex!(`@title-author-date`); + static variable_doc_title_author = ctRegex!(`@title-author`); static variable_doc_title = ctRegex!(`@title`); static variable_doc_author = ctRegex!(`@author|@creator`); + static variable_doc_date = ctRegex!(`@date`); static raw_author_munge = ctRegex!(`(?P<last>\S.+?),\s+(?P<first>.+)`,"i"); static yaml_header_meta_title = ctRegex!(`^\s*title\s*:\s*(?:"?\w|$)`, "m"); static yaml_config = ctRegex!(`^[a-z]+\s*:\s*(?:"?\w|$)`, "m"); |