Skip to content

Commit 8743f6c

Browse files
committed
Minor refactor for NEWS rewrite rules
1 parent 46473cc commit 8743f6c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

bin/news2html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ echo <<<HEAD
6060
<ul>
6161
HEAD;
6262

63+
$bug_map = [
64+
'/Fixed bug #([0-9]+)/' => '<?php bugfix(\1); ?'.'>',
65+
'/Fixed PECL bug #([0-9]+)/' => '<?php peclbugfix(\1); ?'.'>',
66+
'/Implemented FR #([0-9]+)/' => '<?php implemented(\1); ?'.'>',
67+
'/GitHub PR #([0-9]+)/' => '<?php githubissuel(\'php/php-src\',\1); ?'.'>',
68+
];
69+
6370
foreach($entries as $module => $items) {
6471
echo "<li>$module:\n<ul>\n";
6572
foreach($items as $item) {
@@ -68,11 +75,7 @@ foreach($entries as $module => $items) {
6875
// encode HTML
6976
$item = htmlspecialchars($item, ENT_NOQUOTES);
7077
// convert bug numbers
71-
$item = preg_replace(
72-
array('/Fixed bug #([0-9]+)/', '/Fixed PECL bug #([0-9]+)/', '/Implemented FR #([0-9]+)/', '/GitHub PR #([0-9]+)/'),
73-
array('<?php bugfix(\1); ?>', '<?php peclbugfix(\1); ?>', '<?php implemented(\1); ?>', '<?php githubissuel(\'php/php-src\',\1); ?>'),
74-
$item
75-
);
78+
$item = preg_replace(array_keys($bug_map), array_values($bug_map), $item);
7679
echo " <li>$item</li>\n";
7780
}
7881
echo "</ul></li>\n";

0 commit comments

Comments
 (0)