24 lines
677 B
Go
24 lines
677 B
Go
package objects
|
|
|
|
import "fmt"
|
|
import "git.tebibyte.media/tomo/tomo"
|
|
|
|
// Heading is a label that denotes the start of some section of content. It can
|
|
// have a level from 0 to 2, with 0 being the most prominent and 2 being the
|
|
// most subtle. The level is described in the role variation.
|
|
type Heading struct {
|
|
tomo.TextBox
|
|
}
|
|
|
|
// NewHeading creates a new section heading. The level can be from 0 to 2.
|
|
func NewHeading (level int, text string) *Heading {
|
|
if level < 0 { level = 0 }
|
|
if level > 2 { level = 2 }
|
|
this := &Heading { TextBox: tomo.NewTextBox() }
|
|
this.SetRole(tomo.R("objects", "Heading"))
|
|
this.SetTag(fmt.Sprint(level), true)
|
|
this.SetText(text)
|
|
return this
|
|
}
|
|
|