Loading cli/labs.go +22 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,9 @@ import ( "fmt" "io/ioutil" "log" "net/url" "os/exec" "path" "strings" "text/template" Loading Loading @@ -87,14 +89,27 @@ func addLabCommands() (res *cobra.Command) { return err } //GREG: process labs fields to convert ux://.* to a link in markdown ldd := &LabDocData{ Lab: lab, LabSection: nil, Depth: 0, } if lab.VideoUrl != "" { url, err := url.Parse(lab.VideoUrl) if err != nil { log.Panicf("Failed to parse VideoUrl: %v", err) } ldd.VideoTag = url.Query().Get("v") if ldd.VideoTag == "" { ldd.VideoTag = path.Base(url.Path) } ldd.VideoTime = url.Query().Get("t") if ldd.VideoTag == "" { ldd.VideoTime = url.Query().Get("start") } } buf2 := &bytes.Buffer{} err = tmpl.Execute(buf2, ldd) if err == nil { Loading @@ -111,6 +126,8 @@ type LabDocData struct { LabSection *models.LabSection Depth int InTab bool VideoTag string VideoTime string } func (dd *LabDocData) ToRef(names ...string) string { Loading Loading @@ -141,7 +158,9 @@ func (dd *LabDocData) MarkdownToRst(data string) string { if err != nil { log.Panicf("Read: %v", err) } return string(output) answer := strings.ReplaceAll(string(output), "ux://", "https://portal.rackn.io/#/e/0.0.0.0/") return answer } func (dd *LabDocData) LengthString(str, pat string) string { Loading Loading @@ -170,8 +189,6 @@ func (dd *LabDocData) RenderSection(tmplFile string, ls *models.LabSection, dept log.Panicf("%v", err) } //GREG: process labs fields to convert ux://.* to a link in markdown ldd := &LabDocData{ Lab: dd.Lab, LabSection: ls, Loading Loading
cli/labs.go +22 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,9 @@ import ( "fmt" "io/ioutil" "log" "net/url" "os/exec" "path" "strings" "text/template" Loading Loading @@ -87,14 +89,27 @@ func addLabCommands() (res *cobra.Command) { return err } //GREG: process labs fields to convert ux://.* to a link in markdown ldd := &LabDocData{ Lab: lab, LabSection: nil, Depth: 0, } if lab.VideoUrl != "" { url, err := url.Parse(lab.VideoUrl) if err != nil { log.Panicf("Failed to parse VideoUrl: %v", err) } ldd.VideoTag = url.Query().Get("v") if ldd.VideoTag == "" { ldd.VideoTag = path.Base(url.Path) } ldd.VideoTime = url.Query().Get("t") if ldd.VideoTag == "" { ldd.VideoTime = url.Query().Get("start") } } buf2 := &bytes.Buffer{} err = tmpl.Execute(buf2, ldd) if err == nil { Loading @@ -111,6 +126,8 @@ type LabDocData struct { LabSection *models.LabSection Depth int InTab bool VideoTag string VideoTime string } func (dd *LabDocData) ToRef(names ...string) string { Loading Loading @@ -141,7 +158,9 @@ func (dd *LabDocData) MarkdownToRst(data string) string { if err != nil { log.Panicf("Read: %v", err) } return string(output) answer := strings.ReplaceAll(string(output), "ux://", "https://portal.rackn.io/#/e/0.0.0.0/") return answer } func (dd *LabDocData) LengthString(str, pat string) string { Loading Loading @@ -170,8 +189,6 @@ func (dd *LabDocData) RenderSection(tmplFile string, ls *models.LabSection, dept log.Panicf("%v", err) } //GREG: process labs fields to convert ux://.* to a link in markdown ldd := &LabDocData{ Lab: dd.Lab, LabSection: ls, Loading