|
|
@ -13,6 +13,7 @@ class Reader |
|
|
|
'~URL:base~' => null, |
|
|
|
'~URL:base~' => null, |
|
|
|
'~IPv6:open~' => '[', |
|
|
|
'~IPv6:open~' => '[', |
|
|
|
'~IPv6:close~' => ']', |
|
|
|
'~IPv6:close~' => ']', |
|
|
|
|
|
|
|
'~LINE:break~' => PHP_EOL |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
private array $_rule = |
|
|
|
private array $_rule = |
|
|
@ -88,7 +89,7 @@ class Reader |
|
|
|
'/^[\s]+\*/' => '*', |
|
|
|
'/^[\s]+\*/' => '*', |
|
|
|
|
|
|
|
|
|
|
|
// Separators |
|
|
|
// Separators |
|
|
|
'/[\\\]{2}/' => PHP_EOL, |
|
|
|
'/[\\\]{2}/' => '~LINE:break~', |
|
|
|
|
|
|
|
|
|
|
|
// Plugins |
|
|
|
// Plugins |
|
|
|
'/~~DISCUSSION~~/' => '', // @TODO |
|
|
|
'/~~DISCUSSION~~/' => '', // @TODO |
|
|
@ -240,14 +241,7 @@ class Reader |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Apply config |
|
|
|
// Apply config |
|
|
|
$lines[] = str_replace( |
|
|
|
$lines[] = preg_replace( |
|
|
|
array_keys( |
|
|
|
|
|
|
|
$this->_macros |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
array_values( |
|
|
|
|
|
|
|
$this->_macros |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
preg_replace( |
|
|
|
|
|
|
|
array_keys( |
|
|
|
array_keys( |
|
|
|
$this->_rule |
|
|
|
$this->_rule |
|
|
|
), |
|
|
|
), |
|
|
@ -257,7 +251,6 @@ class Reader |
|
|
|
strip_tags( |
|
|
|
strip_tags( |
|
|
|
$line |
|
|
|
$line |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -270,10 +263,17 @@ class Reader |
|
|
|
|
|
|
|
|
|
|
|
foreach ($lines as $index => $line) |
|
|
|
foreach ($lines as $index => $line) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
// Strip line breaks |
|
|
|
|
|
|
|
$line = str_replace( |
|
|
|
|
|
|
|
'~LINE:break~', |
|
|
|
|
|
|
|
' ', |
|
|
|
|
|
|
|
$line |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Header |
|
|
|
// Header |
|
|
|
if (!$table && preg_match_all('/\^([^\^]+)/', $line, $matches)) |
|
|
|
if (!$table && preg_match_all('/\^([^\^]+)/', $line, $matches)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (isset($matches[1]) && count($matches[1]) > 1) |
|
|
|
if (!empty($matches[1])) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$table = true; |
|
|
|
$table = true; |
|
|
|
|
|
|
|
|
|
|
@ -338,10 +338,18 @@ class Reader |
|
|
|
return preg_replace( |
|
|
|
return preg_replace( |
|
|
|
'/[\n\r]{2,}/', |
|
|
|
'/[\n\r]{2,}/', |
|
|
|
PHP_EOL . PHP_EOL, |
|
|
|
PHP_EOL . PHP_EOL, |
|
|
|
|
|
|
|
str_replace( |
|
|
|
|
|
|
|
array_keys( |
|
|
|
|
|
|
|
$this->_macros |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
array_values( |
|
|
|
|
|
|
|
$this->_macros |
|
|
|
|
|
|
|
), |
|
|
|
implode( |
|
|
|
implode( |
|
|
|
PHP_EOL, |
|
|
|
PHP_EOL, |
|
|
|
$lines |
|
|
|
$lines |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|