diff --git a/src/utils/Spyc.php b/src/utils/Spyc.php index c24fab290..5f9d4a571 100644 --- a/src/utils/Spyc.php +++ b/src/utils/Spyc.php @@ -1,32 +1,7 @@ * @author Chris Wanstrath * @link http://code.google.com/p/spyc/ @@ -35,28 +10,6 @@ THE SOFTWARE. * @package Spyc */ -if (!function_exists('spyc_load')) { - /** - * Parses YAML to array. - * @param string $string YAML string. - * @return array - */ - function spyc_load ($string) { - return Spyc::YAMLLoadString($string); - } -} - -if (!function_exists('spyc_load_file')) { - /** - * Parses YAML to array. - * @param string $file Path to YAML file. - * @return array - */ - function spyc_load_file ($file) { - return Spyc::YAMLLoad($file); - } -} - /** * The Simple PHP YAML Class. * @@ -458,18 +411,16 @@ class Spyc { $i--; } + // Strip out comments + if (strpos ($line, '#')) { + $line = preg_replace('/\s*#([^"\']+)$/','',$line); + } + while (++$i < $cnt && self::greedilyNeedNextLine($line)) { $line = rtrim ($line, " \n\t\r") . ' ' . ltrim ($Source[$i], " \t"); } $i--; - - - if (strpos ($line, '#')) { - if (strpos ($line, '"') === false && strpos ($line, "'") === false) - $line = preg_replace('/\s+#(.+)$/','',$line); - } - $lineArray = $this->_parseLine($line); if ($literalBlockStyle) @@ -678,7 +629,8 @@ class Spyc { } while (strpos ($inline, '[') !== false || strpos ($inline, '{') !== false); - $explode = explode(', ',$inline); + $explode = explode(',',$inline); + $explode = array_map('trim', $explode); $stringi = 0; $i = 0; while (1) {