Implement support for "lang" media type parameter
This commit is contained in:
parent
a584df6afa
commit
c2f510eb79
1 changed files with 5 additions and 1 deletions
6
main.go
6
main.go
|
@ -131,7 +131,7 @@ var gemtextPage = template.Must(template.
|
||||||
</style>
|
</style>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<title>{{.Title}}</title>
|
<title>{{.Title}}</title>
|
||||||
<article>
|
<article{{if .Lang}} lang="{{.Lang}}"{{end}}>
|
||||||
{{ $ctx := . -}}
|
{{ $ctx := . -}}
|
||||||
{{- $isList := false -}}
|
{{- $isList := false -}}
|
||||||
{{- range .Lines -}}
|
{{- range .Lines -}}
|
||||||
|
@ -364,6 +364,7 @@ type GemtextContext struct {
|
||||||
Pre int
|
Pre int
|
||||||
Resp *gemini.Response
|
Resp *gemini.Response
|
||||||
Title string
|
Title string
|
||||||
|
Lang string
|
||||||
URL *url.URL
|
URL *url.URL
|
||||||
Root *url.URL
|
Root *url.URL
|
||||||
}
|
}
|
||||||
|
@ -476,12 +477,15 @@ func proxyGemini(req gemini.Request, external bool, root *url.URL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lang := params["lang"]
|
||||||
|
|
||||||
w.Header().Add("Content-Type", "text/html")
|
w.Header().Add("Content-Type", "text/html")
|
||||||
ctx := &GemtextContext{
|
ctx := &GemtextContext{
|
||||||
CSS: css,
|
CSS: css,
|
||||||
External: external,
|
External: external,
|
||||||
Resp: resp,
|
Resp: resp,
|
||||||
Title: req.URL.Host + " " + req.URL.Path,
|
Title: req.URL.Host + " " + req.URL.Path,
|
||||||
|
Lang: lang,
|
||||||
URL: req.URL,
|
URL: req.URL,
|
||||||
Root: root,
|
Root: root,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue