diff --git a/.github/fixtures/new-fixture-template/cliff.toml b/.github/fixtures/new-fixture-template/cliff.toml index e747882bad..47b901979d 100644 --- a/.github/fixtures/new-fixture-template/cliff.toml +++ b/.github/fixtures/new-fixture-template/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-bump-version-keep-zerover/cliff.toml b/.github/fixtures/test-bump-version-keep-zerover/cliff.toml index 3bdd4745d1..bbb34220dd 100644 --- a/.github/fixtures/test-bump-version-keep-zerover/cliff.toml +++ b/.github/fixtures/test-bump-version-keep-zerover/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [bump] features_always_bump_minor = false diff --git a/.github/fixtures/test-bump-version/cliff.toml b/.github/fixtures/test-bump-version/cliff.toml index 6c68b9ea3f..24e42bb4ff 100644 --- a/.github/fixtures/test-bump-version/cliff.toml +++ b/.github/fixtures/test-bump-version/cliff.toml @@ -22,5 +22,5 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-bumped-version/cliff.toml b/.github/fixtures/test-bumped-version/cliff.toml index 6c68b9ea3f..24e42bb4ff 100644 --- a/.github/fixtures/test-bumped-version/cliff.toml +++ b/.github/fixtures/test-bumped-version/cliff.toml @@ -22,5 +22,5 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-commit-footers/cliff.toml b/.github/fixtures/test-commit-footers/cliff.toml index b54aef06bf..5ee7d8ebab 100644 --- a/.github/fixtures/test-commit-footers/cliff.toml +++ b/.github/fixtures/test-commit-footers/cliff.toml @@ -25,5 +25,5 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-commit-preprocessors/cliff.toml b/.github/fixtures/test-commit-preprocessors/cliff.toml index 405acb06fd..d8c038c309 100644 --- a/.github/fixtures/test-commit-preprocessors/cliff.toml +++ b/.github/fixtures/test-commit-preprocessors/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of preprocessors to modify commit messages using regex prior to further processing. diff --git a/.github/fixtures/test-custom-scope/cliff.toml b/.github/fixtures/test-custom-scope/cliff.toml index c626318c8b..f7d494478d 100644 --- a/.github/fixtures/test-custom-scope/cliff.toml +++ b/.github/fixtures/test-custom-scope/cliff.toml @@ -25,8 +25,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-custom-tag-pattern/cliff.toml b/.github/fixtures/test-custom-tag-pattern/cliff.toml index 6bb98d303b..0a25fc6c84 100644 --- a/.github/fixtures/test-custom-tag-pattern/cliff.toml +++ b/.github/fixtures/test-custom-tag-pattern/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml index 44bbe25b80..de3df0399f 100644 --- a/.github/fixtures/test-date-order/cliff.toml +++ b/.github/fixtures/test-date-order/cliff.toml @@ -22,5 +22,5 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-footer-template/cliff.toml b/.github/fixtures/test-footer-template/cliff.toml index 67f908ad89..d088363ecb 100644 --- a/.github/fixtures/test-footer-template/cliff.toml +++ b/.github/fixtures/test-footer-template/cliff.toml @@ -30,5 +30,5 @@ footer_template = """ {% endif %}\ {% endfor %}\ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-github-integration/cliff.toml b/.github/fixtures/test-github-integration/cliff.toml index b1b271b08b..65942c4eac 100644 --- a/.github/fixtures/test-github-integration/cliff.toml +++ b/.github/fixtures/test-github-integration/cliff.toml @@ -30,8 +30,8 @@ body_template = """ {% raw %}\n{% endraw %} {% endif %} """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/.github/fixtures/test-ignore-tags/cliff.toml b/.github/fixtures/test-ignore-tags/cliff.toml index 65d093de2f..8010109c23 100644 --- a/.github/fixtures/test-ignore-tags/cliff.toml +++ b/.github/fixtures/test-ignore-tags/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [release] # Regex to select git tags that do not represent proper releases. Takes precedence over `release.tags_pattern`. diff --git a/.github/fixtures/test-keep-a-changelog-links-current-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-current-arg/cliff.toml index 7518836ad7..d602a2d133 100644 --- a/.github/fixtures/test-keep-a-changelog-links-current-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-current-arg/cliff.toml @@ -35,8 +35,8 @@ body_template = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml index a55d1fbaf5..346c1fa284 100644 --- a/.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-latest-arg/cliff.toml @@ -35,8 +35,8 @@ body_template = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/.github/fixtures/test-keep-a-changelog-links-no-tags/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-no-tags/cliff.toml index a55d1fbaf5..346c1fa284 100644 --- a/.github/fixtures/test-keep-a-changelog-links-no-tags/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-no-tags/cliff.toml @@ -35,8 +35,8 @@ body_template = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/.github/fixtures/test-keep-a-changelog-links-one-tag-bump-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-one-tag-bump-arg/cliff.toml index 44b2b99587..708fa79a09 100644 --- a/.github/fixtures/test-keep-a-changelog-links-one-tag-bump-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-one-tag-bump-arg/cliff.toml @@ -35,8 +35,8 @@ body_template = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/.github/fixtures/test-keep-a-changelog-links-one-tag/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-one-tag/cliff.toml index aec16aba0f..329f02e47c 100644 --- a/.github/fixtures/test-keep-a-changelog-links-one-tag/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-one-tag/cliff.toml @@ -35,8 +35,8 @@ body_template = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/.github/fixtures/test-keep-a-changelog-links-tag-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-tag-arg/cliff.toml index 44b2b99587..708fa79a09 100644 --- a/.github/fixtures/test-keep-a-changelog-links-tag-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-tag-arg/cliff.toml @@ -35,8 +35,8 @@ body_template = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/.github/fixtures/test-keep-a-changelog-links-unreleased-arg/cliff.toml b/.github/fixtures/test-keep-a-changelog-links-unreleased-arg/cliff.toml index 44b2b99587..708fa79a09 100644 --- a/.github/fixtures/test-keep-a-changelog-links-unreleased-arg/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links-unreleased-arg/cliff.toml @@ -35,8 +35,8 @@ body_template = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/.github/fixtures/test-keep-a-changelog-links/cliff.toml b/.github/fixtures/test-keep-a-changelog-links/cliff.toml index c66e64f5dd..3c64c83be1 100644 --- a/.github/fixtures/test-keep-a-changelog-links/cliff.toml +++ b/.github/fixtures/test-keep-a-changelog-links/cliff.toml @@ -39,8 +39,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # Whether to exclude changes that do not belong to any group from the changelog. exclude_ungrouped_changes = true diff --git a/.github/fixtures/test-latest-with-one-tag/cliff.toml b/.github/fixtures/test-latest-with-one-tag/cliff.toml index 44bbe25b80..de3df0399f 100644 --- a/.github/fixtures/test-latest-with-one-tag/cliff.toml +++ b/.github/fixtures/test-latest-with-one-tag/cliff.toml @@ -22,5 +22,5 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-limit-commits/cliff.toml b/.github/fixtures/test-limit-commits/cliff.toml index bea2ef5204..1fb3fca66a 100644 --- a/.github/fixtures/test-limit-commits/cliff.toml +++ b/.github/fixtures/test-limit-commits/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # Whether to limit the total number of commits to be included in the changelog. diff --git a/.github/fixtures/test-no-exec/cliff.toml b/.github/fixtures/test-no-exec/cliff.toml index 3bca80b858..de18bd2559 100644 --- a/.github/fixtures/test-no-exec/cliff.toml +++ b/.github/fixtures/test-no-exec/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A list of postprocessors using regex to modify the changelog. postprocessors = [ { pattern = '.*', replace_command = 'this_command_does_not_exist' }, diff --git a/.github/fixtures/test-regex-replace-parser/cliff.toml b/.github/fixtures/test-regex-replace-parser/cliff.toml index 7077eabe58..9c495280ba 100644 --- a/.github/fixtures/test-regex-replace-parser/cliff.toml +++ b/.github/fixtures/test-regex-replace-parser/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-skip-breaking-changes/cliff.toml b/.github/fixtures/test-skip-breaking-changes/cliff.toml index 5d7a4f4cc6..8f23dc57a4 100644 --- a/.github/fixtures/test-skip-breaking-changes/cliff.toml +++ b/.github/fixtures/test-skip-breaking-changes/cliff.toml @@ -25,8 +25,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-skip-commits/cliff.toml b/.github/fixtures/test-skip-commits/cliff.toml index e747882bad..47b901979d 100644 --- a/.github/fixtures/test-skip-commits/cliff.toml +++ b/.github/fixtures/test-skip-commits/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # A list of parsers using regex for extracting data from the commit message. diff --git a/.github/fixtures/test-split-commits/cliff.toml b/.github/fixtures/test-split-commits/cliff.toml index da7524519e..d7884012ab 100644 --- a/.github/fixtures/test-split-commits/cliff.toml +++ b/.github/fixtures/test-split-commits/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [commit] # Whether to split commits on newlines, treating each line as an individual commit. diff --git a/.github/fixtures/test-topo-order-arg/cliff.toml b/.github/fixtures/test-topo-order-arg/cliff.toml index 44bbe25b80..de3df0399f 100644 --- a/.github/fixtures/test-topo-order-arg/cliff.toml +++ b/.github/fixtures/test-topo-order-arg/cliff.toml @@ -22,5 +22,5 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true diff --git a/.github/fixtures/test-topo-order/cliff.toml b/.github/fixtures/test-topo-order/cliff.toml index cd15978d34..3558d46067 100644 --- a/.github/fixtures/test-topo-order/cliff.toml +++ b/.github/fixtures/test-topo-order/cliff.toml @@ -22,8 +22,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true [release] # Whether to order releases chronologically or topologically. diff --git a/cliff.toml b/cliff.toml index 0431ca016e..be9eecaf57 100644 --- a/cliff.toml +++ b/cliff.toml @@ -53,8 +53,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A list of postprocessors using regex to modify the changelog. postprocessors = [ { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL diff --git a/config/cliff.toml b/config/cliff.toml index 565fc3fc9f..5a3a26293f 100644 --- a/config/cliff.toml +++ b/config/cliff.toml @@ -31,8 +31,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing s -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A list of postprocessors using regex to modify the changelog. postprocessors = [ # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL diff --git a/examples/cocogitto.toml b/examples/cocogitto.toml index be61897125..0632180b33 100644 --- a/examples/cocogitto.toml +++ b/examples/cocogitto.toml @@ -41,8 +41,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A list of postprocessors using regex to modify the changelog. postprocessors = [ { pattern = '\$REPO', replace = "https://github.com/cocogitto/cocogitto" }, # replace repository URL diff --git a/examples/detailed.toml b/examples/detailed.toml index 1ae5e7fbb5..33ee9a1de4 100644 --- a/examples/detailed.toml +++ b/examples/detailed.toml @@ -34,8 +34,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # Whether to exclude changes that do not belong to any group from the changelog. exclude_ungrouped_changes = false diff --git a/examples/github-keepachangelog.toml b/examples/github-keepachangelog.toml index 3ff6d859a0..1ca15c9212 100644 --- a/examples/github-keepachangelog.toml +++ b/examples/github-keepachangelog.toml @@ -64,8 +64,8 @@ footer_template = """ {% endfor %} """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # Whether to exclude changes that do not belong to any group from the changelog. exclude_ungrouped_changes = true diff --git a/examples/github.toml b/examples/github.toml index c18411b468..5f953ef5f7 100644 --- a/examples/github.toml +++ b/examples/github.toml @@ -48,8 +48,8 @@ body_template = """ https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} {%- endmacro -%} """ -# remove the leading and trailing whitespace from the template -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). footer_template = """ diff --git a/examples/keepachangelog.toml b/examples/keepachangelog.toml index 9fd8348438..d8d7fcdfc2 100644 --- a/examples/keepachangelog.toml +++ b/examples/keepachangelog.toml @@ -40,8 +40,8 @@ footer_template = """ {% endfor %} """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # Whether to exclude changes that do not belong to any group from the changelog. exclude_ungrouped_changes = true diff --git a/examples/scoped.toml b/examples/scoped.toml index 799b34c300..8c7e92e36f 100644 --- a/examples/scoped.toml +++ b/examples/scoped.toml @@ -28,8 +28,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # Whether to exclude changes that do not belong to any group from the changelog. exclude_ungrouped_changes = false diff --git a/examples/scopesorted.toml b/examples/scopesorted.toml index 6f5b64ef09..176d85de36 100644 --- a/examples/scopesorted.toml +++ b/examples/scopesorted.toml @@ -41,8 +41,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # Whether to exclude changes that do not belong to any group from the changelog. exclude_ungrouped_changes = false diff --git a/examples/unconventional.toml b/examples/unconventional.toml index 7d1c32d879..b212499167 100644 --- a/examples/unconventional.toml +++ b/examples/unconventional.toml @@ -25,8 +25,8 @@ body_template = """ footer_template = """ """ -# remove the leading and trailing whitespace from the templates -trim = true +# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. +trim_body_whitespace = true # Whether to exclude changes that do not belong to any group from the changelog. exclude_ungrouped_changes = false diff --git a/git-cliff-core/src/changelog.rs b/git-cliff-core/src/changelog.rs index 598f00b54f..1ba50c59f6 100644 --- a/git-cliff-core/src/changelog.rs +++ b/git-cliff-core/src/changelog.rs @@ -34,7 +34,7 @@ pub struct Changelog<'a> { impl<'a> Changelog<'a> { /// Constructs a new instance. pub fn new(releases: Vec>, config: &'a Config) -> Result { - let trim = config.changelog.trim.unwrap_or(true); + let trim = config.changelog.trim_body_whitespace.unwrap_or(true); let mut changelog = Self { releases, body_template: Template::new( @@ -339,7 +339,7 @@ mod test { footer_template: Some(String::from( r#"-- total releases: {{ releases | length }} --"#, )), - trim: Some(true), + trim_body_whitespace: Some(true), postprocessors: Some(vec![TextProcessor { pattern: Regex::new("boring") .expect("failed to compile regex"), diff --git a/git-cliff-core/src/config.rs b/git-cliff-core/src/config.rs index 9acfce7ef0..3df61e3653 100644 --- a/git-cliff-core/src/config.rs +++ b/git-cliff-core/src/config.rs @@ -60,8 +60,8 @@ pub struct ChangelogConfig { pub body_template: Option, /// A Tera template to be rendered as the changelog's footer. pub footer_template: Option, - /// Trim the template. - pub trim: Option, + /// Whether to remove leading and trailing whitespaces from all lines of the changelog's body. + pub trim_body_whitespace: Option, /// A list of postprocessors using regex to modify the changelog. pub postprocessors: Option>, /// Whether to exclude changes that do not belong to any group from the changelog. diff --git a/git-cliff-core/tests/integration_test.rs b/git-cliff-core/tests/integration_test.rs index d44abc580a..462d59f08e 100644 --- a/git-cliff-core/tests/integration_test.rs +++ b/git-cliff-core/tests/integration_test.rs @@ -39,7 +39,7 @@ fn generate_changelog() -> Result<()> { {% endfor %}"#, )), footer_template: Some(String::from("eoc - end of changelog")), - trim: None, + trim_body_whitespace: None, postprocessors: None, exclude_ungrouped_changes: Some(true), }; diff --git a/website/docs/configuration/changelog.md b/website/docs/configuration/changelog.md index d1c8a4684f..2942eea1e5 100644 --- a/website/docs/configuration/changelog.md +++ b/website/docs/configuration/changelog.md @@ -15,7 +15,7 @@ body_template = """ {% endfor %} {% endfor %} """ -trim = true +trim_body_whitespace = true footer_template = "" postprocessors = [{ pattern = "foo", replace = "bar"}] exclude_ungrouped_changes = false @@ -43,9 +43,9 @@ For example, to get the list of releases, use the `{{ releases }}` variable in t See [Keep a Changelog configuration](/docs/templating/examples#keep-a-changelog) for seeing the example of adding links to the end of the changelog. -### trim +### trim_body_whitespace -If set to `true`, leading and trailing whitespace are removed from the [`body_template`](#body_template). +If set to `true`, leading and trailing whitespace are removed from every line in the rendered [`body_template`](#body_template). It is useful for adding indentation to the template for readability, as shown [in the example](#changelog).