{
    "tests": [
        {
            "description": "<b><p>Bold </b> Not bold</p>\\r\\nAlso not bold.",
            "input": "<b><p>Bold </b> Not bold</p>\r\nAlso not bold.",
            "output": [
                [
                    "StartTag",
                    "b",
                    {}
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "Bold "
                ],
                [
                    "EndTag",
                    "b"
                ],
                [
                    "Character",
                    " Not bold"
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "Character",
                    "\nAlso not bold."
                ]
            ]
        },
        {
            "description": "<html>\\r\\n<font color=red><i>Italic and Red<p>Italic and Red </font> Just italic.</p> Italic only.</i> Plain\\r\\n<p>I should not be red. <font color=red>Red. <i>Italic and red.</p>\\r\\n<p>Italic and red. </i> Red.</font> I should not be red.</p>\\r\\n<b>Bold <i>Bold and italic</b> Only Italic </i> Plain",
            "input": "<html>\r\n<font color=red><i>Italic and Red<p>Italic and Red </font> Just italic.</p> Italic only.</i> Plain\r\n<p>I should not be red. <font color=red>Red. <i>Italic and red.</p>\r\n<p>Italic and red. </i> Red.</font> I should not be red.</p>\r\n<b>Bold <i>Bold and italic</b> Only Italic </i> Plain",
            "output": [
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "font",
                    {
                        "color": "red"
                    }
                ],
                [
                    "StartTag",
                    "i",
                    {}
                ],
                [
                    "Character",
                    "Italic and Red"
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "Italic and Red "
                ],
                [
                    "EndTag",
                    "font"
                ],
                [
                    "Character",
                    " Just italic."
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "Character",
                    " Italic only."
                ],
                [
                    "EndTag",
                    "i"
                ],
                [
                    "Character",
                    " Plain\n"
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "I should not be red. "
                ],
                [
                    "StartTag",
                    "font",
                    {
                        "color": "red"
                    }
                ],
                [
                    "Character",
                    "Red. "
                ],
                [
                    "StartTag",
                    "i",
                    {}
                ],
                [
                    "Character",
                    "Italic and red."
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "Italic and red. "
                ],
                [
                    "EndTag",
                    "i"
                ],
                [
                    "Character",
                    " Red."
                ],
                [
                    "EndTag",
                    "font"
                ],
                [
                    "Character",
                    " I should not be red."
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "b",
                    {}
                ],
                [
                    "Character",
                    "Bold "
                ],
                [
                    "StartTag",
                    "i",
                    {}
                ],
                [
                    "Character",
                    "Bold and italic"
                ],
                [
                    "EndTag",
                    "b"
                ],
                [
                    "Character",
                    " Only Italic "
                ],
                [
                    "EndTag",
                    "i"
                ],
                [
                    "Character",
                    " Plain"
                ]
            ]
        },
        {
            "description": "<html><body>\\r\\n<p><font size=\"7\">First paragraph.</p>\\r\\n<p>Second paragraph.</p></font>\\r\\n<b><p><i>Bold and Italic</b> Italic</p>",
            "input": "<html><body>\r\n<p><font size=\"7\">First paragraph.</p>\r\n<p>Second paragraph.</p></font>\r\n<b><p><i>Bold and Italic</b> Italic</p>",
            "output": [
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "StartTag",
                    "body",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "StartTag",
                    "font",
                    {
                        "size": "7"
                    }
                ],
                [
                    "Character",
                    "First paragraph."
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "Second paragraph."
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "EndTag",
                    "font"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "b",
                    {}
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "StartTag",
                    "i",
                    {}
                ],
                [
                    "Character",
                    "Bold and Italic"
                ],
                [
                    "EndTag",
                    "b"
                ],
                [
                    "Character",
                    " Italic"
                ],
                [
                    "EndTag",
                    "p"
                ]
            ]
        },
        {
            "description": "<html>\\r\\n<dl>\\r\\n<dt><b>Boo\\r\\n<dd>Goo?\\r\\n</dl>\\r\\n</html>",
            "input": "<html>\r\n<dl>\r\n<dt><b>Boo\r\n<dd>Goo?\r\n</dl>\r\n</html>",
            "output": [
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "dl",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "dt",
                    {}
                ],
                [
                    "StartTag",
                    "b",
                    {}
                ],
                [
                    "Character",
                    "Boo\n"
                ],
                [
                    "StartTag",
                    "dd",
                    {}
                ],
                [
                    "Character",
                    "Goo?\n"
                ],
                [
                    "EndTag",
                    "dl"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "description": "<html><body>\\r\\n<label><a><div>Hello<div>World</div></a></label>  \\r\\n</body></html>",
            "input": "<html><body>\r\n<label><a><div>Hello<div>World</div></a></label>  \r\n</body></html>",
            "output": [
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "StartTag",
                    "body",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "label",
                    {}
                ],
                [
                    "StartTag",
                    "a",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "Character",
                    "Hello"
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "Character",
                    "World"
                ],
                [
                    "EndTag",
                    "div"
                ],
                [
                    "EndTag",
                    "a"
                ],
                [
                    "EndTag",
                    "label"
                ],
                [
                    "Character",
                    "  \n"
                ],
                [
                    "EndTag",
                    "body"
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "description": "<table><center> <font>a</center> <img> <tr><td> </td> </tr> </table>",
            "input": "<table><center> <font>a</center> <img> <tr><td> </td> </tr> </table>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "center",
                    {}
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "font",
                    {}
                ],
                [
                    "Character",
                    "a"
                ],
                [
                    "EndTag",
                    "center"
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "img",
                    {}
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "EndTag",
                    "td"
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "EndTag",
                    "tr"
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "description": "<table><tr><p><a><p>You should see this text.",
            "input": "<table><tr><p><a><p>You should see this text.",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "StartTag",
                    "a",
                    {}
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "You should see this text."
                ]
            ]
        },
        {
            "description": "<TABLE>\\r\\n<TR>\\r\\n<CENTER><CENTER><TD></TD></TR><TR>\\r\\n<FONT>\\r\\n<TABLE><tr></tr></TABLE>\\r\\n</P>\\r\\n<a></font><font></a>\\r\\nThis page contains an insanely badly-nested tag sequence.",
            "input": "<TABLE>\r\n<TR>\r\n<CENTER><CENTER><TD></TD></TR><TR>\r\n<FONT>\r\n<TABLE><tr></tr></TABLE>\r\n</P>\r\n<a></font><font></a>\r\nThis page contains an insanely badly-nested tag sequence.",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "center",
                    {}
                ],
                [
                    "StartTag",
                    "center",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ],
                [
                    "EndTag",
                    "td"
                ],
                [
                    "EndTag",
                    "tr"
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "font",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "EndTag",
                    "tr"
                ],
                [
                    "EndTag",
                    "table"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "a",
                    {}
                ],
                [
                    "EndTag",
                    "font"
                ],
                [
                    "StartTag",
                    "font",
                    {}
                ],
                [
                    "EndTag",
                    "a"
                ],
                [
                    "Character",
                    "\nThis page contains an insanely badly-nested tag sequence."
                ]
            ]
        },
        {
            "description": "<html>\\r\\n<body>\\r\\n<b><nobr><div>This text is in a div inside a nobr</nobr>More text that should not be in the nobr, i.e., the\\r\\nnobr should have closed the div inside it implicitly. </b><pre>A pre tag outside everything else.</pre>\\r\\n</body>\\r\\n</html>",
            "input": "<html>\r\n<body>\r\n<b><nobr><div>This text is in a div inside a nobr</nobr>More text that should not be in the nobr, i.e., the\r\nnobr should have closed the div inside it implicitly. </b><pre>A pre tag outside everything else.</pre>\r\n</body>\r\n</html>",
            "output": [
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "body",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "b",
                    {}
                ],
                [
                    "StartTag",
                    "nobr",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "Character",
                    "This text is in a div inside a nobr"
                ],
                [
                    "EndTag",
                    "nobr"
                ],
                [
                    "Character",
                    "More text that should not be in the nobr, i.e., the\nnobr should have closed the div inside it implicitly. "
                ],
                [
                    "EndTag",
                    "b"
                ],
                [
                    "StartTag",
                    "pre",
                    {}
                ],
                [
                    "Character",
                    "A pre tag outside everything else."
                ],
                [
                    "EndTag",
                    "pre"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "EndTag",
                    "body"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        }
    ]
}