2019-09-29 08:17:31 +02:00
package moe.kageru.kodeshare.pages
import io.ktor.html.HtmlContent
import kotlinx.html.*
object PastePage {
2020-03-12 10:57:28 +01:00
fun build ( content : String , uri : String , type : String ? ) = HtmlContent {
2019-09-29 08:17:31 +02:00
head {
2020-03-12 11:14:36 +01:00
defaultHead ( " View paste $uri ${type?.let { " (type $it)" } ?: " " } " )
2019-09-29 08:17:31 +02:00
link (
rel = " stylesheet " ,
href = " https://p.kageru.moe/static/hljs.css " ,
type = " text/css "
)
script ( src = " https://p.kageru.moe/static/hl.js " ) { }
2020-03-12 10:40:25 +01:00
// Show the first 3 lines in preview/embed for applications like discord, slack, or skype
meta ( content = content . lines ( ) . take ( 3 ) . joinToString ( " \n " ) ) {
attributes [ " property " ] = " og:description "
}
2019-10-31 13:01:18 +01:00
unsafe {
+ " <script>hljs.initHighlightingOnLoad();</script> "
2019-10-31 13:04:55 +01:00
+ " <style>html{scrollbar-color: transparent transparent;}::-webkit-scrollbar{display: none;}</style> "
2019-10-31 13:01:18 +01:00
}
2019-09-29 08:17:31 +02:00
}
body {
pre {
2019-09-29 09:51:15 +02:00
code ( classes = type ) {
2019-09-29 08:17:31 +02:00
+ content
}
}
2019-09-29 11:50:14 +02:00
a ( " / " ) {
div ( Css . FLOATY _CLASS ) {
2019-09-29 10:15:42 +02:00
+ " New paste "
}
}
2019-09-29 08:17:31 +02:00
}
}
}