1
0
mirror of https://github.com/SillyTavern/SillyTavern.git synced 2024-12-12 17:36:22 +01:00

Merge pull request from SillyTavern/fix-trim-macro

Fix trim macro breaking on CRLF
This commit is contained in:
Cohee 2024-07-04 20:10:45 +03:00 committed by GitHub
commit 03c9e3f168
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -437,7 +437,7 @@ export function evaluateMacros(content, env) {
content = replaceInstructMacros(content, env); content = replaceInstructMacros(content, env);
content = replaceVariableMacros(content); content = replaceVariableMacros(content);
content = content.replace(/{{newline}}/gi, '\n'); content = content.replace(/{{newline}}/gi, '\n');
content = content.replace(/\n*{{trim}}\n*/gi, ''); content = content.replace(/(?:\r?\n)*{{trim}}(?:\r?\n)*/gi, '');
content = content.replace(/{{noop}}/gi, ''); content = content.replace(/{{noop}}/gi, '');
content = content.replace(/{{input}}/gi, () => String($('#send_textarea').val())); content = content.replace(/{{input}}/gi, () => String($('#send_textarea').val()));