-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
74 lines (62 loc) · 1.25 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package mobiledoc
// List is a general purpose list.
type List = []interface{}
// Map is a general purpose map.
type Map = map[string]interface{}
// SectionType defines a section type.
type SectionType int
// The available section identifiers.
const (
MarkupSection SectionType = 1
ImageSection SectionType = 2
ListSection SectionType = 3
CardSection SectionType = 10
)
// MarkerType defines a marker type.
type MarkerType int
// The available marker identifiers.
const (
TextMarker MarkerType = 0
AtomMarker MarkerType = 1
)
// Document is a mobiledoc.
type Document struct {
Version string
Markups []Markup
Atoms []Atom
Cards []Card
Sections []Section
}
// Markup is a single markup.
type Markup struct {
Tag string
Attributes Map
}
// Atom is a single atom.
type Atom struct {
Name string
Text string
Payload Map
}
// Card is a single card.
type Card struct {
Name string
Payload Map
}
// Section is a single section.
type Section struct {
Type SectionType
Tag string
Markers []Marker
Source string
Items [][]Marker
Card *Card
}
// Marker is a single marker.
type Marker struct {
Type MarkerType
OpenMarkups []*Markup
ClosedMarkups int
Text string
Atom *Atom
}