diff --git a/.clang-uml b/.clang-uml index 96cff715..af55e480 100644 --- a/.clang-uml +++ b/.clang-uml @@ -1,8 +1,8 @@ compilation_database_dir: debug output_directory: docs/diagrams generate_links: - link: "https://github.com/bkryza/clang-uml/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }}" - tooltip: "{{ element.name }}" + link: 'https://github.com/bkryza/clang-uml/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }}' + tooltip: '{% if "comment" in element %}{{ abbrv(trim(replace(element.comment, "\n+", " ")), 256) }}{% else %}{{ element.name }}{% endif %}' diagrams: main_package: include!: uml/main_package_diagram.yml diff --git a/README.md b/README.md index 2dc93fbb..df3c4bef 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ diagrams: - myproject::detail plantuml: after: - - 'note left of @A(MyProjectMain) : Main class of myproject library.' + - 'note left of {{ alias("MyProjectMain") }}: Main class of myproject library.' ``` See ![here](docs/configuration_file.md) for detailed configuration file reference guide. diff --git a/docs/configuration_file.md b/docs/configuration_file.md index 778a8200..ddd9dc82 100644 --- a/docs/configuration_file.md +++ b/docs/configuration_file.md @@ -27,6 +27,21 @@ * `before` - list of directives which will be added before the generated diagram * `after` - list of directives which will be added after the generated diagram +### Template engine +`clang-uml` integrates [inja](https://github.com/pantor/inja) template engine, with several +additional functions which can be used in textual directives within the configuration files, +notes and to generate links and tooltips to diagrams. + +The following, are the `clang-uml` additional template functions: +* `ltrim(string)` - left trims a string +* `rtrim(string)` - right trims a string +* `trim(string)` - trims a string +* `substr(string, offset, length)` - returns a substring of a string from offset of length +* `split(string)` - splits a string and returns a list of strings +* `replace(string, regex, replacement)` - returns a string with replace matches to regex with replacement string +* `abbrv(string, length)` - returns a string truncated to length including trailing ellipsis +* `alias(string)` - returns a PlantUML alias of an C++ entity represented by string name + ## Example complete config