diff --git a/CHANGELOG.md b/CHANGELOG.md index c9a73c34..a01840c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Russian Translation - Afrikaans Translation - Add postinstall script to notify user that MagicMirror installed successfully despite warnings from NPM. +- Option to use RegExp in Calendar's titleReplace. ### Fixed - Update .gitignore to not ignore default modules folder. diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index b719ac01..53e9187c 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -379,6 +379,13 @@ Module.register("calendar", { titleTransform: function (title) { for (var needle in this.config.titleReplace) { var replacement = this.config.titleReplace[needle]; + + var regParts = needle.match(/^\/(.+)\/([gim]*)$/); + if (regParts) { + // the parsed pattern is a regexp. + needle = new RegExp(regParts[1], regParts[2]); + } + title = title.replace(needle, replacement); }