func (r *StaticRepresenter) Reprezent() error { log.Trace("in Reprezent", r.galleries) for _, gallery := range r.galleries { log.Debugf("writing gallery %q", gallery) if err := writeGallery(r.targetDir, gallery); err != nil { return err } } return nil }
func parseGalleries(sourceDir string, pics []*Pic) ([]*Gallery, error) { paths, err := filepath.Glob(sourceDir + "/galleries/*.json") if err != nil { return nil, err } var galleries = make([]*Gallery, 0, len(paths)) for _, path := range paths { log.Debugf("parsing gallery %v", path) gallery, err := NewGallery(path, pics) if err != nil { return nil, fmt.Errorf("%v: %s", path, err) } galleries = append(galleries, gallery) } return galleries, nil }
func parsePics(sourceDir string) ([]*Pic, error) { paths, err := filepath.Glob(sourceDir + "/pics/*.png") if err != nil { return nil, err } var pics = make([]*Pic, 0, len(paths)) for _, path := range paths { log.Debugf("parsing pic %v", path) pic, err := NewPic(path) if err != nil { return nil, err } pics = append(pics, pic) } return pics, nil }
func parseStories(sourceDir string, pics []*Pic) ([]*Story, error) { paths, err := filepath.Glob(sourceDir + "/stories/*.json") if err != nil { return nil, err } var stories = make([]*Story, 0, len(paths)) for _, path := range paths { log.Debugf("parsing story %v", path) story, err := NewStory(path, pics) if err != nil { return nil, fmt.Errorf("%v: %s", path, err) } stories = append(stories, story) } return stories, nil }