Skip to content

Commit

Permalink
Merge pull request #11 from zzgab/feature_xmlnsfig
Browse files Browse the repository at this point in the history
resolves #10
  • Loading branch information
zzgab committed Nov 28, 2016
2 parents f04d9f0 + 9077b42 commit 5a884cd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/figdice/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ private function openTagHandler($xmlParser, $tagName, $attributes) {
break;
}
}

// Remove the fig xmlns directive from the list of attributes of the opening root tag
// (as it should not be rendered)
unset($attributes['xmlns:' . substr($this->figNamespace, 0, strlen($this->figNamespace) - 1)]);
}

$lineNumber = xml_get_current_line_number($xmlParser);
Expand Down
16 changes: 16 additions & 0 deletions test/FigXmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,22 @@ public function testNestedLoops()
$this->assertEquals('10-0 10-1 10-2 20-0 20-1 20-2 30-0 30-1 30-2 40-0 40-1 40-2 50-0 50-1 50-2', $result);
}


public function testXmlnsFigIsNotRendered()
{
$template = <<<ENDTEMPLATE
<html xmlns:fig="http://figdice.org/">
</html>
ENDTEMPLATE;

$view = new View();
$view->loadString($template);
$actual = $view->render();

$expected = "<html>\n</html>";
$this->assertEquals($expected, $actual);
}

}


Expand Down

0 comments on commit 5a884cd

Please sign in to comment.