Skip to content

Commit

Permalink
Fixed linking problems
Browse files Browse the repository at this point in the history
  • Loading branch information
HadaIonut committed Apr 13, 2021
1 parent 73d0e59 commit 40e7658
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/lib/CityImporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ const prepareText = (rawText) => {
let id = located[index]?.parentElement?.parentElement?.className.replace('tip', '') ||
located[index]?.parentElement?.className.replace('tip', '') ||
located[index]?.parentElement?.parentElement?.id ||
located[index]?.parentElement?.id;
id = id.replace(' ', '');
located[index]?.parentElement?.id ||
located[index].classList.value.replace('link-internal ', '');
//id = id.replace(' ', '');
if (text.includes('Description of')) return `@JournalEntry[town]{${text}}`
return id !== '' || id ? `@JournalEntry[${id}]{${text}}` : text;
})
Expand Down Expand Up @@ -118,6 +119,7 @@ const secondPassJournals = async (ids, loadingBar) => {
journalClone.content = journalClone.content.replace(/@JournalEntry\[(\w+)\]/g, (_0, uid) => `@JournalEntry[${ids[0].get(uid)}]`);
journalClone.content = journalClone.content.replace(/@JournalEntry\[(\w+-\w+-\w+-\w+-\w+)\]/g, (_0, uid) => `@JournalEntry[${ids[0].get(uid)}]`);
journalClone.content = journalClone.content.replace(/@JournalEntry\[undefined\]{(.*?)}/g, (_0, name) => name);
journalClone.content = journalClone.content.replace(/@JournalEntry\[link-internal\]{(.*?)}/g, (_0, name) => name);
journalClone.content = journalClone.content.replace(/@JournalEntry\[tip-([\w-]+)\]{(.*?)}/g, (_0, original, name) => {
for (const value of allJournals.values())
if (value.data.name.toLowerCase() === name.toLowerCase())
Expand Down

0 comments on commit 40e7658

Please sign in to comment.