Files
soundcloak/templates/base.templ

54 lines
1.1 KiB
Plaintext

package templates
import (
"github.com/maid-zone/soundcloak/lib/cfg"
"github.com/maid-zone/soundcloak/lib/textparsing"
)
templ Base(title string, content templ.Component, head templ.Component) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/instance.css"/>
if title != "" {
<title>{ title } ~ soundcloak</title>
} else {
<title>soundcloak</title>
}
if head != nil {
@head
}
</head>
<body>
if cfg.Debug {
<h1>!! running in debug mode !!</h1>
}
<a href="/" id="sc"><h1>soundcloak</h1></a>
@content
</body>
</html>
}
templ Description(prefs cfg.Preferences, text string, injected templ.Component) {
if text != "" || injected != nil {
<details>
<summary>Toggle description</summary>
<p style="white-space: pre-wrap;">
if text != "" {
if *prefs.ParseDescriptions {
@templ.Raw(textparsing.Format(text))
} else {
{ text }
}
}
if injected != nil {
@injected
}
</p>
</details>
}
}