diff --git a/ballerina/configurables.bal b/ballerina/configurables.bal new file mode 100644 index 0000000..c75ad34 --- /dev/null +++ b/ballerina/configurables.bal @@ -0,0 +1,3 @@ + +# This can be used to match case of the given word. Does not work with camel case +configurable boolean tryToRestoreCase = false; diff --git a/ballerina/main.bal b/ballerina/main.bal index 8c2456d..e265792 100644 --- a/ballerina/main.bal +++ b/ballerina/main.bal @@ -122,6 +122,10 @@ function replaceWordWithRules(string word, string token, [regexp:RegExp, Capture } function restoreCase(string word, string token) returns string { + if !tryToRestoreCase { + return token; + } + if word == token { return token; } diff --git a/ballerina/tests/tests.bal b/ballerina/tests/tests.bal index 854f054..62204a7 100644 --- a/ballerina/tests/tests.bal +++ b/ballerina/tests/tests.bal @@ -74,7 +74,7 @@ import ballerina/test; [string, string][] pluralDatasetExceptions = [ ["box", "boxes"], ["Octopus", "Octopuses"], - ["KNIFE", "KNIVES"], + ["KNIfe", "KNIves"], ["loaf", "loaves"], ["index", "indices"], ["sheep", "sheep"], diff --git a/changelog.md b/changelog.md index ccf9e65..f7676a7 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed +- Disable restore case functionality by default. ## [1.0.0] - 03/06/2024