amfora/display/about.go
makeworld 9198572f34
cview update (#107)
Co-authored-by: makeworld <25111343+makeworld-the-better-one@users.noreply.github.com>
Co-authored-by: Stephen Robinson <stephen@drsudo.net>
Co-authored-by: Trevor Slocum <trevor@rocketnine.space>
Co-authored-by: Stephen Robinson <sudobash1@users.noreply.github.com>
2021-02-17 14:17:13 -05:00

47 lines
1.1 KiB
Go

package display
import (
"fmt"
"github.com/makeworld-the-better-one/amfora/renderer"
"github.com/makeworld-the-better-one/amfora/structs"
)
var aboutPage structs.Page
var versionPage structs.Page
var licensePage structs.Page
var thanksPage structs.Page
func aboutInit(version, commit, builtBy string) {
aboutPage = createAboutPage("about:about", `# Internal Pages
=> about:bookmarks
=> about:subscriptions
=> about:manage-subscriptions
=> about:newtab
=> about:version
=> about:license
=> about:thanks
`)
versionPage = createAboutPage("about:version",
fmt.Sprintf(
"# Amfora Version Info\n\nAmfora: %s\nCommit: %s\nBuilt by: %s",
version, commit, builtBy,
),
)
licensePage = createAboutPage("about:license", string(license))
thanksPage = createAboutPage("about:thanks", string(thanks))
}
func createAboutPage(url string, content string) structs.Page {
renderContent, links := renderer.RenderGemini(content, textWidth(), false)
return structs.Page{
Raw: content,
Content: renderContent,
Links: links,
URL: url,
Width: -1, // Force reformatting on first display
Mediatype: structs.TextGemini,
}
}