Documentation ¶
Overview ¶
Example (Deck) ¶
package main import ( "github.com/gregoryv/deck" . "github.com/gregoryv/web" ) func main() { p := deck.Deck{ Title: "My funny presentation", Author: "Gregory Vinčić", AutoCover: true, AutoTOC: true, } // dark mode //p.Style("html, body, a", "background-color: #2E2E34", "color: #f0f8ff") p.Style(".header", "background-color: #f6f5f4", "border-bottom: 1px inset #000") // center toc if short titles //p.Style(".toc", "margin-left: 10vw", "width: 20vw") p.NewCard( // each card must start with H2 or H3 H2("Animals"), deck.Double( lorem, ipsum, ), ) p.NewCard( // H3 means sub card of last H" H3("Horses"), deck.Middle(50, ipsum, ), ) p.NewCard( // H3 means sub card of last H" H3("Code"), deck.Middle(50, P("Example showing how to load a func"), deck.LoadFunc("layout.go", "Double"), ), ) p.NewCard( H3("Birds"), H4("Wings"), lorem, ) p.NewCard( H2("Things"), lorem, ) p.NewCard( H3("Cars"), deck.Center( H4("title 4"), Img(Src("https://avatars.githubusercontent.com/u/779941?v=4")), lorem, ), ) p.Document().SaveAs("out.html") } var lorem = P(`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`) var ipsum = Ul( Li("Lorem ipsum dolor sit amet, consectetur adipiscing elit,"), Li("sed do eiusmod tempor incididunt ut labore et dolore magna"), Li("aliqua. Ut enim ad minim veniam, quis nostrud exercitation"), Li("ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis"), Li("aute irure dolor in reprehenderit in voluptate velit esse"), Li("cillum dolore eu fugiat nulla pariatur. Excepteur sint"), Li("occaecat cupidatat non proident, sunt in culpa qui officia"), Li("deserunt mollit anim id est laborum."), )
Output:
Index ¶
- func Center(element ...any) *Element
- func Double(e1, e2 any) *Element
- func Load(filename string) *Element
- func LoadFunc(filename, funcName string) *Element
- func LoadLines(filename string, from, to int) *Element
- func Middle(width int, element ...any) *Element
- func Shell(cmd, filename string) *Element
- type Deck
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.