mirror of
https://gitee.com/novel_dev_team/novel-plus
synced 2026-07-20 17:54:59 +08:00
perf(novel-crawl): 去除小说内容末尾的所有换行
This commit is contained in:
@@ -238,6 +238,8 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 去除小说内容末尾的所有换行
|
||||||
|
content = removeTrailingBrTags(content);
|
||||||
//插入章节目录和章节内容
|
//插入章节目录和章节内容
|
||||||
BookIndex bookIndex = new BookIndex();
|
BookIndex bookIndex = new BookIndex();
|
||||||
bookIndex.setIndexName(indexName);
|
bookIndex.setIndexName(indexName);
|
||||||
@@ -314,4 +316,12 @@ public class CrawlParser {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字符串末尾的所有 <br> 类似标签(允许各种空格)
|
||||||
|
*/
|
||||||
|
public static String removeTrailingBrTags(String str) {
|
||||||
|
return str.replaceAll("(?i)(?:\\s*<\\s*br\\s*/?\\s*>)++(?:\\s|\\u3000)*$", "");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user