Skip to content

Commit

Permalink
Clean up commodity descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
iaincollins committed Oct 4, 2024
1 parent b6a5d07 commit 9289679
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
6 changes: 6 additions & 0 deletions scripts/build-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ async function codexArticles () {
return response
}

// These regular expressions don't need to be clever or over engineered,
// it's not runtime code and it's just an ETL job for a hobby project
const rawQuotes = rawText
.replace(/\r\n/img, '')
.match(/{{quote(.*?)}}/img)
Expand All @@ -205,6 +207,10 @@ async function codexArticles () {
.replace(/<!--(.*?)-->/, '')
.replace(/\[\[/, '')
.replace(/\]\]/, '')
.replace(/(<br>+)/img, ' ')
.replace(/(<br\/>+)/img, ' ')
.replace(/[ ]{2,}/img, ' ') // Turn two or more spaces into a single space
.replace(/Painite,CaZrAl<sub>9<\/sub>O<sub>15<\/sub>\(BO<sub>3<\/sub>\)\./, '') // This is just garbage data in the entry for Panite
.trim()
?? null

Expand Down
Loading

0 comments on commit 9289679

Please sign in to comment.