Skip to content

Commit

Permalink
Update markdown-template.js
Browse files Browse the repository at this point in the history
  • Loading branch information
gayanvoice committed Jun 18, 2021
1 parent 32d039e commit 4b91a67
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"devMode": "true",
"advancedMode": "false",
"advancedMode": "true",
"language": "en-US",
"repository": [
"android-vpn-client-ics-openvpn",
Expand Down
38 changes: 31 additions & 7 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

38 changes: 31 additions & 7 deletions src/helper/readme/markdown-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,34 @@ let markdownTemplate = function () {
return `\n`
}
}
let rowComponent = function (views) {
let row = `| Last Updated | Unique | Count |\n | ------------ | --------------- | ----- |\n`;
let createRepositoryPageTableComponent = function (views) {
let table = `<table>\n`;
table = table + `\t<tr>\n`;
table = table + `\t\t<th>\n`;
table = table + `\t\t\tLast Updated\n`;
table = table + `\t\t</th>\n`;
table = table + `\t\t<th>\n`;
table = table + `\t\t\tUnique\n`;
table = table + `\t\t</th>\n`;
table = table + `\t\t<th>\n`;
table = table + `\t\t\tCount\n`;
table = table + `\t\t</th>\n`;
table = table + `\t</tr>\n`;
for (const view of views.reverse()) {
row = `${row} | \`${view.timestamp.getFullYear()}/${view.timestamp.getMonth() + 1}/${view.timestamp.getDate()}\` | \`${view.uniques}\` | \`${view.count}\` |\n`;
table = table + `\t<tr>\n`;
table = table + `\t\t<td>\n`;
table = table + `\t\t\t<code>${view.timestamp.getFullYear()}/${view.timestamp.getMonth() + 1}/${view.timestamp.getDate()}</code>\n`;
table = table + `\t\t</td>\n`;
table = table + `\t\t<td>\n`;
table = table + `\t\t\t<code>${view.uniques}</code>\n`;
table = table + `\t\t</td>\n`;
table = table + `\t\t<td>\n`;
table = table + `\t\t\t<code>${view.count}</code>\n`;
table = table + `\t\t</td>\n`;
table = table + `\t</tr>\n`;
}
row = row + `\n\n`
return row;
table = table + `</table>\n\n`;
return table;
}
let repositoryPage = async function (ACTION_NAME, ACTION_URL, AUTHOR_NAME, AUTHOR_URL, views, file, response, request) {
let insightsRepositoryUrl = `https://github.com/${response.ownerLogin}/${request.insightsRepository}`;
Expand All @@ -117,8 +138,11 @@ let markdownTemplate = function () {
markdown = markdown + menuComponent(request, readmeUrl);
markdown = markdown + `### :octocat: ${repositoryName}\n`;
markdown = markdown + `${chart}\n\n`;
markdown = markdown + `**:calendar: ${file} Insights Table**\n`;
markdown = markdown + rowComponent(views);
markdown = markdown + `<details>\n`;
markdown = markdown + `\t<summary>Click to expand table</summary>\n`;
markdown = markdown + `\t<h2>:calendar: ${file} Page Views Table</h2>\n`;
markdown = markdown + createRepositoryPageTableComponent(views);
markdown = markdown + `</details>\n`;
markdown = markdown + `<small><i>Last updated on ${getDate()}</i></small>\n\n`;
markdown = markdown + `## ✂️Copy and 📋 Paste\n`;
markdown = markdown + `### SVG Badge\n`;
Expand Down

0 comments on commit 4b91a67

Please sign in to comment.