models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat = "2 January 2006"

Variables

View Source
var NotesEnabled = false

NotesEnabled specifies whether presenter notes should be displayed in the present user interface.

View Source
var PlayEnabled = false

PlayEnabled specifies whether runnable playground snippets should be displayed in the present user interface.

Functions

func Decode

func Decode(o io.Reader, v interface{}) error

func Encode

func Encode(o io.Writer, v interface{}) error

func Style

func Style(s string) template.HTML

Style returns s with HTML entities escaped and font indicators turned into HTML font tags.

Types

type Author

type Author struct {
	Elem []Elem
}

Author represents the person who wrote and/or is presenting the document.

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 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 Doc

type Doc struct {
	Title      string
	Subtitle   string
	Time       time.Time
	Authors    []Author
	TitleNotes []string
	Sections   []Section
	Tags       []string
}

Doc represents an entire document.

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

type Elem interface {
	TemplateName() string
}

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 File

type File struct {
	IsDir    bool
	Children []*File
	Name     string
}

func (*File) BaseName

func (d *File) BaseName() string

func (*File) Cache

func (d *File) Cache(c *sync.Map)

func (*File) IsArticle

func (d *File) IsArticle() bool

func (*File) IsSlide

func (d *File) IsSlide() bool

func (*File) Path

func (d *File) Path() string

func (*File) URL

func (d *File) URL() 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

type Lines struct {
	Line int // 0 indexed, so has 1-indexed number of last line returned
	Text []string
}

Lines is a helper for parsing line-based input.

func (*Lines) Back

func (l *Lines) Back()

func (*Lines) Next

func (l *Lines) Next() (text string, ok bool)

func (*Lines) NextNonEmpty

func (l *Lines) NextNonEmpty() (text string, ok bool)
type Link struct {
	URL   *url.URL
	Label string
}

func (Link) TemplateName

func (l Link) TemplateName() string

type List

type List struct {
	Bullet []string
}

List represents a bulleted list.

func (List) TemplateName

func (l List) TemplateName() string

type Section

type Section struct {
	Number  []int
	Title   string
	Elem    []Elem
	Notes   []string
	Classes []string
	Styles  []string
}

Section represents a section of a document (such as a presentation slide) comprising a title and a list of elements.

func (Section) FormattedNumber

func (s Section) FormattedNumber() string

FormattedNumber returns a string containing the concatenation of the numbers identifying a Section.

func (Section) HTMLAttributes

func (s Section) HTMLAttributes() template.HTMLAttr

HTMLAttributes for the 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)

Sections contained within the section.

func (Section) TemplateName

func (s Section) TemplateName() string

type Text

type Text struct {
	Lines []string
	Pre   bool
}

Text represents an optionally preformatted paragraph.

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

Jump to

Keyboard shortcuts

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