Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new contribution #2992

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions _haikus/2024_kosu
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout : haiku
title: Open SOurce
author : Kousthubh Yadavalli
---

Heyy there guys this is kousthubh , i have now made my first open source contribution
This is the beginning of a new journey
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"remark-frontmatter": "^1.3.2",
"strip-markdown": "^3.1.1",
"syllable": "^4.0.0",
"tap": "^14.6.9",
"tap": "^14.11.0",
"to-vfile": "^6.0.0",
"yaml": "^1.7.0"
}
Expand Down
22 changes: 11 additions & 11 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ const fs = require('fs')
const dir = './_haikus/'
const blockList = ['haikus.md']

const files = fs.readdirSync(dir)
const files = fs.readdirSync(dir);

files.forEach(async (file) => {
if (!blockList.includes(file)) {
const [text, meta] = await processMarkdown(dir + file)
const lines = text.split('\n').filter((line) => line !== '')

if (meta.test !== false) {
validateHaiku(file, lines, meta)
validateHaiku(file, lines, meta);
}
}
})
Expand All @@ -33,9 +33,9 @@ function processMarkdown(filename) {
.use(strip)
.process(vfile.readSync(filename), (err, file) => {
if (err) {
reject(err)
reject(err);
} else {
resolve([file.toString(), file.data])
resolve([file.toString(), file.data]);
}
})
})
Expand All @@ -44,7 +44,7 @@ function processMarkdown(filename) {
function validateHaiku(filename, lines, meta) {
describe(filename, () => {
it("should have a '.md' file extension", () => {
assert.ok(/\.md$/.test(filename), "extension does not match '.md'")
assert.ok(/\.md$/.test(filename), "extension does not match '.md'");
})

describe('file metadata', () => {
Expand All @@ -57,29 +57,29 @@ function validateHaiku(filename, lines, meta) {
})

it('should have non-blank title', () => {
assert.equal(typeof meta.title, 'string', 'title metadata is missing')
assert.equal(typeof meta.title, 'string', 'title metadata is missing');
})

it('should have non-blank author', () => {
assert.equal(typeof meta.author, 'string', 'author metadata is missing')
assert.equal(typeof meta.author, 'string', 'author metadata is missing');
})
})

describe('haiku structure', () => {
it('should have three lines', () => {
assert.equal(lines.length, 3)
assert.equal(lines.length, 3);
})

it('should have five syllables on the first line', () => {
assert.equal(syllable(lines[0]), 5)
assert.equal(syllable(lines[0]), 5);
})

it('should have seven syllables on the second line', () => {
assert.equal(syllable(lines[1]), 7)
assert.equal(syllable(lines[1]), 7);
})

it('should have five syllables on the third line', () => {
assert.equal(syllable(lines[2]), 5)
assert.equal(syllable(lines[2]), 5);
})
})
})
Expand Down
Loading