diff --git a/Mf2/Parser.php b/Mf2/Parser.php index 6f8d129..3717c58 100644 --- a/Mf2/Parser.php +++ b/Mf2/Parser.php @@ -736,7 +736,7 @@ public function parseE(\DOMElement $e) { $html = ''; foreach ($e->childNodes as $node) { - $html .= $node->C14N(); + $html .= $node->ownerDocument->saveHTML($node); } return array( diff --git a/tests/Mf2/ParserTest.php b/tests/Mf2/ParserTest.php index cfc1d8a..30e59d9 100644 --- a/tests/Mf2/ParserTest.php +++ b/tests/Mf2/ParserTest.php @@ -92,10 +92,20 @@ public function testParseEResolvesRelativeLinks() { $parser = new Parser($input, 'http://example.com'); $output = $parser->parse(); - $this->assertEquals('Blah blah thing. ', $output['items'][0]['properties']['content'][0]['html']); + $this->assertEquals('Blah blah thing. ', $output['items'][0]['properties']['content'][0]['html']); $this->assertEquals('Blah blah thing. http://example.com/img', $output['items'][0]['properties']['content'][0]['value']); } + public function testParseEWithBR() { + $input = '
Here is content with two lines.
The br tag should not be converted to an XML br/br element.
'; + //$parser = new Parser($input); + $output = Mf2\parse($input); + + $this->assertArrayHasKey('content', $output['items'][0]['properties']); + $this->assertEquals('Here is content with two lines.
The br tag should not be converted to an XML br/br element.', $output['items'][0]['properties']['content'][0]['html']); + $this->assertEquals('Here is content with two lines.'."\n".'The br tag should not be converted to an XML br/br element.', $output['items'][0]['properties']['content'][0]['value']); + } + /** * @group parseH */