chore(cliff): Support multi line BC description
This commit is contained in:
parent
af8511e414
commit
f824164ae5
1 changed files with 15 additions and 3 deletions
16
cliff.toml
16
cliff.toml
|
@ -18,13 +18,25 @@ body = """
|
||||||
{{commit.message | split(pat="\n") | nth(n=0) | upper_first }}\
|
{{commit.message | split(pat="\n") | nth(n=0) | upper_first }}\
|
||||||
{% endmacro commit_header %}\
|
{% endmacro commit_header %}\
|
||||||
|
|
||||||
{# Return the `BREAKING-CHANGE` footer message, only one line #}\
|
{# Return the `BREAKING-CHANGE` footer message #}\
|
||||||
{% macro bc_des(commit) %}\
|
{% macro bc_des(commit) %}\
|
||||||
|
{% set lines = [] %}\
|
||||||
|
{% set found_breaking = false %}\
|
||||||
{% for line in commit.message | split(pat="\n") %}\
|
{% for line in commit.message | split(pat="\n") %}\
|
||||||
|
{% if found_breaking and line is not containing(":") %}\
|
||||||
|
{% set_global lines = lines | concat(with=line) %}\
|
||||||
|
{% elif found_breaking and line is containing(":") %}\
|
||||||
|
{% set_global found_breaking = false %}\
|
||||||
|
{% endif %}\
|
||||||
{% if line is starting_with("BREAKING-CHANGE") %}\
|
{% if line is starting_with("BREAKING-CHANGE") %}\
|
||||||
{{line | split(pat=":") | nth(n=1) | split(pat="\n") | nth(n=0)}}\
|
{% set_global found_breaking = true %}\
|
||||||
|
{% set breaking_line = line | split(pat=":") | nth(n=1) %}\
|
||||||
|
{% set_global lines = lines | concat(with=breaking_line) %}\
|
||||||
{% endif %}\
|
{% endif %}\
|
||||||
{% endfor %}\
|
{% endfor %}\
|
||||||
|
{% if lines | length != 0 %}\
|
||||||
|
{{ lines | join(sep="\n") | trim_end(pat="\n") }}\
|
||||||
|
{% endif %}\
|
||||||
{% endmacro bc_des %}\
|
{% endmacro bc_des %}\
|
||||||
|
|
||||||
{% if version %}\
|
{% if version %}\
|
||||||
|
|
Loading…
Reference in a new issue