From 134709b6b358eb884be368551791d01acde6d9bd Mon Sep 17 00:00:00 2001 From: zzjjbb <31069326+zzjjbb@users.noreply.github.com> Date: Mon, 21 Jun 2021 11:55:02 -0400 Subject: [PATCH] Update common.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep all line breaks in Readmemd / 保留Readmemd内容的全部换行 --- common.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common.php b/common.php index b011a80..f93ae71 100644 --- a/common.php +++ b/common.php @@ -2565,8 +2565,8 @@ function render_list($path = '', $files = []) $html = $tmp[0]; $tmp = splitfirst($tmp[1], ''); if (isset($files['list']['readme.md'])) { - $Readmemd = str_replace('', get_content(spurlencode(path_format($path . '/readme.md'),'/'))['content']['body'], $tmp[0]); - $html .= $Readmemd . $tmp[1]; + $Readmemd = get_content(spurlencode(path_format($path . '/readme.md'),'/'))['content']['body']; + $html .= $tmp[0] . $tmp[1]; while (strpos($html, '')) { $html = str_replace('', '', $html); $html = str_replace('', '', $html); @@ -2671,6 +2671,9 @@ function render_list($path = '', $files = []) //while (strpos($html, "\r\r")) $html = str_replace("\r\r", "\r", $html); while (strpos($html, "\n\n")) $html = str_replace("\n\n", "\n", $html); //while (strpos($html, PHP_EOL.PHP_EOL)) $html = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $html); + if (isset($Readmemd)) { + $html = str_replace('', $Readmemd, $html); + } // 保留Readmemd的换行 $exetime = round(microtime(true)-$_SERVER['php_starttime'],3); //$ip2city = json_decode(curl('GET', 'http://ip.taobao.com/outGetIpInfo?ip=' . $_SERVER['REMOTE_ADDR'] . '&accessKey=alibaba-inc')['body'], true);