master xplshn/aruu / scripts / mkman / page.go
 1package main
 2
 3type Page struct {
 4	Name        string
 5	Summary     string
 6	Section     int
 7	Date        string
 8	Synopsis    []SynopsisForm
 9	Description []Block
10	Options     []Option
11	Sections    []Section
12}
13
14type Section struct {
15	Title  string
16	Blocks []Block
17}
18
19type BlockKind int
20
21const (
22	BlockParagraph BlockKind = iota
23	BlockTaggedList
24	BlockSeeAlso
25	BlockSubsection
26)
27
28type Block struct {
29	Kind    BlockKind
30	Inlines []Inline
31	Items   []Item
32	Refs    []XRef
33	Title   string
34	Blocks  []Block
35}
36
37type Item struct {
38	Label []Inline
39	Body  []Inline
40}
41
42type XRef struct {
43	Name    string
44	Section string
45}
46
47type Option struct {
48	Spec     []SynopsisItem
49	Desc     string
50	Body     []Block
51	Key      string
52	Group    string /* name shared by a mutually exclusive option set, empty if standalone */
53	Required bool   /* set by a trailing ! on the option spec */
54}
55
56type SynopsisForm struct {
57	Items []SynopsisItem
58}
59
60type SynopsisItemKind int
61
62const (
63	SynFlag SynopsisItemKind = iota
64	SynArg
65	SynCommand
66	SynLiteral
67	SynOptional
68	SynPipe
69	SynRequiredGroup /* a {-a|-b|-c} mutually exclusive required group */
70)
71
72type SynopsisItem struct {
73	Kind     SynopsisItemKind
74	Text     string
75	Children []SynopsisItem
76}
77
78type InlineKind int
79
80const (
81	InlineText InlineKind = iota
82	InlineNm
83	InlineEmph
84	InlineLiteral
85	InlinePath
86	InlineXRef
87	InlineFlag
88)
89
90type Inline struct {
91	Kind     InlineKind
92	Text     string
93	Section  string
94	Children []Inline
95}