Skip to content
Snippets Groups Projects
Commit 70306d57 authored by Igor Markin's avatar Igor Markin
Browse files

Add links to pseudoplain

parent c3989100
Branches
Tags
1 merge request!17Populate attachments before normalisation
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
| 02 | Simple text | ok | ok | ok | | 02 | Simple text | ok | ok | ok |
| 03 | Embedded image | fail | ok | fail | | 03 | Embedded image | fail | ok | fail |
| 04 | Embedded image with text | fail | ok | fail | | 04 | Embedded image with text | fail | ok | fail |
| 05 | Complex text on multiple lines with some text bold, italic, lists, no attachments | fail | ok | ok | | 05 | Complex text on multiple lines with some text bold, italic, lists, no attachments | fail | ok | fail |
| 06 | Multiple MIME attachments and text | ok | ok | ok | | 06 | Multiple MIME attachments and text | ok | ok | ok |
| 07 | Multiple Drive attachments and text | ok | ok | ok | | 07 | Multiple Drive attachments and text | ok | ok | ok |
| 08 | Complex email with formatted text, embedded images, MIME and GDrive attachments | fail | ok | fail | | 08 | Complex email with formatted text, embedded images, MIME and GDrive attachments | fail | ok | fail |
......
...@@ -13,7 +13,13 @@ describe("[Pseudo PLAIN] Outlook-Outlook normalization", () => { ...@@ -13,7 +13,13 @@ describe("[Pseudo PLAIN] Outlook-Outlook normalization", () => {
EMAIL_VENDORS.OUTLOOK EMAIL_VENDORS.OUTLOOK
); );
describe("Chrome-Chrome", describeFunction("chrome-chrome")); describe("Chrome-Chrome", describeFunction("chrome-chrome", ["16"]));
describe("MacOS-MacOS", describeFunction("macos-macos", ["09"])); describe(
describe("Windows-Windows", describeFunction("windows-windows")); "MacOS-MacOS",
describeFunction("macos-macos", ["03", "04", "05", "08", "09"])
);
describe(
"Windows-Windows",
describeFunction("windows-windows", ["11", "12", "16"])
);
}); });
...@@ -87,23 +87,26 @@ export const extractPseudoPlainPart = ( ...@@ -87,23 +87,26 @@ export const extractPseudoPlainPart = (
document: HTMLDocument document: HTMLDocument
/*vendor: string*/ /*vendor: string*/
): string => { ): string => {
const normalizedTextContent = PlainNormalizer.normalizePlain( let normalizedTextContent = PlainNormalizer.normalizePlain(
document.body.textContent document.body.textContent
); );
// const anchors = document.getElementsByTagName("a"); const anchors = document.getElementsByTagName("a");
// const images = document.getElementsByTagName("img"); const images = document.getElementsByTagName("img");
// let meaningfulAttributes = []; let meaningfulAttributes = [];
//
// Array.from(anchors).forEach((a) => { Array.from(anchors).forEach((a) => {
// meaningfulAttributes.push(a.getAttribute("href")); meaningfulAttributes.push(a.getAttribute("href"));
// }); });
// Array.from(images).forEach((img) => { Array.from(images).forEach((img) => {
// meaningfulAttributes.push(img.getAttribute("src")); meaningfulAttributes.push(img.getAttribute("src"));
// meaningfulAttributes.push(img.getAttribute("alt")); meaningfulAttributes.push(img.getAttribute("alt"));
// }); });
//
// meaningfulAttributes = meaningfulAttributes.filter((attr) => !!attr).sort(); meaningfulAttributes = meaningfulAttributes.filter((attr) => !!attr).sort();
normalizedTextContent += meaningfulAttributes.join(",");
// console.log(meaningfulAttributes); // console.log(meaningfulAttributes);
return normalizedTextContent; return normalizedTextContent;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment