From d8275797f2c40d32943264b46bf03e5d32b3677c Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 00:10:21 +0530
Subject: [PATCH 1/9] Create 2023_bug.md
---
_haikus/2023_bug.md | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 _haikus/2023_bug.md
diff --git a/_haikus/2023_bug.md b/_haikus/2023_bug.md
new file mode 100644
index 000000000..1a4e04bd7
--- /dev/null
+++ b/_haikus/2023_bug.md
@@ -0,0 +1,9 @@
+---
+layout: haiku
+title: Bug
+author: upendranayanajith
+---
+
+Bug in the code,
+Comment it out, forget it,
+Until code will break again.
\ No newline at end of file
From 6a09fa23c39eee1d66ed7b0eb94c1f7119a142e7 Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 00:25:28 +0530
Subject: [PATCH 2/9] first_contribution
---
_haikus/{2023_bug.md => 2023_Bugs.md} | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename _haikus/{2023_bug.md => 2023_Bugs.md} (79%)
diff --git a/_haikus/2023_bug.md b/_haikus/2023_Bugs.md
similarity index 79%
rename from _haikus/2023_bug.md
rename to _haikus/2023_Bugs.md
index 1a4e04bd7..7a251037f 100644
--- a/_haikus/2023_bug.md
+++ b/_haikus/2023_Bugs.md
@@ -1,7 +1,7 @@
---
layout: haiku
title: Bug
-author: upendranayanajith
+author: Upendra Nayanajith
---
Bug in the code,
From f2e270c92b8b630455dfa784950b8d3deacc2332 Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 00:39:06 +0530
Subject: [PATCH 3/9] Create 2023_Love_Hate.md
---
_haikus/2023_Love_Hate.md | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 _haikus/2023_Love_Hate.md
diff --git a/_haikus/2023_Love_Hate.md b/_haikus/2023_Love_Hate.md
new file mode 100644
index 000000000..bc7efa13e
--- /dev/null
+++ b/_haikus/2023_Love_Hate.md
@@ -0,0 +1,9 @@
+---
+layout: haiku
+title: Love-Hate
+author: Upendra Nayanajith
+---
+
+Love and hate entwined,
+Like fire and ice combined,
+Two sides of the same mind.
\ No newline at end of file
From 57f95a8c96d75ba4df86455e632b1d18313aaa68 Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 00:44:07 +0530
Subject: [PATCH 4/9] My_contribution
---
_haikus/{2023_Love_Hate.md => 2023_Love_&_Hate.md} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename _haikus/{2023_Love_Hate.md => 2023_Love_&_Hate.md} (100%)
diff --git a/_haikus/2023_Love_Hate.md b/_haikus/2023_Love_&_Hate.md
similarity index 100%
rename from _haikus/2023_Love_Hate.md
rename to _haikus/2023_Love_&_Hate.md
From 8c551fe656deea49ff7048abdce01f08ccddb4fa Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 01:09:40 +0530
Subject: [PATCH 5/9] My contribution 00
---
_haikus/2023_love/Hate | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 _haikus/2023_love/Hate
diff --git a/_haikus/2023_love/Hate b/_haikus/2023_love/Hate
new file mode 100644
index 000000000..fba7deb29
--- /dev/null
+++ b/_haikus/2023_love/Hate
@@ -0,0 +1,9 @@
+---
+layout: haiku
+title: Love-Hate
+author: Upendra Nayanajith
+---
+
+Love and hate entwined
+Like fire and ice combined
+Two sides of the same mind
\ No newline at end of file
From 25abe927e071032ea0a481f89571fb790d64ae8a Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 01:20:58 +0530
Subject: [PATCH 6/9] My contribution 00
---
test.js => node test.js | 30 +++++++++++++++---------------
package.json | 4 ++--
2 files changed, 17 insertions(+), 17 deletions(-)
rename test.js => node test.js (80%)
diff --git a/test.js b/node test.js
similarity index 80%
rename from test.js
rename to node test.js
index bdfc670c0..eb69f93ba 100644
--- a/test.js
+++ b/node test.js
@@ -1,6 +1,6 @@
require('tap').mochaGlobals()
const assert = require('assert')
-const remark = require('remark')
+import remark from 'remark'
const frontmatter = require('remark-frontmatter')
const extract = require('remark-extract-frontmatter')
const yaml = require('yaml').parse
@@ -25,19 +25,19 @@ files.forEach(async (file) => {
}
})
-function processMarkdown(filename) {
+async function processMarkdown(filename) {
return new Promise((resolve, reject) => {
remark()
- .use(frontmatter)
- .use(extract, { yaml: yaml })
- .use(strip)
- .process(vfile.readSync(filename), (err, file) => {
- if (err) {
- reject(err)
- } else {
- resolve([file.toString(), file.data])
- }
- })
+ .use(frontmatter)
+ .use(extract, { yaml: yaml })
+ .use(strip)
+ .process(vfile.readSync(filename), (err, file) => {
+ if (err) {
+ reject(err)
+ } else {
+ resolve([file.toString(), file.data])
+ }
+ })
})
}
@@ -50,9 +50,9 @@ function validateHaiku(filename, lines, meta) {
describe('file metadata', () => {
it("should have layout equal to 'haiku'", () => {
assert.equal(
- meta.layout,
- 'haiku',
- "layout metadata should equal 'haiku'"
+ meta.layout,
+ 'haiku',
+ "layout metadata should equal 'haiku'"
)
})
diff --git a/package.json b/package.json
index 5c293449d..adfe7e299 100644
--- a/package.json
+++ b/package.json
@@ -2,9 +2,9 @@
"name": "cloud_haiku",
"version": "1.0.0",
"description": "Haiku structure testing for cloud_haiku repo",
- "main": "test.js",
+ "main": "node test.js",
"scripts": {
- "test": "tap test.js -R min --no-coverage-report --timeout=300"
+ "test": "tap node test.js -R min --no-coverage-report --timeout=300"
},
"repository": {
"type": "git",
From e5a8308eff5b283148d515d07945817ebb23d3e7 Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 23:22:19 +0530
Subject: [PATCH 7/9] last_try
---
_haikus/2023_love/{Hate => hate.md} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename _haikus/2023_love/{Hate => hate.md} (100%)
diff --git a/_haikus/2023_love/Hate b/_haikus/2023_love/hate.md
similarity index 100%
rename from _haikus/2023_love/Hate
rename to _haikus/2023_love/hate.md
From 1ceb3c0e049e9d593776ad490c045ee644239ca0 Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 23:35:51 +0530
Subject: [PATCH 8/9] try try
---
node test.js | 86 ------------------------------------------------
package.json | 59 +++++++++++++++++----------------
test.js | 41 +++++++++++++++++++++++
validateHaiku.js | 36 ++++++++++++++++++++
4 files changed, 107 insertions(+), 115 deletions(-)
delete mode 100644 node test.js
create mode 100644 test.js
create mode 100644 validateHaiku.js
diff --git a/node test.js b/node test.js
deleted file mode 100644
index eb69f93ba..000000000
--- a/node test.js
+++ /dev/null
@@ -1,86 +0,0 @@
-require('tap').mochaGlobals()
-const assert = require('assert')
-import remark from 'remark'
-const frontmatter = require('remark-frontmatter')
-const extract = require('remark-extract-frontmatter')
-const yaml = require('yaml').parse
-const strip = require('strip-markdown')
-const vfile = require('to-vfile')
-const syllable = require('syllable')
-const fs = require('fs')
-
-const dir = './_haikus/'
-const blockList = ['haikus.md']
-
-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)
- }
- }
-})
-
-async function processMarkdown(filename) {
- return new Promise((resolve, reject) => {
- remark()
- .use(frontmatter)
- .use(extract, { yaml: yaml })
- .use(strip)
- .process(vfile.readSync(filename), (err, file) => {
- if (err) {
- reject(err)
- } else {
- resolve([file.toString(), file.data])
- }
- })
- })
-}
-
-function validateHaiku(filename, lines, meta) {
- describe(filename, () => {
- it("should have a '.md' file extension", () => {
- assert.ok(/\.md$/.test(filename), "extension does not match '.md'")
- })
-
- describe('file metadata', () => {
- it("should have layout equal to 'haiku'", () => {
- assert.equal(
- meta.layout,
- 'haiku',
- "layout metadata should equal 'haiku'"
- )
- })
-
- it('should have non-blank title', () => {
- 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')
- })
- })
-
- describe('haiku structure', () => {
- it('should have three lines', () => {
- assert.equal(lines.length, 3)
- })
-
- it('should have five syllables on the first line', () => {
- assert.equal(syllable(lines[0]), 5)
- })
-
- it('should have seven syllables on the second line', () => {
- assert.equal(syllable(lines[1]), 7)
- })
-
- it('should have five syllables on the third line', () => {
- assert.equal(syllable(lines[2]), 5)
- })
- })
- })
-}
diff --git a/package.json b/package.json
index adfe7e299..6a6b2a8b3 100644
--- a/package.json
+++ b/package.json
@@ -1,30 +1,31 @@
{
- "name": "cloud_haiku",
- "version": "1.0.0",
- "description": "Haiku structure testing for cloud_haiku repo",
- "main": "node test.js",
- "scripts": {
- "test": "tap node test.js -R min --no-coverage-report --timeout=300"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/do-community/cloud_haiku.git"
- },
- "author": "DigitalOcean Community Team",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/do-community/cloud_haiku/issues"
- },
- "homepage": "https://github.com/do-community/cloud_haiku#readme",
- "dependencies": {
- "node-fetch": "^2.6.1",
- "remark": "^14.0.2",
- "remark-extract-frontmatter": "^2.0.0",
- "remark-frontmatter": "^1.3.2",
- "strip-markdown": "^3.1.1",
- "syllable": "^4.0.0",
- "tap": "^14.6.9",
- "to-vfile": "^6.0.0",
- "yaml": "^1.7.0"
- }
-}
+ "name": "cloud_haiku",
+ "version": "1.0.0",
+ "description": "Haiku structure testing for cloud_haiku repo",
+ "main": "node test.js",
+ "scripts": {
+ "test": "tap node test.js -R min --no-coverage-report --timeout=300"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/do-community/cloud_haiku.git"
+ },
+ "author": "DigitalOcean Community Team",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/do-community/cloud_haiku/issues"
+ },
+ "homepage": "https://github.com/do-community/cloud_haiku#readme",
+ "dependencies": {
+ "append-transform": "^latest",
+ "node-fetch": "^2.6.1",
+ "remark": "^14.0.2",
+ "remark-extract-frontmatter": "^2.0.0",
+ "remark-frontmatter": "^1.3.2",
+ "strip-markdown": "^3.1.1",
+ "syllable": "^4.0.0",
+ "tap": "^14.6.9",
+ "to-vfile": "^6.0.0",
+ "yaml": "^1.7.0"
+ }
+}
\ No newline at end of file
diff --git a/test.js b/test.js
new file mode 100644
index 000000000..6d40a7d10
--- /dev/null
+++ b/test.js
@@ -0,0 +1,41 @@
+const assert = require('assert');
+import remark from 'remark';
+import { validateHaiku } from './validateHaiku';
+const frontmatter = require('remark-frontmatter');
+const extract = require('remark-extract-frontmatter');
+const yaml = require('yaml').parse;
+const strip = require('strip-markdown');
+const vfile = require('to-vfile');
+const fs = require('fs');
+
+const dir = './_haikus/';
+const blockList = ['haikus.md'];
+
+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);
+ }
+ }
+});
+
+async function processMarkdown(filename) {
+ return new Promise((resolve, reject) => {
+ remark()
+ .use(frontmatter)
+ .use(extract, { yaml: yaml })
+ .use(strip)
+ .process(vfile.readSync(filename), (err, file) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve([file.toString(), file.data]);
+ }
+ });
+ });
+}
\ No newline at end of file
diff --git a/validateHaiku.js b/validateHaiku.js
new file mode 100644
index 000000000..6e0da2178
--- /dev/null
+++ b/validateHaiku.js
@@ -0,0 +1,36 @@
+const tap = require('tap');
+const syllable = require('syllable');
+
+export function validateHaiku(filename, lines, meta) {
+ tap.test(filename, () => {
+ tap.test('should have a '.md, ' file extension', () => {
+ tap.ok(/\.md$/.test(filename), 'extension does not match '.md, '');
+ });
+
+ tap.test('file metadata', () => {
+ tap.test('should have layout equal to \'haiku\'', () => {
+ tap.equal(meta.layout, 'haiku', 'layout metadata should equal \'haiku\'');
+ });
+
+ tap.test('should have non-blank title', () => {
+ tap.equal(typeof meta.title, 'string', 'title metadata is missing');
+ });
+
+ tap.test('should have non-blank author', () => {
+ tap.equal(typeof meta.author, 'string', 'author metadata is missing');
+ });
+ });
+
+ tap.test('haiku structure', () => {
+ tap.test('should have three lines', () => {
+ tap.equal(lines.length, 3);
+ });
+
+ tap.test('should have five syllables on the first line', () => {
+ tap.equal(syllable(lines[0]), 5);
+ });
+
+ tap.test('should have seven syllables on the second line', () => {});
+ });
+ });
+}
\ No newline at end of file
From f0149b7c30b28f8d4afe2d0d1c6c64e8a676d306 Mon Sep 17 00:00:00 2001
From: upendra-nayanajith <86357888+upendranayanajith@users.noreply.github.com>
Date: Sun, 29 Oct 2023 23:54:23 +0530
Subject: [PATCH 9/9] tryyyy
---
_haikus/2023_Love_&_Hate.md | 9 ----
_haikus/2023_love/hate.md | 8 ++--
node test.js | 86 +++++++++++++++++++++++++++++++++++++
package.json | 1 -
test.js | 41 ------------------
5 files changed, 90 insertions(+), 55 deletions(-)
delete mode 100644 _haikus/2023_Love_&_Hate.md
create mode 100644 node test.js
delete mode 100644 test.js
diff --git a/_haikus/2023_Love_&_Hate.md b/_haikus/2023_Love_&_Hate.md
deleted file mode 100644
index bc7efa13e..000000000
--- a/_haikus/2023_Love_&_Hate.md
+++ /dev/null
@@ -1,9 +0,0 @@
----
-layout: haiku
-title: Love-Hate
-author: Upendra Nayanajith
----
-
-Love and hate entwined,
-Like fire and ice combined,
-Two sides of the same mind.
\ No newline at end of file
diff --git a/_haikus/2023_love/hate.md b/_haikus/2023_love/hate.md
index fba7deb29..bc7efa13e 100644
--- a/_haikus/2023_love/hate.md
+++ b/_haikus/2023_love/hate.md
@@ -1,9 +1,9 @@
---
layout: haiku
title: Love-Hate
-author: Upendra Nayanajith
+author: Upendra Nayanajith
---
-Love and hate entwined
-Like fire and ice combined
-Two sides of the same mind
\ No newline at end of file
+Love and hate entwined,
+Like fire and ice combined,
+Two sides of the same mind.
\ No newline at end of file
diff --git a/node test.js b/node test.js
new file mode 100644
index 000000000..ebffc3993
--- /dev/null
+++ b/node test.js
@@ -0,0 +1,86 @@
+import { describe, it } from 'mocha'; // Import describe and it from Mocha
+import { assert } from 'chai'; // Import assert from Chai
+import remark from 'remark';
+import frontmatter from 'remark-frontmatter';
+import extract from 'remark-extract-frontmatter';
+import yaml from 'yaml';
+import strip from 'strip-markdown';
+import vfile from 'to-vfile';
+import syllable from 'syllable';
+import fs from 'fs';
+
+const dir = './_haikus/';
+const blockList = ['haikus.md'];
+
+async function processMarkdown(filename) {
+ return new Promise((resolve, reject) => {
+ remark()
+ .use(frontmatter)
+ .use(extract, { yaml })
+ .use(strip)
+ .process(vfile.readSync(filename), (err, file) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve([file.toString(), file.data]);
+ }
+ });
+ });
+}
+
+async function validateHaiku(filename, lines, meta) {
+ describe(filename, () => {
+ it("should have a '.md' file extension", () => {
+ assert.ok(/\.md$/.test(filename), "extension does not match '.md'");
+ });
+
+ describe('file metadata', () => {
+ it("should have layout equal to 'haiku'", () => {
+ assert.equal(meta.layout, 'haiku', "layout metadata should equal 'haiku'");
+ });
+
+ it('should have non-blank title', () => {
+ 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');
+ });
+ });
+
+ describe('haiku structure', () => {
+ it('should have three lines', () => {
+ assert.equal(lines.length, 3);
+ });
+
+ it('should have five syllables on the first line', () => {
+ assert.equal(syllable(lines[0]), 5);
+ });
+
+ it('should have seven syllables on the second line', () => {
+ assert.equal(syllable(lines[1]), 7);
+ });
+
+ it('should have five syllables on the third line', () => {
+ assert.equal(syllable(lines[2]), 5);
+ });
+ });
+ });
+}
+
+async function main() {
+ const files = fs.readdirSync(dir);
+
+ for (const file of files) {
+ if (!blockList.includes(file)) {
+ const [text, meta] = await processMarkdown(dir + file);
+ const lines = text.split('\n').filter((line) => line !== '');
+
+ if (meta.test !== false) {
+ await validateHaiku(file, lines, meta);
+ }
+ }
+ }
+}
+
+main(); // Call the main function to start the validation process
\ No newline at end of file
diff --git a/package.json b/package.json
index 6a6b2a8b3..3584b0374 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,6 @@
},
"homepage": "https://github.com/do-community/cloud_haiku#readme",
"dependencies": {
- "append-transform": "^latest",
"node-fetch": "^2.6.1",
"remark": "^14.0.2",
"remark-extract-frontmatter": "^2.0.0",
diff --git a/test.js b/test.js
deleted file mode 100644
index 6d40a7d10..000000000
--- a/test.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const assert = require('assert');
-import remark from 'remark';
-import { validateHaiku } from './validateHaiku';
-const frontmatter = require('remark-frontmatter');
-const extract = require('remark-extract-frontmatter');
-const yaml = require('yaml').parse;
-const strip = require('strip-markdown');
-const vfile = require('to-vfile');
-const fs = require('fs');
-
-const dir = './_haikus/';
-const blockList = ['haikus.md'];
-
-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);
- }
- }
-});
-
-async function processMarkdown(filename) {
- return new Promise((resolve, reject) => {
- remark()
- .use(frontmatter)
- .use(extract, { yaml: yaml })
- .use(strip)
- .process(vfile.readSync(filename), (err, file) => {
- if (err) {
- reject(err);
- } else {
- resolve([file.toString(), file.data]);
- }
- });
- });
-}
\ No newline at end of file