Add html viewing

This commit is contained in:
Senad Uka
2023-08-05 10:58:20 +02:00
parent 517486689e
commit 39a0d3fe00
30 changed files with 11537 additions and 1 deletions

88
cethttp/template.go Normal file
View File

@@ -0,0 +1,88 @@
package cethttp
import (
"html/template"
"strings"
)
const html5Template = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>IslamBosna</title>
<style>
html, body {
background-color: #171714;
color: #f9f5c3;
font-family: sans-serif;
justify-content: center;
}
header {
width: 100%;
padding-top: 0.5em;
padding-bottom: 0.5em;
font-family: sans-serif;
font-size: 3em;
background-color: #0f1115;
justify-content: center;
}
header div, content div {
max-width: 800px;
margin: auto;
}
a:link, a:visited {
color: #f9f5c3;
}
header a:link {
color: #f9f5c3;
text-decoration: none;
}
header a:visited {
color: #f9f5c3;
text-decoration: none;
}
h1 {
color: #e6fbfb;
}
</style>
</head>
<body>
<header>
<div>
☙ <a href="/">IslamBosna</a>
</div>
</header>
<content>
<div>
{{.}}
</div>
<div>
<br><br>
<h2>Ostalo</h2>
<a href="/a/">Arhiva</a><br>
<a href="gemini://www.islambosna.ba/">Gemini stranica</a>
</div>
</content>
<footer>
&nbsp;
</footer>
</body>
</html>
`
func html5Page(html string) string {
t1 := template.New("html5Template")
t1, _ = t1.Parse(html5Template)
result := new(strings.Builder)
// execute template with html as data into result string io writer stream
t1.Execute(result, template.HTML(html))
return result.String()
}