Skip to content

Commit

Permalink
Merge pull request #917 from DataUSA/staging
Browse files Browse the repository at this point in the history
v3.1.2
  • Loading branch information
davelandry authored Jan 20, 2021
2 parents 5513cd5 + ed9fdb8 commit 0784191
Show file tree
Hide file tree
Showing 5 changed files with 360 additions and 342 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datausa-site",
"version": "3.1.1",
"version": "3.1.2",
"description": "The most comprehensive visualization of U.S. public data",
"main": "src/index.js",
"scripts": {
Expand Down Expand Up @@ -34,7 +34,7 @@
"@datawheel/canon-cms": "^0.16.7",
"@datawheel/canon-core": "^0.20.1",
"@datawheel/canon-logiclayer": "^0.4.8",
"@datawheel/canon-vizbuilder": "^0.4.5",
"@datawheel/canon-vizbuilder": "^0.4.6",
"@datawheel/olap-client": "^1.3.3",
"buble": "^0.19.3",
"countries-list": "^2.5.4",
Expand Down
10 changes: 8 additions & 2 deletions scripts/wikiCandidates.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ async function run() {
.filter(d => d.nodeType !== 3)
.forEach((column, i) => {
const header = headers[i + colOffset]
.replace(/<br[^>]*>/g, " ");
.replace(/<br[^>]*>/g, " ")
.replace(/\<.*$/g, "");
let data = column;
while (data.querySelector(".cx-segment") || data.querySelector(".cx-link")) {
data = data.querySelector(".cx-segment") || data.querySelector(".cx-link");
Expand All @@ -69,6 +70,11 @@ async function run() {
else if (header === "Image") {
obj[header] = `https:${data.querySelector("img").getAttribute("src")}`;
}
else if (header === "Portrait") {
if (data.querySelector("img")) {
obj.Image = `https:${data.querySelector("img").getAttribute("src")}`;
}
}
else if (header === "Term up") {
obj[header] = data.innerHTML.slice(0, 4);
}
Expand All @@ -82,7 +88,7 @@ async function run() {
const ref = JSON.parse(column.querySelector(".mw-ref").getAttribute("data-mw"));
if (ref.parts && ref.parts[0].template.params["1"]) {
obj.note = ref.parts[0].template.params["1"]
.wt.split("<ref>")[0]
.wt.replace(/\<.*$/g, "")
.replace(/\[\[/g, "")
.replace(/\]\]/g, "");
}
Expand Down
Loading

0 comments on commit 0784191

Please sign in to comment.