Skip to content
Merged
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"build": "cross-env NODE_ENV=production rollup -c",
"dev:parseFull": "cross-env PARSE=full rollup -c -w",
"dev:parseFullRecipes": "cross-env PARSE=recipesFull rollup -c -w",
"dev:parseReactFull": "cross-env PARSE=reactFull rollup -c -w",
"prod:parseFull": "npm run build && cross-env PARSE=full node ./dist/bundle",
"prod:parseReactFull": "npm run build && cross-env PARSE=reactFull node ./dist/bundle",
Expand Down Expand Up @@ -58,6 +59,7 @@
"cross-env": "7.0.3",
"lit-html": "^2.2.6",
"lodash": "4.17.21",
"nmtg-template-mailerlite-typography": "^3.1.0",
"path-exists": "5.0.0",
"write": "2.0.0"
},
Expand Down
File renamed without changes.
7 changes: 3 additions & 4 deletions src/callbacks/html/methods/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@ import {
// beforeBeginingNewLine
} from '../helpers';

import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

// import CallbackFactory from '../../../domain/callbacks-factory';

// TODO fix issue related to text variable
function _header(text, chars, content) {
// const factory = CallbackFactory.create();

const params = {
content: content.trim(),
};

const titleTypes = ['title', 'subtitle', 'heading'];
const titleTypes = ['title', 'subtitle', 'header'];

const name = titleTypes[chars.length - 1];

const config = {
configurationMap: this.configurationMap,
params,
name,

// debug: true,
};

Expand Down
3 changes: 2 additions & 1 deletion src/callbacks/html/methods/image.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

// TODO remove unused `text` argument
export function _image(text, alt, srcWithTooltip) {
Expand All @@ -12,6 +12,7 @@ export function _image(text, alt, srcWithTooltip) {
};

const config = {
configurationMap: this.configurationMap,
params,
name: 'image',
// debug: true,
Expand Down
16 changes: 9 additions & 7 deletions src/callbacks/html/methods/italic.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

const _italic = (
function _italic(
text,
// content,
// a,
// b,
// c
) => {
) {
// TODO we need to debug italic
// https://github.com/LLazyEmail/markdown-to-email/issues/1265
// console.log(text)
Expand All @@ -18,6 +18,7 @@ const _italic = (
};

const config = {
configurationMap: this.configurationMap,
params,

name: 'italic',
Expand All @@ -26,12 +27,12 @@ const _italic = (

const replaced = commonReplace(config);
return replaced;
};
}

const _italicAsterix = (
function _italicAsterix(
text,
// content
) => {
) {
// console.log(text);
// console.log(content);

Expand All @@ -40,6 +41,7 @@ const _italicAsterix = (
};

const config = {
configurationMap: this.configurationMap,
params,

name: 'italic_asterix',
Expand All @@ -48,6 +50,6 @@ const _italicAsterix = (

const replaced = commonReplace(config);
return replaced;
};
}

export { _italic, _italicAsterix };
5 changes: 3 additions & 2 deletions src/callbacks/html/methods/link.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { replaceLink } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

import { catchErrorTraceOutput } from '../../../domain/error-handle';

Expand All @@ -12,14 +12,15 @@ function _link(text, title, href) {
};

const config = {
configurationMap: this.configurationMap,
params,
name: 'link',
// debug: true
};

let replaced = '';
try {
replaced = replaceLink(config);
replaced = commonReplace(config);
// return newLine + replaced + newLine;
} catch (error) {
catchErrorTraceOutput(error);
Expand Down
6 changes: 5 additions & 1 deletion src/callbacks/html/methods/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '../helpers';

import { REGEXP_SUB_LISTS } from '../../../domain/regular-expressions';
import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

// Case: when you have a sublist inside of your list
// TODO add _ in the name of this method in order to keep the same logic
Expand All @@ -19,6 +19,7 @@ function getParsedSubList(subList) {
};

const config = {
configurationMap: this.configurationMap,
params,

name: 'listItem',
Expand All @@ -44,6 +45,7 @@ function getParsedLists(parsedSubLists) {
};

const config = {
configurationMap: this.configurationMap,
params,

name: 'listItem',
Expand Down Expand Up @@ -78,6 +80,7 @@ function _ulList(text, list) {
};

const config = {
configurationMap: this.configurationMap,
params,

name: 'list',
Expand All @@ -95,6 +98,7 @@ function _ulList(text, list) {
};

const config = {
configurationMap: this.configurationMap,
params,

name: 'list',
Expand Down
3 changes: 2 additions & 1 deletion src/callbacks/html/methods/memes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

// // TODO remove unused `text` argument
function _meme(text, src, href, altText) {
Expand All @@ -9,6 +9,7 @@ function _meme(text, src, href, altText) {
};

const config = {
configurationMap: this.configurationMap,
params,
name: 'image',
// debug: true,
Expand Down
3 changes: 2 additions & 1 deletion src/callbacks/html/methods/paragraph.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { newLine } from '../helpers';

import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

// function now working as planned
// TODO remove unused `text` argument
Expand All @@ -23,6 +23,7 @@ export function _paragraphWrapper(text, markdown_string) {
};

const config = {
configurationMap: this.configurationMap,
params,
name: 'paragraph',
// debug: true
Expand Down
4 changes: 2 additions & 2 deletions src/callbacks/html/methods/preview.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

// TODO remove unused `text` argument
function _previewText(text, content) {
const params = {
content,
};

// TODO figure out a way to handle errors
// this.errors.previewText = true;

const config = {
configurationMap: this.configurationMap,
params,
folder: 'body',
name: 'previewText',
Expand Down
3 changes: 2 additions & 1 deletion src/callbacks/html/methods/separator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { newLine } from '../helpers';

import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

function _separator(
text,
Expand All @@ -14,6 +14,7 @@ function _separator(
};

const config = {
configurationMap: this.configurationMap,
params,

name: 'separator',
Expand Down
3 changes: 2 additions & 1 deletion src/callbacks/html/methods/sponsor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

export function _sponsorship(markdown_string) {
// TODO move out this regex into constants file.
Expand All @@ -19,6 +19,7 @@ export function _sponsorship(markdown_string) {
};

const config = {
configurationMap: this.configurationMap,
params,
name: 'sponsorship',
};
Expand Down
3 changes: 2 additions & 1 deletion src/callbacks/html/methods/strong.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { commonReplace } from '../../../domain/replace-wrapper3.0';
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';

// TODO make sense to the text variable
// probably Vadim knows what is doing on here,
Expand All @@ -11,6 +11,7 @@ function _strong(text, doubleAsterix, content, asterix) {
};

const config = {
configurationMap: this.configurationMap,
params,

name: 'strong',
Expand Down
11 changes: 7 additions & 4 deletions src/callbacksReact/methods/callbacks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { newLine } from '../../domain/helper-methods';

import { commonReplaceReact } from '../../domain/replace-wrapper3.0';
import { commonReplace } from '../../domain/replace-wrapper3.0/commonReplace';

/// function is not working as planned

Expand All @@ -17,13 +17,14 @@ function _paragraph(text, line) {
};

const config = {
configurationMap: this.configurationMap,
params,
name: 'paragraph',
// debug: true,
};

// console.log(config);
const replaced = commonReplaceReact(config);
const replaced = commonReplace(config);
const result = newLine + replaced + newLine;

return result;
Expand All @@ -39,14 +40,15 @@ function _image(text, alt, srcWithTooltip) {
};

const config = {
configurationMap: this.configurationMap,
params,
name: 'image',
debug: true,
};

this.warnings.images += 1;

const replaced = commonReplaceReact(config);
const replaced = commonReplace(config);

return replaced;
}
Expand Down Expand Up @@ -81,11 +83,12 @@ function _sponsorship(text) {
};

const config = {
configurationMap: this.configurationMap,
params,
name: 'sponsor',
debug: true,
};
const replaced = commonReplaceReact(config);
const replaced = commonReplace(config);
return replaced;

// TODO upgrade a way to handle errors in state object
Expand Down
5 changes: 3 additions & 2 deletions src/callbacksReact/methods/header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { newLine } from '../../domain/helper-methods';

import { commonReplaceReact } from '../../domain/replace-wrapper3.0';
import { commonReplace } from '../../domain/replace-wrapper3.0/commonReplace';

function _header(text, chars, content) {
const params = {
Expand All @@ -11,13 +11,14 @@ function _header(text, chars, content) {
const name = titleTypes[chars.length - 1];

const config = {
configurationMap: this.configurationMap,
params,
name,

// debug: true,
};

const replaced = commonReplaceReact(config);
const replaced = commonReplace(config);
return newLine + replaced;
}

Expand Down
8 changes: 4 additions & 4 deletions src/callbacksReact/methods/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { newLine } from '../../domain/helper-methods';
// const _hr = () => `${newLine}<hr />`;
// const _empty = () => '';

// import { commonReplaceReact } from '../../domain/replace-wrapper3.0';
// import { commonReplace } from '../../domain/replace-wrapper3.0';

// function getParsedSubList(subList) {
// return subList.replace(
Expand All @@ -19,7 +19,7 @@ import { newLine } from '../../domain/helper-methods';
// debug: true,
// };

// const replaced = commonReplaceReact(config);
// const replaced = commonReplace(config);

// return newLine + replaced;
// },
Expand Down Expand Up @@ -51,7 +51,7 @@ function _ulList() {
// // debug: true,
// // };

// // const replaced = commonReplaceReact(config);
// // const replaced = commonReplace(config);

// // return newLine + replaced;
// return 'this is UL list callback needs to revise it';
Expand All @@ -71,7 +71,7 @@ function _ulList() {
// // debug: true,
// // };

// const replaced = commonReplaceReact(config);
// const replaced = commonReplace(config);

// return newLine + replaced;
// },
Expand Down
Loading