From 9c5c404c71798b159c48e84b83399a86df2c8b07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A5=81=E5=AE=81?=
Date: Thu, 16 Oct 2014 16:07:59 +0800
Subject: [PATCH] fix autop
---
var/Typecho/AutoP.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/var/Typecho/AutoP.php b/var/Typecho/AutoP.php
index ac7e6435..055666fd 100644
--- a/var/Typecho/AutoP.php
+++ b/var/Typecho/AutoP.php
@@ -49,6 +49,7 @@ class AutoP
private function cutByBlock($text)
{
$space = "( | )";
+ $text = str_replace("\r\n", "\n", trim($text));
$text = preg_replace("/{$space}*\n{$space}*/is", "\n", $text);
$text = preg_replace("/\s*\s*/is", "
", $text);
$text = preg_replace("/\n{2,}/", "
", $text);
@@ -95,7 +96,7 @@ class AutoP
switch (true) {
/** 用br处理换行 */
- case false !== strpos('|li|dd|dt|td|p|a|span|code|cite|strong|sup|sub|small|del|u|i|b|ins|h1|h2|h3|h4|h5|h6|', $tagMatch):
+ case false !== strpos('|li|dd|dt|td|p|a|span|cite|strong|sup|sub|small|del|u|i|b|ins|h1|h2|h3|h4|h5|h6|', $tagMatch):
$text = nl2br(trim($text));
break;
/** 用段落处理换行 */