diff -r 7c4b05467630 -r 1e1b0a1a4d63 base/src/sqwl/cms/FsArticle.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/src/sqwl/cms/FsArticle.scala Tue Dec 11 15:03:57 2018 +0100 @@ -0,0 +1,22 @@ +package sqwl.cms + +import java.nio.file.Path + +import scala.io.Source + +trait FsArticle extends iArticle { + + protected def contentPath: Path + protected def encoding: String = "UTF-8" + + override def htmlContent: String = { + val src = Source.fromFile(contentPath.toFile, encoding) + try { + src.getLines.mkString + } catch { + case _: Throwable => "" + } finally { + src.close() + } + } +}