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