Package present
Overview ▹
Index ▹
Variables
NotesEnabled specifies whether presenter notes should be displayed in the present user interface.
var NotesEnabled = false
PlayEnabled specifies whether runnable playground snippets should be displayed in the present user interface.
var PlayEnabled = false
func Register ¶
func Register(name string, parser ParseFunc)
Register binds the named action, which does not begin with a period, to the specified parser to be invoked when the name, with a period, appears in the present input text.
func Style ¶
func Style(s string) template.HTML
Style returns s with HTML entities escaped and font indicators turned into HTML font tags.
▹ Example
func Template ¶
func Template() *template.Template
Template returns an empty template with the action functions in its FuncMap.
type Author ¶
Author represents the person who wrote and/or is presenting the document.
type Author struct { Elem []Elem }
func (*Author) TextElem ¶
func (p *Author) TextElem() (elems []Elem)
TextElem returns the first text elements of the author details. This is used to display the author' name, job title, and company without the contact details.
type Background ¶
type Background struct { URL string }
func (Background) TemplateName ¶
func (i Background) TemplateName() string
type Caption ¶
type Caption struct { Text string }
func (Caption) TemplateName ¶
func (c Caption) TemplateName() string
type Code ¶
type Code struct { Text template.HTML Play bool // runnable code Edit bool // editable code FileName string // file name Ext string // file extension Raw []byte // content of the file }
func (Code) TemplateName ¶
func (c Code) TemplateName() string
type Context ¶
A Context specifies the supporting context for parsing a presentation.
type Context struct {
// ReadFile reads the file named by filename and returns the contents.
ReadFile func(filename string) ([]byte, error)
}
func (*Context) Parse ¶
func (ctx *Context) Parse(r io.Reader, name string, mode ParseMode) (*Doc, error)
Parse parses a document from r.
type Doc ¶
Doc represents an entire document.
type Doc struct { Title string Subtitle string Time time.Time Authors []Author TitleNotes []string Sections []Section Tags []string }
func Parse ¶
func Parse(r io.Reader, name string, mode ParseMode) (*Doc, error)
Parse parses a document from r. Parse reads assets used by the presentation from the file system using ioutil.ReadFile.
func (*Doc) Render ¶
func (d *Doc) Render(w io.Writer, t *template.Template) error
Render renders the doc to the given writer using the provided template.
type Elem ¶
Elem defines the interface for a present element. That is, something that can provide the name of the template used to render the element.
type Elem interface { TemplateName() string }
type HTML ¶
type HTML struct { template.HTML }
func (HTML) TemplateName ¶
func (s HTML) TemplateName() string
type Iframe ¶
type Iframe struct { URL string Width int Height int }
func (Iframe) TemplateName ¶
func (i Iframe) TemplateName() string
type Image ¶
type Image struct { URL string Width int Height int }
func (Image) TemplateName ¶
func (i Image) TemplateName() string
type Lines ¶
Lines is a helper for parsing line-based input.
type Lines struct {
// contains filtered or unexported fields
}
type Link ¶
type Link struct { URL *url.URL Label string }
func (Link) TemplateName ¶
func (l Link) TemplateName() string
type List ¶
List represents a bulleted list.
type List struct { Bullet []string }
func (List) TemplateName ¶
func (l List) TemplateName() string
type ParseFunc ¶
type ParseFunc func(ctx *Context, fileName string, lineNumber int, inputLine string) (Elem, error)
type ParseMode ¶
ParseMode represents flags for the Parse function.
type ParseMode int
const (
// If set, parse only the title and subtitle.
TitlesOnly ParseMode = 1
)
type Section ¶
Section represents a section of a document (such as a presentation slide) comprising a title and a list of elements.
type Section struct { Number []int Title string Elem []Elem Notes []string }
func (Section) FormattedNumber ¶
func (s Section) FormattedNumber() string
FormattedNumber returns a string containing the concatenation of the numbers identifying a Section.
func (Section) Level ¶
func (s Section) Level() int
Level returns the level of the given section. The document title is level 1, main section 2, etc.
func (*Section) Render ¶
func (s *Section) Render(w io.Writer, t *template.Template) error
Render renders the section to the given writer using the provided template.
func (Section) Sections ¶
func (s Section) Sections() (sections []Section)
func (Section) TemplateName ¶
func (s Section) TemplateName() string
type Text ¶
Text represents an optionally preformatted paragraph.
type Text struct { Lines []string Pre bool }
func (Text) TemplateName ¶
func (t Text) TemplateName() string
type Video ¶
type Video struct { URL string SourceType string Width int Height int }
func (Video) TemplateName ¶
func (v Video) TemplateName() string