Refactored inja context evaluation and link rendering

This commit is contained in:
Bartek Kryza
2024-07-28 01:12:08 +02:00
parent dad583d305
commit 37314baa3a
10 changed files with 409 additions and 454 deletions

View File

@@ -30,11 +30,14 @@
void inject_diagram_options(std::shared_ptr<clanguml::config::diagram> diagram)
{
// Inject links config to all test cases
clanguml::config::generate_links_config links_config{
R"(https://github.com/bkryza/clang-uml/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }})",
R"({% if existsIn(element, "comment") and existsIn(element.comment, "brief") %}{{ abbrv(trim(replace(element.comment.brief.0, "\n+", " ")), 256) }}{% else %}{{ element.name }}{% endif %})"};
clanguml::config::generate_links_config links_config;
diagram->generate_links.set(links_config);
links_config.link.emplace(".",
R"(https://github.com/bkryza/clang-uml/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }})");
links_config.tooltip.emplace(".",
R"({% if existsIn(element, "comment") and existsIn(element.comment, "brief") %}{{ abbrv(trim(replace(element.comment.brief.0, "\n+", " ")), 256) }}{% else %}{{ element.name }}{% endif %})");
diagram->generate_links.set(std::move(links_config));
}
std::pair<clanguml::config::config_ptr,
@@ -249,7 +252,8 @@ void try_run_test_case(const diagram_source_storage &diagrams, TC &&tc)
tc(diagrams.get<T>());
}
catch (doctest::TestFailureException &e) {
std::cout << "-----------------------------------------------------"
std::cout << "---------------------------------------------"
"--------"
"--------------------------\n";
std::cout << "Test case failed for diagram type "
<< T::diagram_type_name << ": "