equal
deleted
inserted
replaced
1 package sqwl.cms |
1 package sqwl.cms |
2 |
2 |
3 import java.nio.file.Path |
3 import java.nio.file.Path |
4 |
|
5 import scala.io.Source |
|
6 |
4 |
7 trait FsArticle extends iArticle { |
5 trait FsArticle extends iArticle { |
8 |
6 |
9 protected def contentPath: Path |
7 protected def contentPath: Path |
10 protected def encoding: String = "UTF-8" |
8 protected def encoding: String = "UTF-8" |
11 |
9 |
12 override def htmlContent: String = { |
10 override def htmlContent: String = |
13 val src = Source.fromFile(contentPath.toFile, encoding) |
11 readFile(contentPath, encoding) getOrElse "" |
14 try { |
|
15 src.getLines.mkString |
|
16 } catch { |
|
17 case _: Throwable => "" |
|
18 } finally { |
|
19 src.close() |
|
20 } |
|
21 } |
|
22 } |
12 } |