mirror of
https://github.com/stalwartlabs/mail-parser.git
synced 2026-11-29 16:01:27 +00:00
135 lines
3.6 KiB
JSON
135 lines
3.6 KiB
JSON
[
|
|
{
|
|
"input": "<html>hello<br/>world<br/></html>",
|
|
"expected": "hello\nworld\n"
|
|
},
|
|
{
|
|
"input": "<html>using <><br/></html>",
|
|
"expected": "using <>\n"
|
|
},
|
|
{
|
|
"input": "test <not br/>tag<br />",
|
|
"expected": "test tag\n"
|
|
},
|
|
{
|
|
"input": "<>< ><tag\n/>>hello world< br \n />",
|
|
"expected": ">hello world\n"
|
|
},
|
|
{
|
|
"input": "<head><title>ignore head</title><not head>xyz</not head></head><h1><body></h1>",
|
|
"expected": "<body>"
|
|
},
|
|
{
|
|
"input": "<p>what is ♥?</p><p>ßĂΒγ don't hurt me.</p>",
|
|
"expected": "what is ♥?\nßĂΒγ don't hurt me.\n"
|
|
},
|
|
{
|
|
"input": "<!--[if mso]><style type=\"text/css\">body, table, td, a, p, span, ul, li {font-family: Arial, sans-serif!important;}</style><![endif]-->this is <!-- <> < < < < ignore > -> here -->the actual<!--> text",
|
|
"expected": "this is the actual text"
|
|
},
|
|
{
|
|
"input": " < p > hello < / p > < p > world < / p > !!! < br > ",
|
|
"expected": "hello\nworld\n!!!\n"
|
|
},
|
|
{
|
|
"input": " <p>please unsubscribe <a href=#>here</a>.</p> ",
|
|
"expected": "please unsubscribe here.\n"
|
|
},
|
|
{
|
|
"input": "<style>body{color:red}</style><div>Hello</div>",
|
|
"expected": "Hello"
|
|
},
|
|
{
|
|
"input": "<style>body{color:red}</style><div>Hello</div><script>alert('x')</script><div>World</div>",
|
|
"expected": "HelloWorld"
|
|
},
|
|
{
|
|
"input": "<div>Hello</div><template><div>Hidden</div><style>.x{}</style></template><div>World</div>",
|
|
"expected": "HelloWorld"
|
|
},
|
|
{
|
|
"input": "<style type=\"text/css\">p { color: red; }</style><p>Hello world</p>",
|
|
"expected": "Hello world\n"
|
|
},
|
|
{
|
|
"input": "<script type=\"text/javascript\">var x = 1;</script><p>Hello world</p>",
|
|
"expected": "Hello world\n"
|
|
},
|
|
{
|
|
"input": "<STYLE TYPE=\"text/css\" media=\"screen\">.a{b:c}</STYLE>Hi",
|
|
"expected": "Hi"
|
|
},
|
|
{
|
|
"input": "<head lang=\"en\"><title>Title</title></head><body class=\"main\">Body</body>",
|
|
"expected": "Body"
|
|
},
|
|
{
|
|
"input": "<div>Hello</div><template id=\"row\"><div>Hidden</div></template><div>World</div>",
|
|
"expected": "HelloWorld"
|
|
},
|
|
{
|
|
"input": "line one<br class=\"x\">line two<br style=\"a\" />end",
|
|
"expected": "line one\nline two\nend"
|
|
},
|
|
{
|
|
"input": "<p class=\"intro\">first</p><p style=\"margin:0\">second</p>",
|
|
"expected": "first\nsecond\n"
|
|
},
|
|
{
|
|
"input": "<!--[if mso]><style type=\"text/css\">td{}</style><![endif]--><style type=\"text/css\">@media{.a{b:c}}</style><table role=\"presentation\"><tr><td style=\"padding:0\">Sale & more</td></tr></table>",
|
|
"expected": "Sale & more"
|
|
},
|
|
{
|
|
"input": "<p>Before</p><!----><p>Hello world</p>",
|
|
"expected": "Before\nHello world\n"
|
|
},
|
|
{
|
|
"input": "a<!-- x --->b<!---->c<!-->d<!--->e<!-- y --!>f",
|
|
"expected": "abcdef"
|
|
},
|
|
{
|
|
"input": "a<!---!>x--><!--!>y--><!-- z- ->w -->b",
|
|
"expected": "ab"
|
|
},
|
|
{
|
|
"input": "before<!-- unterminated --",
|
|
"expected": "before"
|
|
},
|
|
{
|
|
"input": "<b>Hello</b> world",
|
|
"expected": "Hello world"
|
|
},
|
|
{
|
|
"input": "<a href=u>link</a> text",
|
|
"expected": "link text"
|
|
},
|
|
{
|
|
"input": "<p>Name: <b>John</b> Smith</p>",
|
|
"expected": "Name: John Smith\n"
|
|
},
|
|
{
|
|
"input": "<p>a</p>\n<p>b</p>",
|
|
"expected": "a\nb\n"
|
|
},
|
|
{
|
|
"input": "<img alt=\"a > b\"> after",
|
|
"expected": "after"
|
|
},
|
|
{
|
|
"input": "<a title='1>0'>t</a>",
|
|
"expected": "t"
|
|
},
|
|
{
|
|
"input": "<img alt=\"a < b\" src=x>after",
|
|
"expected": "after"
|
|
},
|
|
{
|
|
"input": "<a href = \"x>y\" class=c>t</a> u",
|
|
"expected": "t u"
|
|
},
|
|
{
|
|
"input": "a<img alt=\"x>y",
|
|
"expected": "a"
|
|
}
|
|
]
|