Skip to content

Commit

Permalink
feat: add stats via badges (#11)
Browse files Browse the repository at this point in the history
* feat: add stats to each year and in total

* feat: make numeric data bold

* feat: add marked to create custom HTML

* test: update snapshots and test cases
  • Loading branch information
lirantal authored Nov 19, 2021
1 parent 85684a9 commit 0ea27bc
Show file tree
Hide file tree
Showing 13 changed files with 276 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ date: 2019-09-12
tags: post
name: APIdays Barcelona
url: https://www.apidays.co/barcelona2019/
type: conference
type: webinar
title: 'Consumer-Driven Contracts: A better approach for API Testing'
slides_url: https://slides.com/lirantal/consumer-driven-contracts
recording_url: https://www.youtube.com/watch?v=zfGKX5iKSis&list=PLmEaqnTJ40Oqo9VlbcUakVmFZgx5weLrs&index=25&t=141s&ab_channel=apidays
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
date: 2019-09-15
tags: post
name: JSConf Budapest
url: https://2019.jsconfbp.com/
type: podcast
title: 'StrangerDanger: Finding Security Vulnerabilities Before They Find You!'
slides_url:
recording_url: https://www.youtube.com/watch?v=3H8pF6yoSgU&list=PL37ZVnwpeshEMCvdYDdZ09Sy-toTftWu0&index=15&ab_channel=JSConf
city: Budapest
country: Hungary
country_code: HU
language: English
recognitions:
twitter:
- https://twitter.com/panay_georgiou/status/1177572765664194560
image_header: https://pbs.twimg.com/media/EFeULhIW4AARwZa?format=jpg&name=large
images:
- https://pbs.twimg.com/media/EFeULhIW4AARwZa?format=jpg&name=large
---
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ date: 2019-09-27
tags: post
name: JSConf Budapest
url: https://2019.jsconfbp.com/
type: conference
type: meetup
title: 'StrangerDanger: Finding Security Vulnerabilities Before They Find You!'
slides_url:
recording_url: https://www.youtube.com/watch?v=3H8pF6yoSgU&list=PL37ZVnwpeshEMCvdYDdZ09Sy-toTftWu0&index=15&ab_channel=JSConf
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
date: 2021-01-01
tags: post
name: Cyber Week
url: https://cw2021.b2b-wizard.com/expo
type: other
title: Are We Forever Doomed By Software Supply Chain Risks?
slides_url:
recording_url: https://www.youtube.com/watch?v=x74sMCaZKbg&ab_channel=Snyk
city: Tel Aviv
country: Israel
country_code: IL
language: English
recognitions:
twitter:
- https://twitter.com/liran_tal/status/1417874639859109894
image_header:
images:
-
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
date: 2021-06-13
tags: post
name: Cyber Week
url: https://cw2021.b2b-wizard.com/expo
type: article
title: Are We Forever Doomed By Software Supply Chain Risks?
slides_url:
recording_url: https://www.youtube.com/watch?v=x74sMCaZKbg&ab_channel=Snyk
city: Tel Aviv
country: Israel
country_code: IL
language: English
recognitions:
twitter:
- https://twitter.com/liran_tal/status/1417874639859109894
image_header:
images:
-
---
34 changes: 24 additions & 10 deletions __tests__/__snapshots__/main.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,65 +1,79 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`given a directory of markdown files a full document is rendered 1`] = `
"# Table of Contents
"<div align='center'><p><img src=\\"https://img.shields.io/badge/total-6-blue?style=flat-square\\" alt=\\"Total Events\\"> <img src=\\"https://img.shields.io/badge/meetups-1-violet?style=flat-square\\" alt=\\"Total Meetups\\"> <img src=\\"https://img.shields.io/badge/conferences-1-red?style=flat-square\\" alt=\\"Total Conferences\\"> <img src=\\"https://img.shields.io/badge/podcasts-1-yellow?style=flat-square\\" alt=\\"Total Podcasts\\"> <img src=\\"https://img.shields.io/badge/webinars-1-lightgrey?style=flat-square\\" alt=\\"Total Webinars\\"> <img src=\\"https://img.shields.io/badge/articles-1-green?style=flat-square\\" alt=\\"Total Podcasts\\"></p>
</div>
# Table of Contents
- [Events in 2021](#2021)
- [Events in 2019](#2019)
- [Year of 2021](#2021) - total events 3
- [Year of 2019](#2019) - total events 3
# 2021
[1] total events for 2021
![Total Events](https://img.shields.io/badge/total-3-blue?style=flat-square) ![Total Conferences](https://img.shields.io/badge/conferences-1-red?style=flat-square) ![Total Podcasts](https://img.shields.io/badge/articles-1-green?style=flat-square)
| Date | Event | Title | Slides | Recording | Location | Language |
| ---- | ----- | ----- | ------ | --------- | -------- | -------- |
| 2021-7-21 | Cyber Week | Are We Forever Doomed By Software Supply Chain Risks? | | [Recording](https://www.youtube.com/watch?v=x74sMCaZKbg&ab_channel=Snyk) | IL | English |
| 2021-6-13 | Cyber Week | Are We Forever Doomed By Software Supply Chain Risks? | | [Recording](https://www.youtube.com/watch?v=x74sMCaZKbg&ab_channel=Snyk) | IL | English |
| 2021-1-1 | Cyber Week | Are We Forever Doomed By Software Supply Chain Risks? | | [Recording](https://www.youtube.com/watch?v=x74sMCaZKbg&ab_channel=Snyk) | IL | English |
# 2019
[2] total events for 2019
![Total Events](https://img.shields.io/badge/total-3-blue?style=flat-square) ![Total Meetups](https://img.shields.io/badge/meetups-1-violet?style=flat-square) ![Total Podcasts](https://img.shields.io/badge/podcasts-1-yellow?style=flat-square) ![Total Webinars](https://img.shields.io/badge/webinars-1-lightgrey?style=flat-square)
| Date | Event | Title | Slides | Recording | Location | Language |
| ---- | ----- | ----- | ------ | --------- | -------- | -------- |
| 2019-9-27 | JSConf Budapest | StrangerDanger: Finding Security Vulnerabilities Before They Find You! | | [Recording](https://www.youtube.com/watch?v=3H8pF6yoSgU&list=PL37ZVnwpeshEMCvdYDdZ09Sy-toTftWu0&index=15&ab_channel=JSConf) | HU | English |
| 2019-9-15 | JSConf Budapest | StrangerDanger: Finding Security Vulnerabilities Before They Find You! | | [Recording](https://www.youtube.com/watch?v=3H8pF6yoSgU&list=PL37ZVnwpeshEMCvdYDdZ09Sy-toTftWu0&index=15&ab_channel=JSConf) | HU | English |
| 2019-9-12 | APIdays Barcelona | Consumer-Driven Contracts: A better approach for API Testing | [Slides](https://slides.com/lirantal/consumer-driven-contracts) | [Recording](https://www.youtube.com/watch?v=zfGKX5iKSis&list=PLmEaqnTJ40Oqo9VlbcUakVmFZgx5weLrs&index=25&t=141s&ab_channel=apidays) | ES | English |
"
`;
exports[`given a directory of markdown files a full document is rendered along with pre and post content 1`] = `
"<p> actual html is allowed too </p>
"<div align='center'><p><img src=\\"https://img.shields.io/badge/total-6-blue?style=flat-square\\" alt=\\"Total Events\\"> <img src=\\"https://img.shields.io/badge/meetups-1-violet?style=flat-square\\" alt=\\"Total Meetups\\"> <img src=\\"https://img.shields.io/badge/conferences-1-red?style=flat-square\\" alt=\\"Total Conferences\\"> <img src=\\"https://img.shields.io/badge/podcasts-1-yellow?style=flat-square\\" alt=\\"Total Podcasts\\"> <img src=\\"https://img.shields.io/badge/webinars-1-lightgrey?style=flat-square\\" alt=\\"Total Webinars\\"> <img src=\\"https://img.shields.io/badge/articles-1-green?style=flat-square\\" alt=\\"Total Podcasts\\"></p>
</div>
<p> actual html is allowed too </p>
Liran Tal
# Table of Contents
- [Events in 2021](#2021)
- [Events in 2019](#2019)
- [Year of 2021](#2021) - total events 3
- [Year of 2019](#2019) - total events 3
# 2021
[1] total events for 2021
![Total Events](https://img.shields.io/badge/total-3-blue?style=flat-square) ![Total Conferences](https://img.shields.io/badge/conferences-1-red?style=flat-square) ![Total Podcasts](https://img.shields.io/badge/articles-1-green?style=flat-square)
| Date | Event | Title | Slides | Recording | Location | Language |
| ---- | ----- | ----- | ------ | --------- | -------- | -------- |
| 2021-7-21 | Cyber Week | Are We Forever Doomed By Software Supply Chain Risks? | | [Recording](https://www.youtube.com/watch?v=x74sMCaZKbg&ab_channel=Snyk) | IL | English |
| 2021-6-13 | Cyber Week | Are We Forever Doomed By Software Supply Chain Risks? | | [Recording](https://www.youtube.com/watch?v=x74sMCaZKbg&ab_channel=Snyk) | IL | English |
| 2021-1-1 | Cyber Week | Are We Forever Doomed By Software Supply Chain Risks? | | [Recording](https://www.youtube.com/watch?v=x74sMCaZKbg&ab_channel=Snyk) | IL | English |
# 2019
[2] total events for 2019
![Total Events](https://img.shields.io/badge/total-3-blue?style=flat-square) ![Total Meetups](https://img.shields.io/badge/meetups-1-violet?style=flat-square) ![Total Podcasts](https://img.shields.io/badge/podcasts-1-yellow?style=flat-square) ![Total Webinars](https://img.shields.io/badge/webinars-1-lightgrey?style=flat-square)
| Date | Event | Title | Slides | Recording | Location | Language |
| ---- | ----- | ----- | ------ | --------- | -------- | -------- |
| 2019-9-27 | JSConf Budapest | StrangerDanger: Finding Security Vulnerabilities Before They Find You! | | [Recording](https://www.youtube.com/watch?v=3H8pF6yoSgU&list=PL37ZVnwpeshEMCvdYDdZ09Sy-toTftWu0&index=15&ab_channel=JSConf) | HU | English |
| 2019-9-15 | JSConf Budapest | StrangerDanger: Finding Security Vulnerabilities Before They Find You! | | [Recording](https://www.youtube.com/watch?v=3H8pF6yoSgU&list=PL37ZVnwpeshEMCvdYDdZ09Sy-toTftWu0&index=15&ab_channel=JSConf) | HU | English |
| 2019-9-12 | APIdays Barcelona | Consumer-Driven Contracts: A better approach for API Testing | [Slides](https://slides.com/lirantal/consumer-driven-contracts) | [Recording](https://www.youtube.com/watch?v=zfGKX5iKSis&list=PLmEaqnTJ40Oqo9VlbcUakVmFZgx5weLrs&index=25&t=141s&ab_channel=apidays) | ES | English |
Expand Down
14 changes: 10 additions & 4 deletions __tests__/__snapshots__/md-formatter.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ exports[`process events json data to provide a complete markdown document 1`] =
"# Table of Contents
- [Events in 2016](#2016)
- [Events in 2021](#2021)
- [Year of 2016](#2016) - total events 1
- [Year of 2021](#2021) - total events 6
# 2016
[1] total events for 2016
![Total Events](https://img.shields.io/badge/total-1-blue?style=flat-square)
| Date | Event | Title | Slides | Recording | Location | Language |
| ---- | ----- | ----- | ------ | --------- | -------- | -------- |
Expand All @@ -28,12 +29,17 @@ exports[`process events json data to provide a complete markdown document 1`] =
# 2021
[2] total events for 2021
![Total Events](https://img.shields.io/badge/total-6-blue?style=flat-square) ![Total Meetups](https://img.shields.io/badge/meetups-1-violet?style=flat-square) ![Total Conferences](https://img.shields.io/badge/conferences-1-red?style=flat-square) ![Total Podcasts](https://img.shields.io/badge/podcasts-1-yellow?style=flat-square) ![Total Webinars](https://img.shields.io/badge/webinars-2-lightgrey?style=flat-square) ![Total Podcasts](https://img.shields.io/badge/articles-1-green?style=flat-square)
| Date | Event | Title | Slides | Recording | Location | Language |
| ---- | ----- | ----- | ------ | --------- | -------- | -------- |
| 2021-2-1 | name | title | [Slides](https://example.com) | | | English |
| 2021-2-2 | name | title | | [Recording](https://example.com) | US | English |
| 2021-2-2 | name | title | | [Recording](https://example.com) | US | English |
| 2021-2-2 | name | title | | [Recording](https://example.com) | US | English |
| 2021-2-2 | name | title | | [Recording](https://example.com) | US | English |
| 2021-2-2 | name | title | | [Recording](https://example.com) | US | English |
"
Expand Down
66 changes: 64 additions & 2 deletions __tests__/md-formatter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ test('process events json data to provide a complete markdown document', () => {
language: null
}
}
]
],
stats: {
total: 1
}
},
{
year: 2021,
Expand All @@ -38,6 +41,7 @@ test('process events json data to provide a complete markdown document', () => {
attributes: {
date: new Date('2021-02-01'),
title: 'title',
type: 'conference',
name: 'name',
slides_url: 'https://example.com',
recording_url: null,
Expand All @@ -49,14 +53,72 @@ test('process events json data to provide a complete markdown document', () => {
attributes: {
date: new Date('2021-02-02'),
title: 'title',
type: 'meetup',
name: 'name',
slides_url: null,
recording_url: 'https://example.com',
country_code: 'US',
language: 'English'
}
},
{
attributes: {
date: new Date('2021-02-02'),
title: 'title',
type: 'podcast',
name: 'name',
slides_url: null,
recording_url: 'https://example.com',
country_code: 'US',
language: 'English'
}
},
{
attributes: {
date: new Date('2021-02-02'),
title: 'title',
type: 'article',
name: 'name',
slides_url: null,
recording_url: 'https://example.com',
country_code: 'US',
language: 'English'
}
},
{
attributes: {
date: new Date('2021-02-02'),
title: 'title',
type: 'webinar',
name: 'name',
slides_url: null,
recording_url: 'https://example.com',
country_code: 'US',
language: 'English'
}
},
{
attributes: {
date: new Date('2021-02-02'),
title: 'title',
type: 'webinar',
name: 'name',
slides_url: null,
recording_url: 'https://example.com',
country_code: 'US',
language: 'English'
}
}
]
],
stats: {
total: 6,
total_podcast: 1,
total_conference: 1,
total_webinar: 2,
total_meetup: 1,
total_article: 1,
total_other: 0
}
}
]

Expand Down
9 changes: 3 additions & 6 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"dependencies": {
"ajv": "^8.6.3",
"front-matter": "^4.0.2",
"json2md": "^1.12.0"
"json2md": "^1.12.0",
"marked": "^2.1.3"
},
"devDependencies": {
"@babel/core": "^7.15.8",
Expand Down
Loading

0 comments on commit 0ea27bc

Please sign in to comment.