From 2db25a6762a0411b827a023370e815da70af0ee4 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow <brian.holderchow@gmail.com> Date: Tue, 4 Nov 2014 22:36:56 -0800 Subject: [PATCH] refactor(tour0 move chapter to it's own file --- tour/all.go | 19 +------------------ tour/chapter.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 18 deletions(-) create mode 100644 tour/chapter.go diff --git a/tour/all.go b/tour/all.go index 65ea92cbb..2deb9d645 100644 --- a/tour/all.go +++ b/tour/all.go @@ -1,9 +1,6 @@ package tour -import ( - "fmt" - "sort" -) +import "sort" func init() { for _, t := range allTopics { @@ -93,17 +90,3 @@ var FileBasicsMounting = Content{ Text: `ipfs mount (simple) `, } - -// Chapter is used to define a chapter once and derive IDs for any number of -// sections within. -// -// It's designed to make it easy to re-order chapters with minimal fuss. -// -// eg. -// Intro := Chapter(1) -// ID("1.1") == Intro(1) -func Chapter(number int) func(topic int) ID { - return func(topic int) ID { - return ID(fmt.Sprintf("%d.%d", number, topic)) - } -} diff --git a/tour/chapter.go b/tour/chapter.go new file mode 100644 index 000000000..6e28ec040 --- /dev/null +++ b/tour/chapter.go @@ -0,0 +1,14 @@ +import "fmt" + +// sections within. +// +// It's designed to make it easy to re-order chapters with minimal fuss. +// +// eg. +// Intro := Chapter(1) +// ID("1.1") == Intro(1) +func Chapter(number int) func(topic int) ID { + return func(topic int) ID { + return ID(fmt.Sprintf("%d.%d", number, topic)) + } +} -- GitLab