Docs, docs, docs!

This commit is contained in:
nemunaire 2018-05-12 01:08:37 +02:00
parent 12a85ee804
commit dcb67fba63
7 changed files with 38 additions and 2 deletions

View file

@ -9,6 +9,7 @@ import (
"github.com/julienschmidt/httprouter"
)
// getThemes returns all theme directories in the base directory.
func getThemes(i Importer) ([]string, error) {
var themes []string
@ -25,6 +26,7 @@ func getThemes(i Importer) ([]string, error) {
return themes, nil
}
// 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 {
return nil, err
@ -33,6 +35,7 @@ func getAuthors(i Importer, tname string) ([]string, error) {
}
}
// SyncThemes imports new or updates existing themes.
func SyncThemes(i Importer) []string {
var errs []string
@ -73,10 +76,12 @@ func SyncThemes(i Importer) []string {
return errs
}
// ApiListRemoteThemes is an accessor letting foreign packages to access remote themes list.
func ApiListRemoteThemes(_ httprouter.Params, _ []byte) (interface{}, error) {
return getThemes(GlobalImporter)
}
// ApiListRemoteTheme is an accessor letting foreign packages to access remote main theme attributes.
func ApiGetRemoteTheme(ps httprouter.Params, _ []byte) (interface{}, error) {
return getAuthors(GlobalImporter, ps.ByName("thid"))
}