Skip to content

Commit 4afaca8

Browse files
committed
prettier upd
1 parent 7378842 commit 4afaca8

File tree

7 files changed

+64
-89
lines changed

7 files changed

+64
-89
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ module.exports = {
3030
'import/prefer-default-export': 0,
3131
'import/no-extraneous-dependencies': 0,
3232
'func-names': 0,
33-
'camelcase': 1,
34-
'quotes': 0,
33+
camelcase: 1,
34+
quotes: 0,
3535
'comma-dangle': 0,
3636
'no-useless-escape': 0,
3737
'no-tabs': 0,

src/callbacksReact/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@ import * as callbacks from './methods/callbacks';
33
import * as lists from './methods/lists';
44
import _header from './methods/header';
55

6-
const Callbacks = { ...simple, ...lists, _header, ...callbacks };
6+
import _sponsorship from './methods/advanced/sponsor';
7+
import _previewText from './methods/advanced/preview';
8+
import _meme from './methods/advanced/meme';
9+
import _image from './methods/advanced/image';
10+
11+
const Callbacks = {
12+
...simple,
13+
...lists,
14+
_header,
15+
...callbacks,
16+
_sponsorship,
17+
_previewText,
18+
_meme,
19+
_image,
20+
};
721

822
export { Callbacks };
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1-
// import { newLine } from '../../../domain/helper-methods';
1+
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';
22

3-
// import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';
3+
function _previewText(text, content) {
4+
const params = {
5+
content,
6+
};
7+
8+
const config = {
9+
configurationMap: this.configurationMap,
10+
params,
11+
name: 'previewText',
12+
debug: true,
13+
};
14+
15+
// this.previewText = true;
16+
17+
const replaced = commonReplace(config);
18+
return replaced;
19+
}
20+
export default _previewText;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { commonReplace } from '../../../domain/replace-wrapper3.0/commonReplace';
2+
import { newLine } from '../../../domain/helper-methods';
3+
4+
function _separator(text) {
5+
const params = {
6+
content: text.trim(), // we have an issue, when we passing empty params
7+
};
8+
9+
const config = {
10+
configurationMap: this.configurationMap,
11+
params,
12+
13+
name: 'separator',
14+
debug: true,
15+
};
16+
17+
const replaced = commonReplace(config);
18+
return newLine + replaced + newLine;
19+
}
20+
21+
export default _separator;

src/callbacksReact/methods/simple.js

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -122,80 +122,6 @@ function _blockquote() {
122122
// };
123123
}
124124

125-
function _meme(text, src, href, altText) {
126-
const params = {
127-
src: src.trim(),
128-
altText: altText.trim(),
129-
href: href.trim(),
130-
};
131-
132-
const config = {
133-
configurationMap: this.configurationMap,
134-
params,
135-
name: 'meme',
136-
debug: true,
137-
};
138-
139-
const replaced = commonReplace(config);
140-
return replaced;
141-
}
142-
143-
// function _header(text, chars, content) {
144-
// const params = {
145-
// content: content.trim(),
146-
// };
147-
148-
// const titleType = ['mainTitle', 'subtitle', 'heading'];
149-
// const name = titleTypes[chars.length - 1];
150-
151-
// const config = {
152-
// configurationMap: this.configurationMap,
153-
// params,
154-
// name,
155-
156-
// // debug: true,
157-
// };
158-
159-
// const replaced = commonReplace(config);
160-
// return newLine + replaced;
161-
162-
// }
163-
164-
function _separator(text) {
165-
const params = {
166-
content: text.trim(), // we have an issue, when we passing empty params
167-
};
168-
169-
const config = {
170-
configurationMap: this.configurationMap,
171-
params,
172-
173-
name: 'separator',
174-
debug: true,
175-
};
176-
177-
const replaced = commonReplace(config);
178-
return newLine + replaced + newLine;
179-
}
180-
181-
function _previewText(text, content) {
182-
const params = {
183-
content,
184-
};
185-
186-
const config = {
187-
configurationMap: this.configurationMap,
188-
params,
189-
name: 'previewText',
190-
debug: true,
191-
};
192-
193-
// this.previewText = true;
194-
195-
const replaced = commonReplace(config);
196-
return replaced;
197-
}
198-
199125
export {
200126
_strong,
201127
_link,
@@ -207,7 +133,4 @@ export {
207133
_code,
208134
_hr,
209135
_empty,
210-
_previewText,
211-
_separator,
212-
_meme,
213136
};

src/constants/customTags.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ import os from 'os';
55
const platform = os.platform();
66

77
const newLine = platform === 'win32' ? '\r\n' : '\n';
8-
8+
// those RegEx`es might gone after integration of front matter
99
const REGEXP_SPONSORSHIP = /~(\[(.*?)\]){3}/g;
1010
const REGEXP_HTML_COMMENTS = /<!--(([\r\n]|.)*?)-->/g;
1111
// eslint-disable-next-line no-useless-escape
1212
const REGEXP_MEM = /\!\[(.*?)\]\[(.*?)\]\[(.*?)\]/g;
1313
const REGEXP_PREVIEW_TEXT = new RegExp(`#~(.*?)${newLine}`);
14+
//-------
15+
// TODO add that beforeMethod
16+
const regex_string = `\\[separator\\]`;
17+
const REGEXP_SEPARATOR = new RegExp(newLine + regex_string + newLine, 'g');
18+
//----------
1419

1520
const REGEXP_HASH_TAG = new RegExp(
1621
// eslint-disable-next-line no-control-regex
@@ -24,10 +29,6 @@ const REGEXP_LINK_HTTPS = new RegExp('>https', 'g');
2429
const REGEXP_STR_BEGIN = '>https';
2530
const REGEXP_STR_END = 'f<';
2631

27-
// TODO add that beforeMethod
28-
const regex_string = `\\[separator\\]`;
29-
const REGEXP_SEPARATOR = new RegExp(newLine + regex_string + newLine, 'g');
30-
3132
export {
3233
REGEXP_SPONSORSHIP,
3334
REGEXP_HTML_COMMENTS,

src/templates/HackernoonTemplate/html/components/Replace.class.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { replaceMarkdown } from '../../../../domain/replace-markdown/html/replac
55
class Replace {
66
constructor() {
77
this.replaceMDBinded = () => {};
8-
98
// I think this version isnt working well
109
// Replacer.replaceMDBindedPreviewText = replaceMarkdownPreviewText.bind(state);
1110
this.strong = () => this.replaceMDBinded('strong');
@@ -14,7 +13,6 @@ class Replace {
1413
this.italicAsterix = () => this.replaceMDBinded('italic_asterix');
1514
// TODO working not ideally, because we have headings & subtitles,
1615
// so it's confusing a little bit
17-
this.previewText = () => this.replaceMDBinded('previewText');
1816
this.header = () => this.replaceMDBinded('header');
1917
this.subtitle = () => this.replaceMDBinded('header');
2018
this.title = () => this.replaceMDBinded('header');
@@ -32,6 +30,7 @@ class Replace {
3230
this.br = () => this.replaceMDBinded('br');
3331
//-------
3432
// those methods might get replaced with front-matter
33+
this.previewText = () => this.replaceMDBinded('previewText');
3534
this.sponsorship = () => this.replaceMDBinded('sponsorship');
3635
// here we have a different name
3736
this.memes = () => this.replaceMDBinded('memes');

0 commit comments

Comments
 (0)