Skip to content

Commit

Permalink
Fix several whitespace issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 20, 2017
1 parent 317d6df commit f2dba44
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions framework/Yaml/lib/Horde/Yaml/Loader.php
Expand Up @@ -145,7 +145,7 @@ public function parse($line)
// If we're in a block, add the text to the parent's data
if ($this->_inBlock) {
$parent =& $this->_allNodes[$this->_lastNode];
$parent->data[key($parent->data)] .= trim($line) . $this->_blockEnd;
$parent->data[key($parent->data)] .= $this->_blockEnd . trim($line);
} else {
// The current node's parent is the same as the previous
// node's
Expand All @@ -171,18 +171,18 @@ public function parse($line)
$chk = $parent->data[key($parent->data)];
if ($chk === '>') {
$this->_inBlock = true;
$this->_blockEnd = '';
$this->_blockEnd = ' ';
$parent->data[key($parent->data)] =
str_replace('>', '', $parent->data[key($parent->data)]);
$parent->data[key($parent->data)] .= trim($line) . ' ';
$parent->data[key($parent->data)] .= trim($line);
$parent->children = false;
$this->_lastIndent = $node->indent;
} elseif ($chk === '|') {
$this->_inBlock = true;
$this->_blockEnd = "\n";
$parent->data[key($parent->data)] =
str_replace('|', '', $parent->data[key($parent->data)]);
$parent->data[key($parent->data)] .= trim($line) . "\n";
$parent->data[key($parent->data)] .= trim($line);
$parent->children = false;
$this->_lastIndent = $node->indent;
}
Expand All @@ -193,10 +193,9 @@ public function parse($line)
// Any block we had going is dead now
if ($this->_inBlock) {
$this->_inBlock = false;
if ($this->_blockEnd == "\n") {
if ($this->_blockEnd == "\n" || $this->_blockEnd == ' ') {
$last =& $this->_allNodes[$this->_lastNode];
$last->data[key($last->data)] =
trim($last->data[key($last->data)]);
$last->data[key($last->data)] .= "\n";
}
}

Expand Down

0 comments on commit f2dba44

Please sign in to comment.