diff --git a/tour/all.go b/tour/all.go index 3bb3da777..723249a1e 100644 --- a/tour/all.go +++ b/tour/all.go @@ -1,6 +1,9 @@ package tour -import "sort" +import ( + "fmt" + "sort" +) func init() { for _, t := range allTopics { @@ -11,20 +14,33 @@ func init() { sort.Sort(IDSlice(IDs)) } +var ( + Introduction = Chapter(0) + FileBasics = Chapter(1) + NodeBasics = Chapter(2) + MerkleDag = Chapter(3) + Network = Chapter(4) + Daemon = Chapter(5) + Routing = Chapter(6) + Exchange = Chapter(7) + Ipns = Chapter(8) + Mounting = Chapter(9) + Plumbing = Chapter(10) + Formats = Chapter(11) +) + // Topics contains a mapping of Tour Topic ID to Topic var allTopics = []Topic{ - Topic{ID: ID("0.0"), Content: IntroHelloMars}, - Topic{ID: ID("0.1"), Content: IntroTour}, - Topic{ID: ID("0.2"), Content: IntroAboutIpfs}, + Topic{ID: Introduction(0), Content: IntroHelloMars}, + Topic{ID: Introduction(1), Content: IntroTour}, + Topic{ID: Introduction(2), Content: IntroAboutIpfs}, - // File Basics - Topic{ID: ID("X.0"), Content: FileBasicsFilesystem}, - Topic{ID: ID("X.1"), Content: FileBasicsGetting}, - Topic{ID: ID("X.2"), Content: FileBasicsAdding}, - Topic{ID: ID("X.3"), Content: FileBasicsDirectories}, - Topic{ID: ID("X.3"), Content: FileBasicsDirectories}, - Topic{ID: ID("X.4"), Content: FileBasicsMounting}, - Topic{ID: ID("X.2"), Content: FileBasicsAdding}, + Topic{ID: FileBasics(1), Content: FileBasicsFilesystem}, + Topic{ID: FileBasics(2), Content: FileBasicsGetting}, + Topic{ID: FileBasics(3), Content: FileBasicsAdding}, + Topic{ID: FileBasics(4), Content: FileBasicsDirectories}, + Topic{ID: FileBasics(5), Content: FileBasicsDistributed}, + Topic{ID: FileBasics(6), Content: FileBasicsMounting}, } // Introduction @@ -77,3 +93,9 @@ var FileBasicsMounting = Content{ Text: `ipfs mount (simple) `, } + +func Chapter(number int) func(topic int) ID { + return func(topic int) ID { + return ID(fmt.Sprintf("%d.%d", number, topic)) + } +}