base/src/sqwl/cms/package.scala
changeset 23 afcfbdeb3b88
parent 18 8cfd67425811
child 34 775d6da26993
equal deleted inserted replaced
22:b5c85ad66f17 23:afcfbdeb3b88
     2 
     2 
     3 import java.nio.file.Path
     3 import java.nio.file.Path
     4 
     4 
     5 import scala.io.Source
     5 import scala.io.Source
     6 import scala.util.{Failure, Success, Try}
     6 import scala.util.{Failure, Success, Try}
       
     7 import scalatags.Text.all._
     7 
     8 
     8 package object cms {
     9 package object cms {
     9 
    10 
    10   def readSourceFull(src: Source): Try[String] = {
    11   def readSourceFull(src: Source): Try[String] = {
    11     try {
    12     try {
    21     readSourceFull(Source.fromFile(f.toFile, enc))
    22     readSourceFull(Source.fromFile(f.toFile, enc))
    22 
    23 
    23   def readFile(f: String): String =
    24   def readFile(f: String): String =
    24     readSourceFull(Source.fromFile(f, "UTF-8")) getOrElse ""
    25     readSourceFull(Source.fromFile(f, "UTF-8")) getOrElse ""
    25 
    26 
       
    27   def lnk(name: String, customUrl: String = ""): Frag = {
       
    28     val usedUrl = if (customUrl == "") name else customUrl
       
    29     a(name, href := usedUrl)
       
    30   }
    26 }
    31 }