Added message_comment_width config option

This commit is contained in:
Bartek Kryza
2023-10-16 22:10:44 +02:00
parent 1616f79ceb
commit dd940991dc
5 changed files with 9 additions and 1 deletions

View File

@@ -481,6 +481,7 @@ struct inheritable_diagram_options {
"generate_condition_statements", false};
option<std::vector<std::string>> participants_order{"participants_order"};
option<bool> generate_message_comments{"generate_message_comments", false};
option<unsigned> message_comment_width{"message_comment_width", 25};
option<bool> debug_mode{"debug_mode", false};
option<bool> generate_metadata{"generate_metadata", true};

View File

@@ -202,6 +202,7 @@ types:
generate_return_types: !optional bool
generate_condition_statements: !optional bool
generate_message_comments: !optional bool
message_comment_width: !optional int
participants_order: !optional [string]
start_from: !optional [source_location_t] # deprecated -> 'from'
from: !optional [source_location_t]
@@ -313,6 +314,7 @@ root:
generate_return_types: !optional bool
generate_condition_statements: !optional bool
generate_message_comments: !optional bool
message_comment_width: !optional int
generate_packages: !optional bool
group_methods: !optional bool
package_type: !optional package_type_t

View File

@@ -604,6 +604,7 @@ template <> struct convert<sequence_diagram> {
get_option(node, rhs.participants_order);
get_option(node, rhs.generate_method_arguments);
get_option(node, rhs.generate_message_comments);
get_option(node, rhs.message_comment_width);
// Ensure relative_to has a value
if (!rhs.relative_to.has_value)
@@ -794,6 +795,7 @@ template <> struct convert<config> {
get_option(node, rhs.generate_return_types);
get_option(node, rhs.generate_condition_statements);
get_option(node, rhs.generate_message_comments);
get_option(node, rhs.message_comment_width);
rhs.base_directory.set(node["__parent_path"].as<std::string>());
get_option(node, rhs.relative_to);

View File

@@ -326,6 +326,7 @@ YAML::Emitter &operator<<(
out << c.generate_return_types;
out << c.participants_order;
out << c.generate_message_comments;
out << c.message_comment_width;
}
else if (const auto *pd = dynamic_cast<const package_diagram *>(&c);
pd != nullptr) {

View File

@@ -289,7 +289,9 @@ void generator::generate_message_comment(
ostr << "note over " << generate_alias(from.value()) << '\n';
ostr << util::format_message_comment(m.comment().value()) << '\n';
ostr << util::format_message_comment(
m.comment().value(), config().message_comment_width())
<< '\n';
ostr << "end note" << '\n';
}