forked from kapmahc/epub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopf.go
80 lines (71 loc) · 2.71 KB
/
opf.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
75
76
77
78
79
80
package epub
//Opf content.opf
type Opf struct {
Metadata Metadata `xml:"metadata" json:"metadata"`
Manifest []Manifest `xml:"manifest>item" json:"manifest"`
Spine Spine `xml:"spine" json:"spine"`
}
//Metadata metadata
type Metadata struct {
Title []string `xml:"title" json:"title"`
Language []string `xml:"language" json:"language"`
Identifier []Identifier `xml:"identifier" json:"identifier"`
Creator []Author `xml:"creator" json:"creator"`
Subject []string `xml:"subject" json:"subject"`
Description []string `xml:"description" json:"description"`
Publisher []string `xml:"publisher" json:"publisher"`
Contributor []Author `xml:"contributor" json:"contributor"`
Date []Date `xml:"date" json:"date"`
Type []string `xml:"type" json:"type"`
Format []string `xml:"format" json:"format"`
Source []string `xml:"source" json:"source"`
Relation []string `xml:"relation" json:"relation"`
Coverage []string `xml:"coverage" json:"coverage"`
Rights []string `xml:"rights" json:"rights"`
Meta []Metafield `xml:"meta" json:"meta"`
}
// Identifier identifier
type Identifier struct {
Data string `xml:",chardata" json:"data"`
ID string `xml:"id,attr" json:"id"`
Scheme string `xml:"scheme,attr" json:"scheme"`
}
// Author author
type Author struct {
Data string `xml:",chardata" json:"author"`
FileAs string `xml:"file-as,attr" json:"file_as"`
Role string `xml:"role,attr" json:"role"`
}
// Date date
type Date struct {
Data string `xml:",chardata" json:"data"`
Event string `xml:"event,attr" json:"event"`
}
// Metafield metafield
type Metafield struct {
Name string `xml:"name,attr" json:"name"`
Content string `xml:"content,attr" json:"content"`
}
//Manifest manifest
type Manifest struct {
ID string `xml:"id,attr" json:"id"`
Href string `xml:"href,attr" json:"href"`
MediaType string `xml:"media-type,attr" json:"type"`
Fallback string `xml:"media-fallback,attr" json:"fallback"`
Properties string `xml:"properties,attr" json:"properties"`
MediaOverlay string `xml:"media-overlay,attr" json:"overlay"`
}
// Spine spine
type Spine struct {
ID string `xml:"id,attr" json:"id"`
Toc string `xml:"toc,attr" json:"toc"`
PageProgression string `xml:"page-progression-direction,attr" json:"progression"`
Items []SpineItem `xml:"itemref" json:"items"`
}
// SpineItem spine item
type SpineItem struct {
IDref string `xml:"idref,attr" json:"id_ref"`
Linear string `xml:"linear,attr" json:"linear"`
ID string `xml:"id,attr" json:"id"`
Properties string `xml:"properties,attr" json:"properties"`
}