Skip to content
Snippets Groups Projects
Commit 4d24338a authored by deuce's avatar deuce
Browse files

Escape @, ^, and % in replacements until done parsing.

parent 34189043
Branches
Tags
No related merge requests found
...@@ -43,6 +43,7 @@ function write_template(filename) { ...@@ -43,6 +43,7 @@ function write_template(filename) {
return(ret); return(ret);
}); });
file=parse_regular_bit(file, "", template); file=parse_regular_bit(file, "", template);
file=file.replace(/\<\!-- Magical Synchronet ([\^%@])-code --\>/g,'$1');
write(file); write(file);
} }
...@@ -84,10 +85,14 @@ function parse_regular_bit(bit, objname, obj) { ...@@ -84,10 +85,14 @@ function parse_regular_bit(bit, objname, obj) {
function escape_match(start, exp, end) { function escape_match(start, exp, end) {
if(exp==undefined) if(exp==undefined)
exp=''; exp='';
exp=exp.toString();
if(start=="%") if(start=="%")
exp=html_encode(exp,false,false,false,false); exp=html_encode(exp,false,false,false,false);
if(start=="^") if(start=="^")
exp=encodeURIComponent(exp); exp=encodeURIComponent(exp);
exp=exp.replace(/\@/g,'<!-- Magical Synchronet @-code -->');
exp=exp.replace(/\^/g,'<!-- Magical Synchronet ^-code -->');
exp=exp.replace(/\%/g,'<!-- Magical Synchronet %-code -->');
return(exp); return(exp);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment