Read the statement by Michael Teeuw here.
MMM-CX3A - Transform not working?
-
@MMRIZE (tagged as author)
I have 4 transforms attempting to work at the same time, the last one “busy” doesn’t work - can someone explain why?
eventTransformer: (ev) => { if (ev.title.search("🏠") > -1) { ev.title = ev.title.replace("🏠 Personal Commitment","Private (Brendan)"); ev.color = 'yellow'; } if (ev.title.search("✈ Flight") > -1) { ev.title = ev.title.replace("✈ Flight","Private (Brendan)"); ev.color = 'yellow'; } if (ev.title.search("🚌️") > -1) { ev.title = ev.title.replace("🚌️ Transit","Private (Brendan)"); ev.color = 'yellow'; } if (ev.title.search("busy️") > -1) { ev.title = ev.title.replace("busy","Private (Mom)"); ev.color = 'yellow'; } return ev },
-
@BKeyport is it lower case busy?
-
@BKeyport
Font seems weird. (“y” of “busy”)
-
@MMRIZE good catch, that’s what it was… Cut and paste solved it. I really hate that my calendar merger application uses weird junk like that.
-
@MMRIZE interesting, it doesn’t appear like that for me
-
@sdetweil it looks normal for me, too - however, a cut and paste into both fields from the original text does fix it, so, whatever.
-
@BKeyport
Anyway, how about this code for those who need many transforming like you?eventTransformer: (event) => { const replaceMap = { 'original': 'Replaced', 'text': 'string', 'foo': 'bar', 'baz': 'qux', } Object.keys(replaceMap).forEach((key) => { const regex = new RegExp(key, 'gi') event.title = event.title.replace(regex, (token) => { event.color = 'red' return replaceMap[ key ] }) }) return event }
-
@MMRIZE That looks interesting… Most of my transforming is yanking out the emoji, though - because electron does partial display at best, and I so hate the boxed X showing up everywhere.
-
@BKeyport
You may need to install emoji fonts
Or you can parse out non-ASCII characters with regular expressions. -
@MMRIZE Interesting. How would one install the Emoji fonts? I’d rather have the prettyness than all text.