@@ -15,6 +15,7 @@ import (
1515 "path/filepath"
1616 "strings"
1717
18+ autodocs "github.com/cloudcloud/auto-docs"
1819 "gitlab.com/golang-commonmark/markdown"
1920)
2021
2526
2627func init () {
2728 S .Dirs = []* Dir {}
28- S .Pages = make (map [string ]* Page , 0 )
29+ S .Pages = make (map [string ]* autodocs. Page , 0 )
2930}
3031
3132// Dir gives a holder of further nodes.
@@ -38,21 +39,13 @@ type Dir struct {
3839 Text string `json:"text"`
3940}
4041
41- // Page is the content structure for an individual page item.
42- type Page struct {
43- // Name is the displayable identifier for a page.
44- Name string `json:"name"`
45- // Content is the parsed markup of the page.
46- Content string `json:"content"`
47- }
48-
4942// Store captures the doc file references and content.
5043type Store struct {
5144 // Dirs tracks the structure of pages under their paths.
5245 Dirs []* Dir `json:"pages"`
5346
5447 // Pages captures the content for a full path page.
55- Pages map [string ]* Page `json:"-"`
48+ Pages map [string ]* autodocs. Page `json:"-"`
5649
5750 // path is the base that this store is defined for.
5851 path string
@@ -130,15 +123,15 @@ func addToDir(d []*Dir, p, o string) []*Dir {
130123}
131124
132125// buildPage
133- func buildPage (p , d string ) (* Page , error ) {
126+ func buildPage (p , d string ) (* autodocs. Page , error ) {
134127 b := tokenise (p )
135128 m := markdown .New (markdown .XHTMLOutput (true ))
136129 f , err := ioutil .ReadFile (d )
137130 if err != nil {
138131 return nil , fmt .Errorf ("unable to load markdown file: %s" , err )
139132 }
140133
141- return & Page {
134+ return & autodocs. Page {
142135 Name : b [len (b )- 1 ],
143136 Content : m .RenderToString (f ),
144137 }, nil
0 commit comments