fix: preserve line breaks from HTML tags during Ikonis feature description parsing
This commit is contained in:
parent
c32ebdda39
commit
e2625219e2
1 changed files with 6 additions and 2 deletions
|
|
@ -25,8 +25,12 @@ export function getAugments() {
|
||||||
for (const [id, feature] of Object.entries(allFeatures)) {
|
for (const [id, feature] of Object.entries(allFeatures)) {
|
||||||
const name = feature.label || feature.name || "";
|
const name = feature.label || feature.name || "";
|
||||||
if (name.startsWith("Ikonis:")) {
|
if (name.startsWith("Ikonis:")) {
|
||||||
const desc = feature.description ? feature.description.replace(/<[^>]*>?/gm, '').trim() : "";
|
let desc = feature.description || "";
|
||||||
const lines = desc.split(/\n|\r/).map(l => l.trim()).filter(l => l.length > 0);
|
// Replace common line-breaking tags with actual newlines before stripping
|
||||||
|
desc = desc.replace(/<\/p>|<br\s*\/?>/gi, '\n');
|
||||||
|
desc = desc.replace(/<[^>]*>?/gm, '').trim();
|
||||||
|
|
||||||
|
const lines = desc.split('\n').map(l => l.trim()).filter(l => l.length > 0);
|
||||||
|
|
||||||
const costLine = lines.find(l => l.toLowerCase().startsWith("cost:"));
|
const costLine = lines.find(l => l.toLowerCase().startsWith("cost:"));
|
||||||
const effectLine = lines.find(l => !l.toLowerCase().startsWith("cost:"));
|
const effectLine = lines.find(l => !l.toLowerCase().startsWith("cost:"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue