Skip to content

Commit

Permalink
ignored an old behavour of libxml. Need to check on various platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
zzgab committed Jan 2, 2016
1 parent 49e3ef9 commit 30dd7a4
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/figdice/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ class View {
* @var boolean
*/
private $firstOpening;
/**
* Used internally with $firstOpening, to help detecting the auto-closing tags.
* @var integer
*/
private $firstTagOffset;

/**
* Cache of Lexers.
Expand Down Expand Up @@ -537,8 +532,6 @@ public function setDoctype($doctype)
private function openTagHandler($xmlParser, $tagName, $attributes) {
if($this->firstOpening) {
$this->firstOpening = false;
$positionOfFirstTag = xml_get_current_byte_index($xmlParser);
$this->firstTagOffset = strpos($this->source, "<$tagName") - $positionOfFirstTag;

//Position the namespace:
$matches = null;
Expand Down Expand Up @@ -611,10 +604,7 @@ public function closeTagHandler($xmlParser, $tagName) {
return;
}
//Find the opening bracket < of the closing tag:
$latestOpeningBracket = strrpos(substr($this->source, 0, $pos + $this->firstTagOffset+1), '<');
//Very risky. Work with libxml 2.6.26 on Windows XP Pro 32bit.
//Unsure for any other platform...
//TODO: Anyway it works only for top-level fig file. Not for included files, it seems.
$latestOpeningBracket = strrpos(substr($this->source, 0, $pos + 1), '<');
if(!preg_match('#^<[^>]+/>#', substr($this->source, $latestOpeningBracket))) {
$element->autoclose = false;
}
Expand Down

0 comments on commit 30dd7a4

Please sign in to comment.