Documentation ¶
Overview ¶
Package webcore is a framework designed for easily building content-focused sites
Index ¶
- Variables
- func ExampleHandler(ctx *coredom.Context) bool
- type Page
- func (pg *Page) AppBar(tb *gi.Toolbar)
- func (pg *Page) Config()
- func (t *Page) KiType() *gti.Type
- func (t *Page) New() ki.Ki
- func (pg *Page) OnInit()
- func (pg *Page) OpenURL(rawURL string, addToHistory bool)
- func (t *Page) SetSource(v fs.FS) *Page
- func (t *Page) SetStackTop(v int) *Page
- func (t *Page) SetTooltip(v string) *Page
Constants ¶
This section is empty.
Variables ¶
var Examples = map[string]func(parent gi.Widget){}
Examples are the different core examples that exist as compiled Go code that can be run in webcore. The map is keyed by ID. Generated webcoregen.go files add to this by finding all code blocks with language Go (must be uppercase, as that indicates that is an "exported" example).
var NumExamples = map[string]int{}
NumExamples has the number of examples per page URL.
var PageType = gti.AddType(>i.Type{Name: "cogentcore.org/core/webcore.Page", IDName: "page", Doc: "Page represents one site page", Embeds: []gti.Field{{Name: "Frame"}}, Fields: []gti.Field{{Name: "Source", Doc: "Source is the filesystem in which the content is located."}, {Name: "Context", Doc: "Context is the page's [coredom.Context]."}, {Name: "History", Doc: "The history of URLs that have been visited. The oldest page is first."}, {Name: "HistoryIndex", Doc: "HistoryIndex is the current place we are at in the History"}, {Name: "PagePath", Doc: "PagePath is the fs path of the current page in [Page.Source]"}, {Name: "URLToPagePath", Doc: "URLToPagePath is a map between user-facing page URLs and underlying\nFS page paths."}}, Instance: &Page{}})
Functions ¶
func ExampleHandler ¶ added in v0.0.8
ExampleHandler is the coredom handler for <webcore-example> HTML elements that handles examples.
Types ¶
type Page ¶
type Page struct { gi.Frame // Source is the filesystem in which the content is located. Source fs.FS // Context is the page's [coredom.Context]. Context *coredom.Context `set:"-"` // The history of URLs that have been visited. The oldest page is first. History []string `set:"-"` // HistoryIndex is the current place we are at in the History HistoryIndex int `set:"-"` // PagePath is the fs path of the current page in [Page.Source] PagePath string `set:"-"` // URLToPagePath is a map between user-facing page URLs and underlying // FS page paths. URLToPagePath map[string]string `set:"-"` }
Page represents one site page
func NewPage ¶
NewPage adds a new Page with the given name to the given parent: Page represents one site page
func (*Page) OpenURL ¶
OpenURL sets the content of the page from the given url. If the given URL has no scheme (eg: "/about"), then it sets the content of the page to the file specified by the URL. This is either the "index.md" file in the corresponding directory (eg: "/about/index.md") or the corresponding md file (eg: "/about.md"). If it has a scheme, (eg: "https://example.com"), then it opens it in the user's default browser.
func (*Page) SetSource ¶
SetSource sets the [Page.Source]: Source is the filesystem in which the content is located.
func (*Page) SetStackTop ¶
SetStackTop sets the [Page.StackTop]
func (*Page) SetTooltip ¶
SetTooltip sets the [Page.Tooltip]