WIP paragraphs now claim everything within newlines
This commit is contained in:
1
build.js
1
build.js
@@ -49,7 +49,6 @@ manifest.forEach((m) => {
|
|||||||
|
|
||||||
if (!fs.existsSync(m.assetDirectoryPath)) return;
|
if (!fs.existsSync(m.assetDirectoryPath)) return;
|
||||||
const assetsList = fs.readdirSync(m.assetDirectoryPath);
|
const assetsList = fs.readdirSync(m.assetDirectoryPath);
|
||||||
console.log(assetsList);
|
|
||||||
assetsList.forEach((assetName) =>
|
assetsList.forEach((assetName) =>
|
||||||
fs.cpSync(
|
fs.cpSync(
|
||||||
`${m.assetDirectoryPath}/${assetName}`,
|
`${m.assetDirectoryPath}/${assetName}`,
|
||||||
|
|||||||
44
markdown.js
44
markdown.js
@@ -99,6 +99,49 @@ class Heading extends Symbol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Paragraph extends Symbol {
|
||||||
|
/**
|
||||||
|
* @type {string[]}
|
||||||
|
*/
|
||||||
|
lines = [];
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {string} line
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
static canParse(line) {
|
||||||
|
return line === "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {LineFeed} lineFeed
|
||||||
|
* @returns {Symbol}
|
||||||
|
*/
|
||||||
|
static create(lineFeed) {
|
||||||
|
const instance = new Paragraph();
|
||||||
|
lineFeed.claim();
|
||||||
|
|
||||||
|
const lines = [];
|
||||||
|
let endOfParagraph = false;
|
||||||
|
while (!endOfParagraph && !lineFeed.isEmpty()) {
|
||||||
|
const line = lineFeed.peek();
|
||||||
|
if (line === "") {
|
||||||
|
endOfParagraph = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines.push(lineFeed.claim());
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.lines = lines;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return `<p>${this.lines.join("")}</p>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class UnorderedListItem extends Symbol {
|
class UnorderedListItem extends Symbol {
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -585,6 +628,7 @@ const getAmountOfTokenInBeginningOfFile = (token, string) => {
|
|||||||
* @type {Symbol[]}
|
* @type {Symbol[]}
|
||||||
*/
|
*/
|
||||||
const Factories = [
|
const Factories = [
|
||||||
|
Paragraph,
|
||||||
Heading,
|
Heading,
|
||||||
UnorderedListItem,
|
UnorderedListItem,
|
||||||
OrderedListItem,
|
OrderedListItem,
|
||||||
|
|||||||
Reference in New Issue
Block a user