tag: add a ‘%’ formatter

Range tags can now be rendered as a percentage value, by using a ‘%’
formatter:

  {tag_name:%}
This commit is contained in:
Daniel Eklöf 2021-08-27 21:02:01 +02:00
parent 0da24198b3
commit e201cc3d30
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 73 additions and 7 deletions

View file

@ -38,9 +38,50 @@ The available tag *types* are:
# FORMATTING
As mentioned above, each tag type has a default representation that is
used when the tag is rendered by a string particle.
A tag may be followed by one or more formatters that alter the tags
rendition.
Formatters are added by appending a ':' separated list of formatter
names:
"{tag_name:max:hex}"
In the table below, "kind" describes the type of action performed by
the formatter:
- *format*: changes the representation of the tag's value
- *selector*: changes what to render
In general, formatters of the same kind cannot be combined; if
multiple formatters of the same kind are specified, the last one will
be used.
[[ *Formatter*
:[ *Kind*
:[ *Description*
:[ *Applies to*]
| hex
: format
: Renders a tag's value in hex
: All tag types
| oct
: format
: Renders a tag's value in octal
: All tag types
| %
: format
: Renders a range tag's value as a percentage value
: Range tags
| min
: selector
: Renders a range tag's mininum value
: Range tags
| max
: selector
: Renders a range tag's maximum value
: Range tags
| unit
: selector
: Renders a realtime tag's unit (e.g. "s", or "ms")
: Realtime tags
All integer, floating point and boolean tag types can be modified to
instead be rendered in hexadecimal or octal form, by appending either
the *:hex* or *:oct* suffixes. For example, _\"{tag_name:hex}\"_.