1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 11:46:16 +00:00

Move assets from templates to the assets module

This commit is contained in:
bouncepaw 2021-02-23 19:41:22 +05:00
parent 170240177e
commit 22420bf690
8 changed files with 97 additions and 97 deletions

View File

@ -1,28 +1,28 @@
// Code generated by qtc from "asset.qtpl". DO NOT EDIT.
// Code generated by qtc from "assets.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
//line templates/asset.qtpl:1
package templates
//line assets/assets.qtpl:1
package assets
//line templates/asset.qtpl:1
//line assets/assets.qtpl:1
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line templates/asset.qtpl:1
//line assets/assets.qtpl:1
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line templates/asset.qtpl:1
//line assets/assets.qtpl:1
func StreamDefaultCSS(qw422016 *qt422016.Writer) {
//line templates/asset.qtpl:1
//line assets/assets.qtpl:1
qw422016.N().S(`
`)
//line templates/asset.qtpl:2
//line assets/assets.qtpl:2
qw422016.N().S(`.modal__title { font-size: 2rem; }
.modal__confirmation-msg { margin: 0 0 .5rem 0; }
.modal__action { display: inline-block; font-size: 1rem; padding: .25rem; border-radius: .25rem; }
@ -295,168 +295,168 @@ mark { background: rgba(130, 80, 30, 5); color: inherit; }
.backlinks { display: none; }
`)
//line templates/asset.qtpl:2
//line assets/assets.qtpl:2
qw422016.N().S(`
`)
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
}
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
func WriteDefaultCSS(qq422016 qtio422016.Writer) {
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
StreamDefaultCSS(qw422016)
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
qt422016.ReleaseWriter(qw422016)
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
}
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
func DefaultCSS() string {
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
qb422016 := qt422016.AcquireByteBuffer()
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
WriteDefaultCSS(qb422016)
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
qs422016 := string(qb422016.B)
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
qt422016.ReleaseByteBuffer(qb422016)
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
return qs422016
//line templates/asset.qtpl:3
//line assets/assets.qtpl:3
}
// Next three are from https://remixicon.com/
//line templates/asset.qtpl:6
//line assets/assets.qtpl:6
func StreamIconHTTP(qw422016 *qt422016.Writer) {
//line templates/asset.qtpl:6
//line assets/assets.qtpl:6
qw422016.N().S(`
`)
//line templates/asset.qtpl:7
//line assets/assets.qtpl:7
qw422016.N().S(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="#999" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"/></svg>
`)
//line templates/asset.qtpl:7
//line assets/assets.qtpl:7
qw422016.N().S(`
`)
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
}
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
func WriteIconHTTP(qq422016 qtio422016.Writer) {
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
StreamIconHTTP(qw422016)
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
qt422016.ReleaseWriter(qw422016)
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
}
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
func IconHTTP() string {
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
qb422016 := qt422016.AcquireByteBuffer()
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
WriteIconHTTP(qb422016)
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
qs422016 := string(qb422016.B)
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
qt422016.ReleaseByteBuffer(qb422016)
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
return qs422016
//line templates/asset.qtpl:8
//line assets/assets.qtpl:8
}
//line templates/asset.qtpl:10
//line assets/assets.qtpl:10
func StreamIconGemini(qw422016 *qt422016.Writer) {
//line templates/asset.qtpl:10
//line assets/assets.qtpl:10
qw422016.N().S(`
`)
//line templates/asset.qtpl:11
//line assets/assets.qtpl:11
qw422016.N().S(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="#999" d="M15.502 20A6.523 6.523 0 0 1 12 23.502 6.523 6.523 0 0 1 8.498 20h2.26c.326.489.747.912 1.242 1.243.495-.33.916-.754 1.243-1.243h2.259zM18 14.805l2 2.268V19H4v-1.927l2-2.268V9c0-3.483 2.504-6.447 6-7.545C15.496 2.553 18 5.517 18 9v5.805zM17.27 17L16 15.56V9c0-2.318-1.57-4.43-4-5.42C9.57 4.57 8 6.681 8 9v6.56L6.73 17h10.54zM12 11a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"/></svg>
`)
//line templates/asset.qtpl:11
//line assets/assets.qtpl:11
qw422016.N().S(`
`)
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
}
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
func WriteIconGemini(qq422016 qtio422016.Writer) {
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
StreamIconGemini(qw422016)
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
qt422016.ReleaseWriter(qw422016)
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
}
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
func IconGemini() string {
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
qb422016 := qt422016.AcquireByteBuffer()
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
WriteIconGemini(qb422016)
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
qs422016 := string(qb422016.B)
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
qt422016.ReleaseByteBuffer(qb422016)
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
return qs422016
//line templates/asset.qtpl:12
//line assets/assets.qtpl:12
}
//line templates/asset.qtpl:14
//line assets/assets.qtpl:14
func StreamIconMailto(qw422016 *qt422016.Writer) {
//line templates/asset.qtpl:14
//line assets/assets.qtpl:14
qw422016.N().S(`
`)
//line templates/asset.qtpl:15
//line assets/assets.qtpl:15
qw422016.N().S(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="#999" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm17 4.238l-7.928 7.1L4 7.216V19h16V7.238zM4.511 5l7.55 6.662L19.502 5H4.511z"/></svg>
`)
//line templates/asset.qtpl:15
//line assets/assets.qtpl:15
qw422016.N().S(`
`)
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
}
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
func WriteIconMailto(qq422016 qtio422016.Writer) {
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
StreamIconMailto(qw422016)
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
qt422016.ReleaseWriter(qw422016)
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
}
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
func IconMailto() string {
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
qb422016 := qt422016.AcquireByteBuffer()
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
WriteIconMailto(qb422016)
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
qs422016 := string(qb422016.B)
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
qt422016.ReleaseByteBuffer(qb422016)
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
return qs422016
//line templates/asset.qtpl:16
//line assets/assets.qtpl:16
}
// This is a modified version of https://www.svgrepo.com/svg/232085/rat
//line templates/asset.qtpl:19
//line assets/assets.qtpl:19
func StreamIconGopher(qw422016 *qt422016.Writer) {
//line templates/asset.qtpl:19
//line assets/assets.qtpl:19
qw422016.N().S(`
`)
//line templates/asset.qtpl:20
//line assets/assets.qtpl:20
qw422016.N().S(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16">
<path fill="#999" d="M447.238,204.944v-70.459c0-8.836-7.164-16-16-16c-34.051,0-64.414,21.118-75.079,55.286
C226.094,41.594,0,133.882,0,319.435c0,0.071,0.01,0.14,0.011,0.21c0.116,44.591,36.423,80.833,81.04,80.833h171.203
@ -469,34 +469,34 @@ c55.425-8.382,107.014,29.269,115.759,84.394H295.484z"/>
<circle fill="#999" cx="415.238" cy="260.05" r="21.166"/>
</svg>
`)
//line templates/asset.qtpl:20
//line assets/assets.qtpl:20
qw422016.N().S(`
`)
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
}
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
func WriteIconGopher(qq422016 qtio422016.Writer) {
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
StreamIconGopher(qw422016)
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
qt422016.ReleaseWriter(qw422016)
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
}
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
func IconGopher() string {
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
qb422016 := qt422016.AcquireByteBuffer()
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
WriteIconGopher(qb422016)
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
qs422016 := string(qb422016.B)
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
qt422016.ReleaseByteBuffer(qb422016)
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
return qs422016
//line templates/asset.qtpl:21
//line assets/assets.qtpl:21
}

View File

Before

Width:  |  Height:  |  Size: 473 B

After

Width:  |  Height:  |  Size: 473 B

View File

Before

Width:  |  Height:  |  Size: 951 B

After

Width:  |  Height:  |  Size: 951 B

View File

Before

Width:  |  Height:  |  Size: 627 B

After

Width:  |  Height:  |  Size: 627 B

View File

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 261 B

14
main.go
View File

@ -1,5 +1,5 @@
//go:generate go get -u github.com/valyala/quicktemplate/qtc
//go:generate qtc -dir=templates
//go:generate qtc -dir=assets
//go:generate qtc -dir=views
package main
@ -12,10 +12,10 @@ import (
"os"
"strings"
"github.com/bouncepaw/mycorrhiza/assets"
"github.com/bouncepaw/mycorrhiza/history"
"github.com/bouncepaw/mycorrhiza/hyphae"
"github.com/bouncepaw/mycorrhiza/shroom"
"github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
@ -102,7 +102,7 @@ func handlerStyle(w http.ResponseWriter, rq *http.Request) {
http.ServeFile(w, rq, util.WikiDir+"/static/common.css")
} else {
w.Header().Set("Content-Type", "text/css;charset=utf-8")
w.Write([]byte(templates.DefaultCSS()))
w.Write([]byte(assets.DefaultCSS()))
}
if bytes, err := ioutil.ReadFile(util.WikiDir + "/static/custom.css"); err == nil {
w.Write(bytes)
@ -126,13 +126,13 @@ func handlerIcon(w http.ResponseWriter, rq *http.Request) {
w.Header().Set("Content-Type", "image/svg+xml")
switch iconName {
case "gemini":
w.Write([]byte(templates.IconGemini()))
w.Write([]byte(assets.IconGemini()))
case "mailto":
w.Write([]byte(templates.IconMailto()))
w.Write([]byte(assets.IconMailto()))
case "gopher":
w.Write([]byte(templates.IconGopher()))
w.Write([]byte(assets.IconGopher()))
default:
w.Write([]byte(templates.IconHTTP()))
w.Write([]byte(assets.IconHTTP()))
}
}