deck

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 8 Imported by: 0

README

Presentation like documents

To convert image to inline text

$ convert assets/printout-whole.png INLINE:PNG:whole.txt

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

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Center

func Center(element ...any) *Element

func Double

func Double(e1, e2 any) *Element

func Load added in v0.3.0

func Load(filename string) *Element

func LoadFunc added in v0.3.0

func LoadFunc(filename, funcName string) *Element

func LoadLines added in v0.3.0

func LoadLines(filename string, from, to int) *Element

func Middle

func Middle(width int, element ...any) *Element

func Shell added in v0.3.0

func Shell(cmd, filename string) *Element

Types

type Deck

type Deck struct {
	Title  string
	Author string

	AutoCover bool

	AutoTOC bool
	// contains filtered or unexported fields
}

func (*Deck) CSS

func (p *Deck) CSS() *CSS

func (*Deck) Document

func (p *Deck) Document() *Page

func (*Deck) NewCard

func (p *Deck) NewCard(elements ...any)

func (*Deck) Style

func (p *Deck) Style(x string, v ...string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL