sync: Expose GetFile and GetFileContent functions
This commit is contained in:
parent
d24b1c5d4d
commit
560110ba5e
6 changed files with 21 additions and 21 deletions
|
@ -87,7 +87,7 @@ func resizePicture(importedPath string, rect image.Rectangle) error {
|
|||
|
||||
// getAuthors parses the AUTHORS file.
|
||||
func getAuthors(i Importer, tname string) ([]string, error) {
|
||||
if authors, err := getFileContent(i, path.Join(tname, "AUTHORS.txt")); err != nil {
|
||||
if authors, err := GetFileContent(i, path.Join(tname, "AUTHORS.txt")); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
var ret []string
|
||||
|
@ -112,7 +112,7 @@ func BuildTheme(i Importer, tdir string) (th *fic.Theme, errs []string) {
|
|||
th.Path = tdir
|
||||
|
||||
// Extract theme's label
|
||||
if tname, err := getFileContent(i, path.Join(tdir, "title.txt")); err == nil {
|
||||
if tname, err := GetFileContent(i, path.Join(tdir, "title.txt")); err == nil {
|
||||
th.Name = fixnbsp(tname)
|
||||
} else if f := strings.Index(tdir, "-"); f >= 0 {
|
||||
th.Name = fixnbsp(tdir[f+1:])
|
||||
|
@ -129,7 +129,7 @@ func BuildTheme(i Importer, tdir string) (th *fic.Theme, errs []string) {
|
|||
th.Authors = strings.Join(authors, ", ")
|
||||
}
|
||||
|
||||
if intro, err := getFileContent(i, path.Join(tdir, "overview.txt")); err != nil {
|
||||
if intro, err := GetFileContent(i, path.Join(tdir, "overview.txt")); err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: unable to get theme's overview: %s", th.Name, err))
|
||||
} else {
|
||||
// Split headline from intro
|
||||
|
@ -168,7 +168,7 @@ func BuildTheme(i Importer, tdir string) (th *fic.Theme, errs []string) {
|
|||
}
|
||||
|
||||
if i.exists(path.Join(tdir, "partner.txt")) {
|
||||
if txt, err := getFileContent(i, path.Join(tdir, "partner.txt")); err != nil {
|
||||
if txt, err := GetFileContent(i, path.Join(tdir, "partner.txt")); err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: unable to get partner's text: %s", th.Name, err))
|
||||
} else {
|
||||
th.PartnerText, err = ProcessMarkdown(i, txt, tdir)
|
||||
|
|
Reference in a new issue