Decode HTML entities in gear names retrieved from Inkipedia

This fixes matching issues for gear with ampersands like "Red & Black Squidkid IV".
This commit is contained in:
Unknown 2017-11-06 15:06:33 -08:00
parent f7fac094da
commit 35eb01b2da
4 changed files with 8 additions and 6 deletions

View File

@ -28,6 +28,7 @@
"dotenv": "^4.0.0", "dotenv": "^4.0.0",
"extract-text-webpack-plugin": "^3.0.0", "extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2", "file-loader": "^0.11.2",
"he": "^1.1.1",
"html-loader": "^0.5.0", "html-loader": "^0.5.0",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"ical.js": "^1.2.2", "ical.js": "^1.2.2",

View File

@ -37,7 +37,7 @@
}, },
{ {
"brand": "8", "brand": "8",
"name": "Baby-Jelly Shirt & Tie", "name": "Baby-Jelly Shirt & Tie",
"price": 3800, "price": 3800,
"rarity": 1, "rarity": 1,
"skill": "13" "skill": "13"
@ -436,7 +436,7 @@
}, },
{ {
"brand": "8", "brand": "8",
"name": "Shirt & Tie", "name": "Shirt & Tie",
"price": 8400, "price": 8400,
"rarity": 2, "rarity": 2,
"skill": "6" "skill": "6"
@ -1049,7 +1049,7 @@
}, },
{ {
"brand": "16", "brand": "16",
"name": "Blue & Black Squidkid IV", "name": "Blue & Black Squidkid IV",
"price": 11000, "price": 11000,
"rarity": 2, "rarity": 2,
"skill": "9" "skill": "9"
@ -1259,7 +1259,7 @@
}, },
{ {
"brand": "16", "brand": "16",
"name": "Red & Black Squidkid IV", "name": "Red & Black Squidkid IV",
"price": 11000, "price": 11000,
"rarity": 2, "rarity": 2,
"skill": "5" "skill": "5"

View File

@ -8,6 +8,7 @@ const mkdirp = require('mkdirp');
const axios = require('axios'); const axios = require('axios');
const retrieveGearData = require('./retrieveGearData'); const retrieveGearData = require('./retrieveGearData');
const stringify = require('json-stable-stringify'); const stringify = require('json-stable-stringify');
const he = require('he');
const dataPath = path.resolve('src/js/data'); const dataPath = path.resolve('src/js/data');
const brandsFilename = `${dataPath}/brands.json`; const brandsFilename = `${dataPath}/brands.json`;
@ -72,7 +73,7 @@ function applyData(oldData, newData) {
let details = /name=(.*?)\|brand=(.*?)\|cost=(.*?)\|ability=(.*?)\|rarity=(.*?)\|/.exec(row[0]); let details = /name=(.*?)\|brand=(.*?)\|cost=(.*?)\|ability=(.*?)\|rarity=(.*?)\|/.exec(row[0]);
if (details) { if (details) {
inkipediaGear[key].push({ inkipediaGear[key].push({
name: details[1], name: he.decode(details[1]),
brand: details[2], brand: details[2],
price: parseInt(details[3].replace(',', '')), price: parseInt(details[3].replace(',', '')),
skill: details[4], skill: details[4],

View File

@ -2404,7 +2404,7 @@ hawk@~6.0.2:
hoek "4.x.x" hoek "4.x.x"
sntp "2.x.x" sntp "2.x.x"
he@1.1.x, he@^1.1.0: he@1.1.x, he@^1.1.0, he@^1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"