Update vendor folder.

Former-commit-id: dde7c53eee254e2f50608e65540893764ab8d9cb
This commit is contained in:
John-David Dalton
2012-07-10 14:26:35 -04:00
parent 3b37d7489f
commit db257778c0
6 changed files with 104 additions and 66 deletions

View File

@@ -87,9 +87,28 @@ class Generator {
* @returns {String} The formatted string.
*/
private static function format($string) {
// mark numbers as code and italicize parentheses
return trim(preg_replace('/(^|\s)(\([^)]+\))/', '$1*$2*',
preg_replace('/ (-?\d+(?:.\d+)?)(?!\.[^\n])/', ' `$1`', $string)));
$counter = 0;
// tokenize inline code snippets
preg_match_all('/`[^`]+`/', $string, $tokenized);
$tokenized = $tokenized[0];
foreach ($tokenized as $snippet) {
$string = str_replace($snippet, '__token' . ($counter++) .'__', $string);
}
// italicize parentheses
$string = preg_replace('/(^|\s)(\([^)]+\))/', '$1*$2*', $string);
// mark numbers as inline code
$string = preg_replace('/ (-?\d+(?:.\d+)?)(?!\.[^\n])/', ' `$1`', $string);
// detokenize inline code snippets
$counter = 0;
foreach ($tokenized as $snippet) {
$string = str_replace('__token' . ($counter++) . '__', $snippet, $string);
}
return trim($string);
}
/**
@@ -388,4 +407,4 @@ class Generator {
return trim(preg_replace('/ +\n/', "\n", join($result, "\n")));
}
}
?>
?>