diff --git a/.gitignore b/.gitignore index 68dda08..9667985 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ landing/out .next/ .env out +out_test landing-friend-config.ts public SEO \ No newline at end of file diff --git a/packages/landing-friend-core/src/data/exclude.ts b/packages/landing-friend-core/src/data/exclude.ts index bf4a93b..c04c07a 100644 --- a/packages/landing-friend-core/src/data/exclude.ts +++ b/packages/landing-friend-core/src/data/exclude.ts @@ -106,79 +106,77 @@ export const unicode = { }; export const staticTags = [ - "strong", - "em", - "span", + "a", + "abbr", + "acronym", + "address", + "audio", + "b", + "bdi", + "bdo", + "blockquote", "br", - "style", - "p", + "canvas", + "caption", + "cite", + "code", + "col", + "colgroup", + "dd", + "del", + "dfn", "div", - "svg", - "a", - "path", + "dl", + "dt", + "em", + "embed", + "figure", + "figcaption", "h1", "h2", "h3", "h4", "h5", "h6", - "ul", - "ol", - "li", - "dl", - "dt", - "dd", - "blockquote", - "q", - "cite", - "code", - "pre", - "abbr", - "acronym", - "address", - "b", - "big", - "del", - "dfn", + "iframe", "ins", "kbd", - "samp", - "sub", - "sup", - "var", - "small", + "li", "mark", - "ruby", - "rt", - "rp", - "time", - "wbr", - "bdi", - "bdo", + "noscript", "object", + "ol", + "p", "param", - "embed", - "iframe", - "canvas", + "path", + "picture", + "pre", + "q", + "rp", + "rt", + "ruby", + "samp", "script", - "noscript", - "caption", - "col", - "colgroup", + "small", + "span", + "strong", + "style", + "sub", + "sup", + "svg", "table", - "thead", "tbody", + "td", "tfoot", - "tr", "th", - "td", - "figure", - "figcaption", - "video", - "audio", - "source", + "thead", + "time", "track", - "picture", + "tr", + "ul", + "var", + "video", + "wbr", ]; export const forbiddenCharacters = [ diff --git a/packages/landing-friend-core/src/functions/analyzer/advancedAnalyzer.ts b/packages/landing-friend-core/src/functions/analyzer/advancedAnalyzer.ts index 4456570..ad143ae 100644 --- a/packages/landing-friend-core/src/functions/analyzer/advancedAnalyzer.ts +++ b/packages/landing-friend-core/src/functions/analyzer/advancedAnalyzer.ts @@ -85,8 +85,12 @@ export const checkFileToAdvanceAnalyzer = async ({ char => content && content.includes(char) ); if (content && content.includes("https")) { - const response = await fetch(content); - status = response.statusText; + try { + const response = await fetch(content); + status = response.statusText; + } catch (err) { + // + } } const metaObject: MetaNameWithProps = { diff --git a/packages/landing-friend-core/src/functions/analyzer/basicAnalyzer.ts b/packages/landing-friend-core/src/functions/analyzer/basicAnalyzer.ts index 3ee046a..a347809 100644 --- a/packages/landing-friend-core/src/functions/analyzer/basicAnalyzer.ts +++ b/packages/landing-friend-core/src/functions/analyzer/basicAnalyzer.ts @@ -37,7 +37,10 @@ const checkContent = (tagName: BasicTagsName, fileContent: string) => { if (captureGroups) { let content = captureGroups[1]; staticTags.forEach(staticTag => { - const staticTagRegex = new RegExp(`<${staticTag}.*?>|`, "g"); + const staticTagRegex = new RegExp( + `<${staticTag}.*?>||\\.css.*?}|@media.*?}|{|}`, + "g" + ); Object.entries(unicode).forEach(([unicode, replacement]) => { const unicodeRegex = new RegExp(`${unicode}`, "g"); content = content.replace(unicodeRegex, replacement); diff --git a/packages/landing-friend-core/src/functions/analyzer/prepareHTML.ts b/packages/landing-friend-core/src/functions/analyzer/prepareHTML.ts index 75046f7..96dcbe5 100644 --- a/packages/landing-friend-core/src/functions/analyzer/prepareHTML.ts +++ b/packages/landing-friend-core/src/functions/analyzer/prepareHTML.ts @@ -17,7 +17,10 @@ interface DefaultGenerate { advancedAnalyzer: boolean; } -type GenerateTable = DefaultGenerate & { combinedTagsPatterns: CombinedPatterns }; +type GenerateTable = DefaultGenerate & { + combinedTagsPatterns: CombinedPatterns; + tableIndex: number; +}; type PrepareHtml = DefaultGenerate & { combinedTagsPatterns: CombinedPatterns[] }; const generateTableRows = ({ @@ -25,6 +28,7 @@ const generateTableRows = ({ countKeywords, countWordsInLast, advancedAnalyzer, + tableIndex, }: GenerateTable): string => { return Object.entries(combinedTagsPatterns) .map(([file, tagData]) => { @@ -73,10 +77,13 @@ const generateTableRows = ({ return ` - ${file} + + ${file} + + - + ${mainRow} ${ countKeywords @@ -94,8 +101,25 @@ const generateTableRows = ({ ${metaRow}` : "" } - - + + + `; }) .join(""); @@ -108,7 +132,7 @@ export const prepareHTMLWithTables = ({ advancedAnalyzer, }: PrepareHtml): string => { let brokenTagsTable: string = ""; - combinedTagsPatterns.map(combinedTagsPattern => { + combinedTagsPatterns.map((combinedTagsPattern, idx) => { brokenTagsTable = brokenTagsTable + generateTableRows({ @@ -116,6 +140,7 @@ export const prepareHTMLWithTables = ({ countKeywords, countWordsInLast, advancedAnalyzer, + tableIndex: idx, }); }); @@ -126,6 +151,12 @@ export const prepareHTMLWithTables = ({