-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsectionchunk.go
executable file
·44 lines (36 loc) · 1.03 KB
/
sectionchunk.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
package main
import (
"fmt"
)
// SectionChunk denotes Sections in article. It is nested structure.
type SectionChunk struct {
Position int
Level int //1 2 .. 6
Id string
Caption string
Numbering string //optional Numbering before Caption
Children []Chunk
}
// String implements the Stringer interface
func (p SectionChunk) String() string {
return fmt.Sprintf("SectionChunk{Position: %d, Level: %d, Id: %v, Caption: %v, Numbering:%v,Children: %v}",
p.GetPosition(), p.Level, p.Id, p.Caption, p.Numbering, p.Children)
}
// GetPosition implements the Chunk interface
func (p *SectionChunk) GetPosition() int {
return p.Position
}
// SetPosition implements the Chunk interface
func (p *SectionChunk) SetPosition(pos int) {
p.Position = pos
}
// GetValue implements the Chunk interface
func (p *SectionChunk) GetValue() string {
return p.Caption
}
func (p *SectionChunk) SetNumbering(c string) {
p.Numbering = c
}
func (p SectionChunk) GetNumbering() string {
return p.Numbering
}