1 Star 0 Fork 7

胡中泽 / php

forked from OpenCloudOS Stream / php 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
news2markdown.php 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
ZoeDong 提交于 2023-08-31 17:14 . Bump version to 8.2.9
#!/usr/bin/env php
<?php
if ($_SERVER['argc'] < 2) {
die("Usage {$_SERVER['argv'][0]} /path/to/NEWS\n");
}
$text = file_get_contents($_SERVER['argv'][1]);
if (!$text) {
die("Can't read {$_SERVER['argv'][1]}\n");
}
$debug = (isset($_SERVER['argv'][2]) && $_SERVER['argv'][2]==-'d');
$text = explode("\n", $text);
$in=false;
foreach ($text as $line) {
if (preg_match('/(^[0-9]+ .* 20[0-9][0-9])[,]* PHP (.*)$/', $line, $reg)) {
if ($in) {
break;
}
printf("**PHP version %s** (%s)", $reg[2], $reg[1]);
$in = true;
continue;
} else if (!$in) {
if ($debug) echo "+ Ignore $line\n";
continue;
}
$github = 'https://github.com/php/php-src';
$line = preg_replace('/(#[0-9]+)/', 'php\1', $line);
$line = preg_replace('/(GH-([0-9]+))/', "[\\1]($github/issues/\\2)", $line);
$line = preg_replace('/(GHSA-([^ ]+))/', "[\\1]($github/security/advisories/\\1)", $line);
$line = preg_replace('/(CVE-[0-9]+-[0-9]+)/', '**\1**', $line);
if (empty($line)) {
echo "\n\n";
} else if (substr($line, 0, 2) == '- ') {
echo "**" . substr($line, 2) . "**\n";
} else if (substr($line, 0, 4) == ' . ') {
echo "\n* " . substr($line, 4);
} else {
echo " ".trim($line);
}
}
1
https://gitee.com/joshua_hu/php.git
git@gitee.com:joshua_hu/php.git
joshua_hu
php
php
master

搜索帮助