Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
atherdon committed Jul 31, 2022
1 parent c5f44fa commit be247d3
Show file tree
Hide file tree
Showing 10 changed files with 15,793 additions and 15,804 deletions.
30,604 changes: 15,302 additions & 15,302 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "markup-generator",
"version": "0.5.5",
"version": "0.6.0",
"description": "generator for files. working with 2 options at this moment",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand All @@ -20,12 +20,12 @@
"devDependencies": {
"@babel/cli": "7.18.9",
"@babel/core": "7.18.9",
"@babel/eslint-parser": "^7.18.9",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/preset-env": "7.18.9",
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-commonjs": "22.0.1",
"@rollup/plugin-node-resolve": "13.3.0",
"babel-eslint": "10.1.0",
"eslint": "8.20.0",
"eslint-plugin-json": "3.1.0",
"jest": "28.1.3",
Expand Down
200 changes: 98 additions & 102 deletions src/_depricated-helpers.js
Original file line number Diff line number Diff line change
@@ -1,102 +1,98 @@
function replaceMarkdown(regexp, callback) {
// console.log('helpers- replace markdown method')
// console.log(typeof callback)

let fixedCallbackMethod = false;
switch (typeof callback) {
case 'string':
fixedCallbackMethod = callback;
break;

case 'undefined':
console.log("ERRROROROR HERE!!!!");
console.log(regexp)
console.log(callback)

break;

default:
fixedCallbackMethod = callback.bind(this);
break;
}

this.content = this.content.replace(regexp, fixedCallbackMethod);
}

// @TODO find out if we really using this method or not?
function replaceMarkdownPreviewText(regexp) {
const config = {
content: this.content.trim(),
};

/*
this.previewText = replaceWrapper(
"previewText",
config,
"body"
);
console.log(this.previewText)
*/


this.errors.previewText = true;

this.content = this.content.replace(
regexp,
() => this.previewText,
);
}

// TODO update this method. I'm sure it can be improved.
function __parse(source) {
// passing content into the state,
// so we can do our updates step by step and track any errors
const state = stateInit(source);

Replacer.replaceMDBinded = replaceMarkdown.bind(state);
Replacer.replaceMDBindedPreviewText = replaceMarkdownPreviewText.bind(state);

Replacer.previewText();
Replacer.replaceMDBindedPreviewText(REGEXP_PREVIEW_TEXT);
Replacer.comments();

Replacer.strong();
Replacer.em();
Replacer.header();
Replacer.image();
Replacer.link();
Replacer.del();
Replacer.q();
Replacer.code();
Replacer.ul();
Replacer.ol();
Replacer.blockquote();
Replacer.hr();
Replacer.paragraph();
Replacer.emptyUl();
Replacer.emptyOl();

// this line is generating an error
Replacer.emptyBlockquote();
Replacer.br();

if (!process.env.PARSE === 'noAdv' || process.env.PARSE === 'full') {
Replacer.sponsorship();
}

Replacer.memes();
Replacer.separator();

// i'm adding it only because error warning didnt return red stuff
// checkErrors(state.errors);
state.innerCheckErrors();

// console.log(state)

return state;
}

module.exports = {
replaceMarkdown,
replaceMarkdownPreviewText,
};
function replaceMarkdown(regexp, callback) {
// console.log('helpers- replace markdown method')
// console.log(typeof callback)

let fixedCallbackMethod = false;
switch (typeof callback) {
case 'string':
fixedCallbackMethod = callback;
break;

case 'undefined':
console.log('ERRROROROR HERE!!!!');
console.log(regexp);
console.log(callback);

break;

default:
fixedCallbackMethod = callback.bind(this);
break;
}

this.content = this.content.replace(regexp, fixedCallbackMethod);
}

// @TODO find out if we really using this method or not?
function replaceMarkdownPreviewText(regexp) {
const config = {
content: this.content.trim(),
};

/*
this.previewText = replaceWrapper(
"previewText",
config,
"body"
);
console.log(this.previewText)
*/

this.errors.previewText = true;

this.content = this.content.replace(regexp, () => this.previewText);
}

// TODO update this method. I'm sure it can be improved.
function __parse(source) {
// passing content into the state,
// so we can do our updates step by step and track any errors
const state = stateInit(source);

Replacer.replaceMDBinded = replaceMarkdown.bind(state);
Replacer.replaceMDBindedPreviewText = replaceMarkdownPreviewText.bind(state);

Replacer.previewText();
Replacer.replaceMDBindedPreviewText(REGEXP_PREVIEW_TEXT);
Replacer.comments();

Replacer.strong();
Replacer.em();
Replacer.header();
Replacer.image();
Replacer.link();
Replacer.del();
Replacer.q();
Replacer.code();
Replacer.ul();
Replacer.ol();
Replacer.blockquote();
Replacer.hr();
Replacer.paragraph();
Replacer.emptyUl();
Replacer.emptyOl();

// this line is generating an error
Replacer.emptyBlockquote();
Replacer.br();

if (!process.env.PARSE === 'noAdv' || process.env.PARSE === 'full') {
Replacer.sponsorship();
}

Replacer.memes();
Replacer.separator();

// i'm adding it only because error warning didnt return red stuff
// checkErrors(state.errors);
state.innerCheckErrors();

// console.log(state)

return state;
}

module.exports = {
replaceMarkdown,
replaceMarkdownPreviewText,
};
Loading

0 comments on commit be247d3

Please sign in to comment.