-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from mediumroast/v0.7_competitive_similarity
V0.7 competitive similarity
- Loading branch information
Showing
44 changed files
with
4,419 additions
and
3,932 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
node_modules/ | ||
.DS_Store | ||
*.py | ||
test.js | ||
test*.* | ||
companies.json | ||
sample_pdf/ | ||
sample_pdf/ | ||
foo*.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const mrMarkdownBuilder = require('mr_markdown_builder') | ||
|
||
// Globals | ||
const MAPS_WARNING = `**Notice:** If you are using Safari and had previously disabled \`Prevent cross-site tracking\` feature in the \`Privacy tab\` in Safari's preferences, you can now reenable it since this bug has been fixed by GitHub.${mrMarkdownBuilder.cr()}${mrMarkdownBuilder.cr()}` | ||
|
||
function createCompaniesMap (companies) { | ||
// Filter out companies with unknown latitude or longitude | ||
companies = companies.filter((company) => company.latitude !== 'Unknown' && company.longitude !== 'Unknown') | ||
// Create the map | ||
let map = mrMarkdownBuilder.h1('Company Locations') | ||
map += MAPS_WARNING | ||
map += mrMarkdownBuilder.geojson({ | ||
type: 'FeatureCollection', | ||
features: companies.map((company) => { | ||
return { | ||
type: 'Feature', | ||
geometry: { | ||
type: 'Point', | ||
coordinates: [company.longitude, company.latitude] | ||
}, | ||
properties: { | ||
name: company.name, | ||
description: company.description, | ||
role: company.role, | ||
url: company.url | ||
} | ||
} | ||
}) | ||
}) | ||
// return the map | ||
return mrMarkdownBuilder.cr() + map | ||
} | ||
|
||
function createCompaniesReport (companies) { | ||
let readme = `[${mrMarkdownBuilder.link('Back to main README', '../README.md')}]\n` | ||
readme += mrMarkdownBuilder.hr() | ||
readme += mrMarkdownBuilder.h1('Introduction') | ||
readme += `There are currently \`${companies.length}\` companies in the repository. The table below lists all available companies and some of their firmographics. Click on the company name to view the company's profile. Below the table is a map of all companies in the repository. Click on a company's marker to view additional company information in context.` | ||
readme += mrMarkdownBuilder.h1('Table of Companies') | ||
// Create the table header | ||
const tableHeader = mrMarkdownBuilder.tableHeader(['Company Name', 'Company Type', 'Company Role', 'Company Region']) | ||
// Create the table rows | ||
const tableRows = companies.map((company) => { | ||
const companyRow = [ | ||
mrMarkdownBuilder.link(company.name, `./${encodeURI(company.name.replace(/[\s,.\?!]/g, ''))}.md`), | ||
company.company_type, | ||
company.role, | ||
company.region | ||
] | ||
return companyRow | ||
}) | ||
// Create the table | ||
const companyTable = tableHeader + "\n" + mrMarkdownBuilder.tableRows(tableRows) | ||
// Create the README.md file | ||
readme += companyTable | ||
// Add a line break | ||
readme += mrMarkdownBuilder.cr() + mrMarkdownBuilder.hr() | ||
// Call the createMap function | ||
readme += mrMarkdownBuilder.cr() + createCompaniesMap(companies) | ||
// Return the file content | ||
return readme | ||
|
||
} | ||
|
||
module.exports = { | ||
createCompaniesReport | ||
} |
Oops, something went wrong.