From 9ec05c7f8b5c4fff31edb29beb45726751771361 Mon Sep 17 00:00:00 2001 From: Jakub Chrzanowski Date: Wed, 13 Oct 2021 23:03:35 +0200 Subject: [PATCH] Docs update --- README.md | 24 +++++++++---------- .../changelog/ChangelogPluginExtension.kt | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index da85b50..3c7e176 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ changelog { version = "1.0.0" path = "${project.projectDir}/CHANGELOG.md" header = "[${-> version.get()}] - ${new SimpleDateFormat("yyyy-MM-dd").format(new Date())}" - headerParserRegex = ~/\d+\.\d+/ + headerParserRegex = ~/(\d+\.\d+)/ itemPrefix = "-" keepUnreleasedSection = true unreleasedTerm = "[Unreleased]" @@ -102,17 +102,17 @@ changelog { Plugin can be configured with the following properties set in the `changelog {}` closure: -| Property | Description | Default value | -| ----------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| **`version`** | **Required.** Current project's version. | | -| `groups` | List of groups created with a new Unreleased section. | `["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]` | -| `header` | `String` or `Provider` that returns current header value. | `provider { "[${version.get()}]" }` | -| `headerParserRegex` | `Regex`/`Pattern`/`String` used to extract version from the header string. | `null`, fallbacks to [`ChangelogPluginConstants#SEM_VER_REGEX`][semver-regex] | -| `itemPrefix` | Single item's prefix, allows to customise the bullet sign. | `"-"` | -| `keepUnreleasedSection` | Add Unreleased empty section after patching. | `true` | -| `patchEmpty` | Patches changelog even if no release note is provided. | `true` | -| `path` | Path to the changelog file. | `"${project.projectDir}/CHANGELOG.md"` | -| `unreleasedTerm` | Unreleased section text. | `"[Unreleased]"` | +| Property | Description | Default value | +| ----------------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| **`version`** | **Required.** Current project's version. | | +| `groups` | List of groups created with a new Unreleased section. | `["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]` | +| `header` | `String` or `Provider` that returns current header value. | `provider { "[${version.get()}]" }` | +| `headerParserRegex` | `Regex`/`Pattern`/`String` used to extract version from the header string. | `null`, fallbacks to [`ChangelogPluginConstants#SEM_VER_REGEX`][semver-regex] | +| `itemPrefix` | Single item's prefix, allows to customise the bullet sign. | `"-"` | +| `keepUnreleasedSection` | Add Unreleased empty section after patching. | `true` | +| `patchEmpty` | Patches changelog even if no release note is provided. | `true` | +| `path` | Path to the changelog file. | `"${project.projectDir}/CHANGELOG.md"` | +| `unreleasedTerm` | Unreleased section text. | `"[Unreleased]"` | > **Note:** `header` closure has the delegate explicitly set to the extension's context for the sake of the [Configuration cache][configuration-cache] support. diff --git a/src/main/kotlin/org/jetbrains/changelog/ChangelogPluginExtension.kt b/src/main/kotlin/org/jetbrains/changelog/ChangelogPluginExtension.kt index 551ea33..a2a2854 100644 --- a/src/main/kotlin/org/jetbrains/changelog/ChangelogPluginExtension.kt +++ b/src/main/kotlin/org/jetbrains/changelog/ChangelogPluginExtension.kt @@ -22,7 +22,7 @@ open class ChangelogPluginExtension @Inject constructor( @Optional val headerParserRegex: Property = objects.property(Any::class.java) - fun getHeaderParserRegex() = when (val value = headerParserRegex.orNull) { + internal fun getHeaderParserRegex() = when (val value = headerParserRegex.orNull) { is Regex -> value is String -> value.toRegex() is Pattern -> value.toRegex()