Replace tags globaly in card text
This commit is contained in:
parent
1a9c236c01
commit
2e498dab9b
@ -81,13 +81,17 @@ function leftPad(str, len, fill) {
|
|||||||
return fill.repeat(Math.max(len - str.length, 0)) + str;
|
return fill.repeat(Math.max(len - str.length, 0)) + str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function replaceAll(str, search, replace) {
|
||||||
|
return str.split(search).join(replace);
|
||||||
|
}
|
||||||
|
|
||||||
function build_card(component) {
|
function build_card(component) {
|
||||||
function substitute_tags(str) {
|
function substitute_tags(str) {
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
str = str.replace("<fullname>", String(component.getName()));
|
str = replaceAll(str, "<fullname>", String(component.getName()));
|
||||||
|
|
||||||
for (tag in tag_replacements) {
|
for (var tag in tag_replacements) {
|
||||||
str = str.replace(tag, tag_replacements[tag]);
|
str = replaceAll(str, tag, tag_replacements[tag]);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user