Skip to content

Commit 61a4574

Browse files
committed
Add smart quotes
1 parent cc1d147 commit 61a4574

File tree

20 files changed

+32
-22
lines changed

20 files changed

+32
-22
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"normalize-url": "~1.9.1",
3030
"req-all": "~1.0.0",
3131
"sanitize-html": "~1.14.1",
32+
"smartquotes": "~2.1.2",
3233
"to-title-case": "~1.0.0",
3334
"url-regex": "~4.1.1"
3435
},

src/get-data/rules/description.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const condenseWhitespace = require('condense-whitespace')
44
const isString = require('lodash.isstring')
5+
const smartquotes = require('smartquotes')
56
const flow = require('lodash.flow')
67

78
const REGEX_LOCATION = /^[A-Z\s]+\s+[-]\s+/
@@ -13,7 +14,8 @@ const sanetize = flow([
1314
condenseWhitespace,
1415
// if it starts with a location, like articles sometimes do in the opening
1516
// paragraph, try to remove it
16-
removeLocation
17+
removeLocation,
18+
smartquotes
1719
])
1820

1921
/**

src/get-data/rules/title.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
'use strict'
22

3-
const isString = require('lodash.isstring')
43
const condenseWhitespace = require('condense-whitespace')
4+
const isString = require('lodash.isstring')
5+
const smartquotes = require('smartquotes')
6+
const flow = require('lodash.flow')
7+
8+
const sanetize = flow([
9+
condenseWhitespace,
10+
smartquotes
11+
])
512

613
function wrap (rule) {
714
return ($) => {
815
const value = rule($)
916

1017
if (!isString(value)) return
11-
return condenseWhitespace(value)
18+
return sanetize(value)
1219
}
1320
}
1421

test/web/astier/output.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"author": "Anisse Astier",
33
"date": "2017-07-05T00:00:00.000Z",
4-
"description": "In which I babble about some projects I do and I rant about stuff I like. I'm working as a Linux Kernel engineer as a day job, and I probably play too much video games on my free time.",
4+
"description": "In which I babble about some projects I do and I rant about stuff I like. Im working as a Linux Kernel engineer as a day job, and I probably play too much video games on my free time.",
55
"image": "https://anisse.astier.eu/images/anisse.jpg",
66
"publisher": null,
7-
"title": "Linux Engineer's random thoughts - awk driven IoT",
7+
"title": "Linux Engineers random thoughts - awk driven IoT",
88
"url": "https://anisse.astier.eu/awk-driven-iot.html"
99
}

test/web/cloud-pro/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"description": "The services will enable Sabre to provide its software, data, mobile and distribution solutions to more travel companies",
55
"image": "http://cdn2.cloudpro.co.uk/sites/cloudprod7/files/4/29/handshake_0.jpg",
66
"publisher": "Cloud Pro",
7-
"title": "Sabre selects Virtustream's IaaS and managed services",
7+
"title": "Sabre selects Virtustreams IaaS and managed services",
88
"url": "http://www.cloudpro.co.uk/go/6024"
99
}

test/web/cnet/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"description": "Smartwatches with heart rate support, plus a stand-alone puck called Core that acts as a 3G-connected smart button: Pebble is trying for a two-device approach in fitness wearables.",
55
"image": "https://cnet3.cbsistatic.com/hub/i/r/2016/05/23/ee9a228a-d1d9-40b3-b401-4ba0e07e2fce/thumbnail/670x503/90dc7a2315faa0f311e2e8f43e578847/pebblecore3.jpg",
66
"publisher": "CNET",
7-
"title": "Pebble 2, Pebble Time 2, Pebble Core: Pebble's fitness hat trick adds heart rate, GPS, Spotify, and 3G",
7+
"title": "Pebble 2, Pebble Time 2, Pebble Core: Pebbles fitness hat trick adds heart rate, GPS, Spotify, and 3G",
88
"url": "http://www.cnet.com/news/pebble-2-pebble-time-2-pebble-core-announced-coming-this-year-and-2017"
99
}

test/web/entrepreneur/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Reuters",
33
"date": "2016-05-04T15:40:00.000Z",
4-
"description": "'One of the big causes for the stagnation of middle class wages is essentially because of clever computer programs,' said David Siegel, co-chairman of Two Sigma.",
4+
"description": "One of the big causes for the stagnation of middle class wages is essentially because of clever computer programs, said David Siegel, co-chairman of Two Sigma.",
55
"image": "https://assets.entrepreneur.com/content/3x2/1300/20160504155601-GettyImages-174457162.jpeg",
66
"publisher": "Entrepreneur",
77
"title": "The Rich and Powerful Warn That Robots Are Coming for Our Jobs",

test/web/et-tech/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"description": "Dell speaks about the complexities of engineering the biggest acquisition in tech history, Dell’s future bets and why he continues to remain bullish..",
55
"image": "http://economictimes.indiatimes.com/photo/michael-dell-on-complexities-involved-in-pulling-off-the-biggest-tech-acquisition-dell-s-future-bets-more/52424992.cms",
66
"publisher": "ETtech.com",
7-
"title": "Michael Dell on complexities involved in pulling off the biggest tech acquisition, Dell's future bets & more | ETtech",
7+
"title": "Michael Dell on complexities involved in pulling off the biggest tech acquisition, Dells future bets & more | ETtech",
88
"url": "http://tech.economictimes.indiatimes.com/news/corporate/michael-dell-biggest-tech-acquisition-future-bets/52424992"
99
}

test/web/inc/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"description": "The Chicago-based Neurensic uses artificial intelligence to make sure futures traders remain in compliance.",
55
"image": "http://images.inc.com/uploaded_files/image/970x450/30U30-2016-Neurensic-pano_90455.jpg",
66
"publisher": "Inc.com",
7-
"title": "Meet Wall Street's New A.I. Sheriffs",
7+
"title": "Meet Wall Streets New A.I. Sheriffs",
88
"url": "http://www.inc.com/jeremy-quittner/2016-30-under-30-neurensic.html"
99
}

test/web/los-angeles-times/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "Los Angeles Times",
33
"date": "2016-04-30T00:00:00.000Z",
4-
"description": "Tech start-up Appthority's office has plush conference rooms, soundproof phone booths, an enormous kitchen and a view of San Francisco Bay. It has ping-pong and foosball tables, beer on tap and 11 types of tea.",
4+
"description": "Tech start-up Appthoritys office has plush conference rooms, soundproof phone booths, an enormous kitchen and a view of San Francisco Bay. It has ping-pong and foosball tables, beer on tap and 11 types of tea.",
55
"image": "http://www.trbimg.com/img-572421a4/turbine/la-fi-tn-tech-downturn-20160429",
66
"publisher": "latimes.com",
77
"title": "As venture capital dries up, tech start-ups discover frugality",

0 commit comments

Comments
 (0)