Added 'title' diagram property
This commit is contained in:
@@ -110,6 +110,9 @@ void generator<C, D>::generate(std::ostream &ostr) const
|
||||
nlohmann::json j;
|
||||
j["name"] = generators::generator<C, D>::model().name();
|
||||
j["diagram_type"] = to_string(generators::generator<C, D>::model().type());
|
||||
if (generators::generator<C, D>::config().title) {
|
||||
j["title"] = generators::generator<C, D>::config().title();
|
||||
}
|
||||
|
||||
generate_diagram(j);
|
||||
|
||||
|
||||
@@ -136,6 +136,16 @@ public:
|
||||
*/
|
||||
void generate_metadata(std::ostream &ostr) const;
|
||||
|
||||
/**
|
||||
* @brief Generate diagram title
|
||||
*
|
||||
* Generates a MermaidJS diagram title directive if diagram title
|
||||
* is provided in the diagram configuration.
|
||||
*
|
||||
* @param ostr Output stream
|
||||
*/
|
||||
void generate_title(std::ostream &ostr) const;
|
||||
|
||||
/**
|
||||
* @brief Generate hyper link to element
|
||||
*
|
||||
@@ -238,6 +248,8 @@ void generator<C, D>::generate(std::ostream &ostr) const
|
||||
|
||||
update_context();
|
||||
|
||||
generate_title(ostr);
|
||||
|
||||
generate_diagram_type(ostr);
|
||||
|
||||
generate_mermaid_directives(ostr, config.mermaid().before);
|
||||
@@ -399,6 +411,18 @@ void generator<C, D>::generate_metadata(std::ostream &ostr) const
|
||||
}
|
||||
}
|
||||
|
||||
template <typename C, typename D>
|
||||
void generator<C, D>::generate_title(std::ostream &ostr) const
|
||||
{
|
||||
const auto &config = generators::generator<C, D>::config();
|
||||
|
||||
if (config.title) {
|
||||
ostr << "---\n";
|
||||
ostr << "title: " << config.title() << '\n';
|
||||
ostr << "---\n";
|
||||
}
|
||||
}
|
||||
|
||||
template <typename C, typename D>
|
||||
void generator<C, D>::print_debug(
|
||||
const common::model::source_location &e, std::ostream &ostr) const
|
||||
|
||||
@@ -131,6 +131,16 @@ public:
|
||||
*/
|
||||
void generate_metadata(std::ostream &ostr) const;
|
||||
|
||||
/**
|
||||
* @brief Generate diagram title
|
||||
*
|
||||
* Generates a PlantUML diagram title directive if diagram title
|
||||
* is provided in the diagram configuration.
|
||||
*
|
||||
* @param ostr Output stream
|
||||
*/
|
||||
void generate_title(std::ostream &ostr) const;
|
||||
|
||||
/**
|
||||
* @brief Generate hyper link to element
|
||||
*
|
||||
@@ -241,6 +251,8 @@ void generator<C, D>::generate(std::ostream &ostr) const
|
||||
|
||||
ostr << "@startuml" << '\n';
|
||||
|
||||
generate_title(ostr);
|
||||
|
||||
generate_plantuml_directives(ostr, config.puml().before);
|
||||
|
||||
generate_diagram(ostr);
|
||||
@@ -449,6 +461,16 @@ void generator<C, D>::generate_metadata(std::ostream &ostr) const
|
||||
}
|
||||
}
|
||||
|
||||
template <typename C, typename D>
|
||||
void generator<C, D>::generate_title(std::ostream &ostr) const
|
||||
{
|
||||
const auto &config = generators::generator<C, D>::config();
|
||||
|
||||
if (config.title) {
|
||||
ostr << "title " << config.title() << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
template <typename C, typename D>
|
||||
template <typename E>
|
||||
void generator<C, D>::generate_link(std::ostream &ostr, const E &e) const
|
||||
|
||||
Reference in New Issue
Block a user