Mercurial > hg > Members > anatofuz > lectable
view cmd_dumphtml.go @ 21:1aa824c6b319
...
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 02 Apr 2020 21:24:24 +0900 |
parents | |
children | 8d14bbbedf23 |
line wrap: on
line source
package lectable import ( "context" "errors" "fmt" "io" "path/filepath" ) type cmdDumpHTML struct{} func (cdh *cmdDumpHTML) name() string { return "dumphtml" } func (cdh *cmdDumpHTML) description() string { return "generate lectable html" } func (cdh *cmdDumpHTML) run(ctx context.Context, argv []string, outStream, errStream io.Writer) error { if len(argv) == 0 { return errors.New("Usage: ./lectable dumphtml lecture.json") } teacherToURLMap, err := convertStaticTeacherToMap(filepath.Join("static_json", "teacher.json")) if err != nil { return err } dlfpdf, err := convertLec(argv[0]) if err != nil { return err } grlectures, err := convertdumpHTMLSTR(dlfpdf, *teacherToURLMap) if err != nil { return err } for doIndex, dayList := range grlectures.B1 { fmt.Printf("doindex : %d\n", doIndex) for i, v := range dayList { fmt.Printf("index : %d\n", i) if v == nil { fmt.Println("nil") continue } fmt.Println(*v) } } //dumpHTML(grlectures, outStream) return nil }