mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 14:54:24 +01:00
Add support for Highlight (kind:9802)
This commit is contained in:
69
highlight.templ
Normal file
69
highlight.templ
Normal file
@@ -0,0 +1,69 @@
|
||||
package main
|
||||
|
||||
import "html/template"
|
||||
|
||||
type HighlightPageParams struct {
|
||||
BaseEventPageParams
|
||||
OpenGraphParams
|
||||
HeadParams
|
||||
|
||||
Details DetailsParams
|
||||
Content template.HTML
|
||||
HighlightEvent Kind9802Metadata
|
||||
Clients []ClientReference
|
||||
}
|
||||
|
||||
templ highlightInnerBlock(params HighlightPageParams) {
|
||||
<h1 class="text-2xl" itemprop="headline">Highlight</h1>
|
||||
<div itemprop="articleBody">
|
||||
if params.HighlightEvent.Comment != "" {
|
||||
<div dir="auto" class="leading-6">
|
||||
@templ.Raw(params.HighlightEvent.Comment)
|
||||
</div>
|
||||
}
|
||||
<blockquote dir="auto" class="text-xl leading-7">
|
||||
if params.HighlightEvent.MarkedContext != "" {
|
||||
@templ.Raw(params.HighlightEvent.MarkedContext)
|
||||
} else {
|
||||
@templ.Raw(params.Content)
|
||||
}
|
||||
<footer class="text-base mt-4">
|
||||
—
|
||||
if params.HighlightEvent.Author.Name != "" {
|
||||
{ params.HighlightEvent.Author.Name + "," }
|
||||
}
|
||||
<cite>
|
||||
if params.HighlightEvent.SourceURL != "" {
|
||||
<a href={ templ.SafeURL(params.HighlightEvent.SourceURL) }>{ params.HighlightEvent.SourceName }</a>
|
||||
}
|
||||
if params.HighlightEvent.SourceEvent != "" {
|
||||
<a href={ templ.SafeURL("/" + params.HighlightEvent.SourceEvent) }>{ params.HighlightEvent.SourceName }</a>
|
||||
}
|
||||
</cite>
|
||||
</footer>
|
||||
</blockquote>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ highlightTemplate(params HighlightPageParams, isEmbed bool) {
|
||||
<!DOCTYPE html>
|
||||
if isEmbed {
|
||||
@embeddedPageTemplate(
|
||||
params.Event,
|
||||
params.NeventNaked,
|
||||
) {
|
||||
@highlightInnerBlock(params)
|
||||
}
|
||||
} else {
|
||||
@eventPageTemplate(
|
||||
"Highlight",
|
||||
params.OpenGraphParams,
|
||||
params.HeadParams,
|
||||
params.Clients,
|
||||
params.Details,
|
||||
params.Event,
|
||||
) {
|
||||
@highlightInnerBlock(params)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user