mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
commit
c98f99286b
@ -36,14 +36,21 @@ public class ResourceUtil {
|
|||||||
* @return 返回Resource
|
* @return 返回Resource
|
||||||
*/
|
*/
|
||||||
public static Resource createChapterResource(String title, String txt, String model, String href) {
|
public static Resource createChapterResource(String title, String txt, String model, String href) {
|
||||||
if (title.contains("\n")) {
|
//String[] title_list = title.split("\\s+", 2);
|
||||||
title = "<span class=\"chapter-sequence-number\">" + title.replaceFirst("\\s*\\n\\s*", "</span><br />");
|
//String title_part1 = title_list[0];
|
||||||
} else {
|
//String title_part2 = "";
|
||||||
title = title.replaceFirst("\\s+", "</span><br />");
|
//if (title_list.length == 2) {
|
||||||
if (title.contains("</span>"))
|
// title_part2 = title_list[1];
|
||||||
title = "<span class=\"chapter-sequence-number\">" + title;
|
//}
|
||||||
|
String ori_title = title;
|
||||||
|
title = title.replaceFirst("\\s+", "</span><br />");
|
||||||
|
if (title.contains("</span>")) {
|
||||||
|
title = "<span class=\"chapter-sequence-number\">" + title;
|
||||||
}
|
}
|
||||||
String html = model.replace("{title}", title)
|
String html = model.replace("{title}", title)
|
||||||
|
.replace("{ori_title}", ori_title)
|
||||||
|
//.replace("{title_part1}", title_part1)
|
||||||
|
//.replace("{title_part2}", title_part2)
|
||||||
.replace("{content}", StringUtil.formatHtml(txt));
|
.replace("{content}", StringUtil.formatHtml(txt));
|
||||||
return new Resource(html.getBytes(), href);
|
return new Resource(html.getBytes(), href);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user