Commit 0fe0dea3 authored by Aral Balkan's avatar Aral Balkan
Browse files

Add hardcoded linkify script

parent 96376a4b
# Basic script that currently generates links for trackers that we’ve
# already handled. Hardcoded for alexa-top-500-news list.
Promise = require 'bluebird'
fs = Promise.promisifyAll(require 'fs-extra')
path = require 'path-extra'
trackersPath = path.join path.homedir(), '', 'content', 'trackers'
indexPath = path.join trackersPath, 'alexa-top-500-news', ''
fileWithLinks = ''
fs.readFileAsync indexPath, 'utf-8'
.then (file) ->
fileWithLinks = file
for line in file.split "\n"
domain = line.replace /^\d+?\. (.*?) .*?$/, '$1'
pathForTracker = path.join trackersPath, domain
if fs.existsSync pathForTracker
lineWithLink = line.replace domain, "[#{domain}](/trackers/#{domain}/)"
# console.log lineWithLink
fileWithLinks = fileWithLinks.replace line, lineWithLink
console.log fileWithLinks
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment