@@ -29,11 +29,11 @@ public class ChapterConverter {
2929 private final TemplateEngine engine = TemplateUtil .createEngine (new TemplateConfig ("templates" , TemplateConfig .ResourceMode .CLASSPATH ));
3030
3131 public Chapter convert (Chapter chapter ) {
32- String extName = config .getExtName ();
32+ String extName = config .getExtName (). toLowerCase () ;
3333 String filteredContent = new ChapterFilter (config ).filter (chapter );
3434 String content = new ChapterFormatter (config ).format (filteredContent );
3535
36- if ("txt" .equalsIgnoreCase (extName )) {
36+ if ("txt" .equals (extName )) {
3737 // 全角空格,用于首行缩进
3838 String ident = "\u3000 " .repeat (2 );
3939 Matcher matcher = Pattern .compile ("<p>(.*?)</p>" ).matcher (content );
@@ -47,7 +47,7 @@ public Chapter convert(Chapter chapter) {
4747
4848 content = chapter .getTitle () + "\n " .repeat (2 ) + result ;
4949 }
50- if ("epub" .equalsIgnoreCase (extName ) || "html" .equalsIgnoreCase (extName )) {
50+ if ("epub" .equals (extName ) || "html" .equals (extName )) {
5151 chapter .setContent (content );
5252 content = templateRender (chapter , extName );
5353 }
@@ -60,7 +60,7 @@ public Chapter convert(Chapter chapter) {
6060 * 根据扩展名渲染对应模板
6161 */
6262 private String templateRender (Chapter chapter , String extName ) {
63- // 符合 epub 标准的模板
63+ // epub 或 html 模板
6464 Template template = engine .getTemplate (StrUtil .format ("chapter_{}.flt" , extName ));
6565 Map <String , String > map = new HashMap <>();
6666 map .put ("title" , chapter .getTitle ());
0 commit comments