summaryrefslogtreecommitdiffstats
path: root/rfc/0002-output-templating.md
blob: 4c78bab77ceaee1f5acb23de7fedb410f07681c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Summary
[summary]: #summary

Providing the possibility to output the parsed git log via custom templates.

# Motivation
[motivation]: #motivation

Since everyone has a different way in creating Changelogs a more flexible approach is needed. A dedicated
templating engine for the output of git-journal will enable these flexibility.

# Detailed design
[design]: #detailed-design

Templates are stored as regular toml files and provide additional information to git-journal regarding the output of the
Changelog. The format of an output template consists of
[tags](https://github.com/saschagrunert/git-journal/blob/master/rfc/0001-commit-msg.md#tags) and their mapping. An
example for such a template looks like this:

```toml
[[tag]]
tag = "feature"
name = "Feature"

[[tag]]
tag = "doc"
name = "Documentation"

[[tag]]
[[tag.subtag]]
tag = "doc_internal"
name = "Internal documentation"

[[tag]]
[[tag.subtag]]
tag = "doc_cust"
name = "Customer documentation"

[[tag]]
tag = "internal"
name = "Internal"
footers = ["Fixes"]
```

Every tag represents a toml table which can be nested as well. Arrays of tables can be used to keep the order of the
items, whereas the name of the array does not matter at all. The `tag` fields corresponds to the commit message tag and
the `name` field inside the table maps the related tag to a chosen name.

The `default` table can be used to specify every commit item which contains no tag at all. The `footers` array specifies
the to be printed commit footers.