component

package
v1.0.0-...-04aeef2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2017 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContent = errors.New("Invalid content")
	ErrSlug    = errors.New("Invalid Slug")
)

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID      string `json:"id"`
	Hash    string `json:"hash,omAssetpty"`
	Content string `json:"content"`
}

func (*Asset) Contents

func (a *Asset) Contents() string

func (*Asset) HasChildren

func (*Asset) HasChildren() bool

func (*Asset) Path

func (i *Asset) Path() string

func (*Asset) Resource

func (a *Asset) Resource() Resource

func (*Asset) SHA

func (a *Asset) SHA() string

func (*Asset) SetContents

func (a *Asset) SetContents(contents string) error

func (*Asset) SetPath

func (i *Asset) SetPath(filepath string) error

type Category

type Category struct {
	ID     string  `json:"id"`
	Name   string  `json:"name"`
	Hash   string  `json:"hash"`
	Locale string  `json:"-"`
	Order  float64 `json:"-"`
	// contains filtered or unexported fields
}

func (*Category) Add

func (c *Category) Add(subs ...*Subcategory)

func (*Category) Contents

func (c *Category) Contents() string

func (*Category) HasChildren

func (c *Category) HasChildren() bool

func (*Category) MarshalJSON

func (c *Category) MarshalJSON() ([]byte, error)

func (*Category) Path

func (c *Category) Path() string

func (*Category) Resource

func (c *Category) Resource() Resource

func (*Category) SHA

func (c *Category) SHA() string

func (*Category) SetContents

func (c *Category) SetContents(contents string) error

func (*Category) SetPath

func (c *Category) SetPath(filepath string) error

func (*Category) Sub

func (c *Category) Sub(ID string) *Subcategory

func (*Category) Subcategories

func (c *Category) Subcategories() []string

func (*Category) Tree

func (c *Category) Tree(html bool) interface{}

type Check

type Check struct {
	Text    string `json:"text"`
	NoCheck bool   `json:"no_check"`
}

type Checklist

type Checklist struct {
	Hash   string  `json:"hash"`
	Checks []Check `json:"checks"`
	// contains filtered or unexported fields
}

func (*Checklist) Add

func (c *Checklist) Add(v ...Check)

func (*Checklist) Contents

func (c *Checklist) Contents() string

func (*Checklist) HasChildren

func (c *Checklist) HasChildren() bool

func (*Checklist) Path

func (c *Checklist) Path() string

func (*Checklist) Resource

func (c *Checklist) Resource() Resource

func (*Checklist) SHA

func (c *Checklist) SHA() string

func (*Checklist) SetContents

func (c *Checklist) SetContents(contents string) error

func (*Checklist) SetParent

func (c *Checklist) SetParent(d *Difficulty)

func (*Checklist) SetPath

func (*Checklist) SetPath(filepath string) error

type Component

type Component interface {
	Path() string
	Contents() string
	SetPath(path string) error
	SetContents(contents string) error
	SHA() string
	HasChildren() bool
	Resource() Resource
}

A Component is en element of the resource tree

type Difficulty

type Difficulty struct {
	ID    string `json:"id"`
	Descr string `json:"description"`
	Hash  string `json:"hash"`
	// contains filtered or unexported fields
}

func (*Difficulty) AddChecks

func (d *Difficulty) AddChecks(c ...Check)

func (*Difficulty) AddItem

func (d *Difficulty) AddItem(items ...*Item) error

func (*Difficulty) Checks

func (d *Difficulty) Checks() *Checklist

func (*Difficulty) Contents

func (d *Difficulty) Contents() string

func (*Difficulty) HasChildren

func (d *Difficulty) HasChildren() bool

func (*Difficulty) Item

func (d *Difficulty) Item(id string) *Item

func (*Difficulty) ItemNames

func (d *Difficulty) ItemNames() []string

func (*Difficulty) Items

func (d *Difficulty) Items() []Item

func (*Difficulty) MarshalJSON

func (d *Difficulty) MarshalJSON() ([]byte, error)

func (*Difficulty) Path

func (d *Difficulty) Path() string

func (*Difficulty) Resource

func (d *Difficulty) Resource() Resource

func (*Difficulty) SHA

func (d *Difficulty) SHA() string

func (*Difficulty) SetChecks

func (d *Difficulty) SetChecks(c *Checklist)

func (*Difficulty) SetContents

func (d *Difficulty) SetContents(contents string) error

func (*Difficulty) SetParent

func (d *Difficulty) SetParent(s *Subcategory)

func (*Difficulty) SetPath

func (d *Difficulty) SetPath(filepath string) error

func (*Difficulty) Tree

func (d *Difficulty) Tree(html bool) interface{}

type Form

type Form struct {
	ID      string       `json:"id"`
	Name    string       `json:"name"`
	Hash    string       `json:"hash"`
	Locale  string       `json:"-"`
	Screens []FormScreen `json:"screens,omitempty"`
}

func (*Form) Contents

func (f *Form) Contents() string

func (*Form) HasChildren

func (f *Form) HasChildren() bool

func (*Form) Path

func (f *Form) Path() string

func (*Form) Resource

func (f *Form) Resource() Resource

func (*Form) SHA

func (f *Form) SHA() string

func (*Form) SetContents

func (f *Form) SetContents(contents string) error

func (*Form) SetPath

func (f *Form) SetPath(filepath string) error

type FormInput

type FormInput struct {
	Type    string   `json:"type"`
	Name    string   `json:"name"`
	Label   string   `json:"label"`
	Value   []string `json:"value"`
	Options []string `json:"options,omitempty"`
	Hint    string   `json:"hint,omitempty"`
	Lines   int      `json:"lines,omitempty"`
}

type FormScreen

type FormScreen struct {
	Name  string      `json:"name"`
	Items []FormInput `json:"items,omitempty"`
}

type Item

type Item struct {
	ID    string `json:"id"`
	Hash  string `json:"hash,omitempty"`
	Title string `json:"title"`
	Body  string `json:"body"`

	Order float64 `json:"-"`
	// contains filtered or unexported fields
}

func (*Item) Contents

func (i *Item) Contents() string

func (*Item) HasChildren

func (i *Item) HasChildren() bool

func (*Item) Path

func (i *Item) Path() string

func (*Item) Resource

func (i *Item) Resource() Resource

func (*Item) SHA

func (i *Item) SHA() string

func (*Item) SetContents

func (i *Item) SetContents(contents string) error

func (*Item) SetParent

func (i *Item) SetParent(d *Difficulty)

func (*Item) SetPath

func (i *Item) SetPath(filepath string) error

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser is an helper, creates a tree from the repo

func (*Parser) Assets

func (p *Parser) Assets() []*Asset

func (*Parser) Categories

func (p *Parser) Categories() map[string][]*Category

func (*Parser) Forms

func (p *Parser) Forms() []*Form

func (*Parser) Parse

func (p *Parser) Parse(t *object.Tree) error

Parse executes the parsing on a repo

type Resource

type Resource struct {
	Slug    string
	Content []map[string]string
}

type ResourceParser

type ResourceParser struct {
	// contains filtered or unexported fields
}

func NewResourceParser

func NewResourceParser() *ResourceParser

func (*ResourceParser) Categories

func (r *ResourceParser) Categories() map[string][]*Category

func (*ResourceParser) Parse

func (r *ResourceParser) Parse(cmp Component, res *Resource, locale string) error

type Subcategory

type Subcategory struct {
	ID    string  `json:"id"`
	Name  string  `json:"name"`
	Hash  string  `json:"hash"`
	Order float64 `json:"-"`
	// contains filtered or unexported fields
}

func (*Subcategory) AddDifficulty

func (s *Subcategory) AddDifficulty(difficulties ...*Difficulty) error

func (*Subcategory) Contents

func (s *Subcategory) Contents() string

func (*Subcategory) Difficulties

func (s *Subcategory) Difficulties() []Difficulty

func (*Subcategory) Difficulty

func (s *Subcategory) Difficulty(ID string) *Difficulty

func (*Subcategory) DifficultyNames

func (s *Subcategory) DifficultyNames() []string

func (*Subcategory) HasChildren

func (s *Subcategory) HasChildren() bool

func (*Subcategory) MarshalJSON

func (s *Subcategory) MarshalJSON() ([]byte, error)

func (*Subcategory) Path

func (s *Subcategory) Path() string

func (*Subcategory) Resource

func (s *Subcategory) Resource() Resource

func (*Subcategory) SHA

func (s *Subcategory) SHA() string

func (*Subcategory) SetContents

func (s *Subcategory) SetContents(contents string) error

func (*Subcategory) SetParent

func (s *Subcategory) SetParent(c *Category)

func (*Subcategory) SetPath

func (s *Subcategory) SetPath(filepath string) error

func (*Subcategory) Tree

func (s *Subcategory) Tree(html bool) interface{}

Jump to

Keyboard shortcuts

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