diff --git a/strange_eons_to_arkhamdb.js b/strange_eons_to_arkhamdb.js index eeaea3d..616cc23 100644 --- a/strange_eons_to_arkhamdb.js +++ b/strange_eons_to_arkhamdb.js @@ -81,13 +81,17 @@ function leftPad(str, len, fill) { 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 substitute_tags(str) { str = str.trim(); - str = str.replace("", String(component.getName())); + str = replaceAll(str, "", String(component.getName())); - for (tag in tag_replacements) { - str = str.replace(tag, tag_replacements[tag]); + for (var tag in tag_replacements) { + str = replaceAll(str, tag, tag_replacements[tag]); } return str; }