Updated docs (#349)

This commit is contained in:
Bartek Kryza 2024-12-22 18:19:29 +01:00
parent e5e11431fa
commit dde961d9f4
No known key found for this signature in database
GPG Key ID: 241B25F44E85B4D7
2 changed files with 34 additions and 0 deletions

View File

@ -19,6 +19,7 @@
* `add_compile_flags` - add compile flags to all compilation database entries
* `remove_compile_flags` - remove compile flags from all compilation database entries
* `query_driver` - name or path to compiler driver, which should be queried for system include paths (e.g. arm-none-eabi-g++)
* `user_data` - arbitrary data that can be used in Jinja templates
### Diagram options
* `type` - type of diagram, one of [`class`, `sequence`, `package`, `include`]
@ -85,6 +86,12 @@ generate_links:
link: "https://github.com/bkryza/clang-uml/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }}"
# Tooltip pattern
tooltip: "{{ element.name }}"
# Custom user data that can be used in Jinja templates
user_data:
copyright:
name: Bartek Kryza
license:
type: CC-0
# The map of diagrams - keys are also diagram file names
diagrams:
main_package:

View File

@ -2,6 +2,7 @@
<!-- toc -->
* [Providing custom data](#providing-custom-data)
* [Accessing comment content](#accessing-comment-content)
* ['plain' comment parser](#plain-comment-parser)
* ['clang' comment parser](#clang-comment-parser)
@ -92,6 +93,32 @@ generate notes in the PlantUML diagram from code comments (see also test case [t
{% endfor %}
```
### Providing custom data
It is possible to provide any data into the Jinja context using either `user_data`
config property, or using `--user-data` command line option.
For instance specifying:
```yaml
user_data:
license:
type: CC-0
```
or providing on command line the following option:
```bash
$ clang-uml --user-data license.type=CC-0 ...
```
will allow to access this variable in a Jinja template like this:
```jinja
{{ user_data.license.type }}
```
> For command line user data, the values are always typed as strings. `--user-data` option
> can be specified multiple times so that arbitrary objects can be constructed.
### Accessing comment content
Text available in the code comment blocks can be accessed in the templates depending on the selected comment
parser.