Add {{// (note)}} macro (#1265)

* add {{# (note)}} macro

* change from # to // for future updates

* fix docs
This commit is contained in:
IkariDevGIT 2023-10-21 13:28:02 +02:00 committed by GitHub
parent 51e0c9130a
commit 6fe4232f75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -1685,11 +1685,14 @@ function substituteParams(content, _name1, _name2, _original, _group) {
content = content.replace(/<CHARIFNOTGROUP>/gi, _group); content = content.replace(/<CHARIFNOTGROUP>/gi, _group);
content = content.replace(/<GROUP>/gi, _group); content = content.replace(/<GROUP>/gi, _group);
content = content.replace(/\{\{\/\/(.*?)\}\}/g, "");
content = content.replace(/{{time}}/gi, moment().format('LT')); content = content.replace(/{{time}}/gi, moment().format('LT'));
content = content.replace(/{{date}}/gi, moment().format('LL')); content = content.replace(/{{date}}/gi, moment().format('LL'));
content = content.replace(/{{weekday}}/gi, moment().format('dddd')); content = content.replace(/{{weekday}}/gi, moment().format('dddd'));
content = content.replace(/{{isotime}}/gi, moment().format('HH:mm')); content = content.replace(/{{isotime}}/gi, moment().format('HH:mm'));
content = content.replace(/{{isodate}}/gi, moment().format('YYYY-MM-DD')); content = content.replace(/{{isodate}}/gi, moment().format('YYYY-MM-DD'));
content = content.replace(/{{datetimeformat +([^}]*)}}/gi, (_, format) => { content = content.replace(/{{datetimeformat +([^}]*)}}/gi, (_, format) => {
const formattedTime = moment().format(format); const formattedTime = moment().format(format);
return formattedTime; return formattedTime;

View File

@ -3,6 +3,7 @@ System-wide Replacement Macros:
<li><tt>&lcub;&lcub;user&rcub;&rcub;</tt> - your current Persona username</li> <li><tt>&lcub;&lcub;user&rcub;&rcub;</tt> - your current Persona username</li>
<li><tt>&lcub;&lcub;char&rcub;&rcub;</tt> - the Character's name</li> <li><tt>&lcub;&lcub;char&rcub;&rcub;</tt> - the Character's name</li>
<li><tt>&lcub;&lcub;input&rcub;&rcub;</tt> - the user input</li> <li><tt>&lcub;&lcub;input&rcub;&rcub;</tt> - the user input</li>
<li><tt>&lcub;&lcub;// (note)&rcub;&rcub;</tt> - you can leave a note here, and the macro will be replaced with blank content</li>
<li><tt>&lcub;&lcub;time&rcub;&rcub;</tt> - the current time</li> <li><tt>&lcub;&lcub;time&rcub;&rcub;</tt> - the current time</li>
<li><tt>&lcub;&lcub;date&rcub;&rcub;</tt> - the current date</li> <li><tt>&lcub;&lcub;date&rcub;&rcub;</tt> - the current date</li>
<li><tt>&lcub;&lcub;weekday&rcub;&rcub;</tt> - the current weekday</li> <li><tt>&lcub;&lcub;weekday&rcub;&rcub;</tt> - the current weekday</li>