diff --git a/admin/sync/exercices.go b/admin/sync/exercices.go index 9dd7a9f0..f337f128 100644 --- a/admin/sync/exercices.go +++ b/admin/sync/exercices.go @@ -103,6 +103,16 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]* return nil, p, eid, edir, errs } + // Overwrite title if title.txt exists + if myTitle, err := getFileContent(i, path.Join(epath, "title.txt")); err == nil { + myTitle = strings.TrimSpace(myTitle) + if strings.Contains(myTitle, "\n") { + errs = append(errs, fmt.Sprintf("%q: title.txt: Title can't contain new lines", edir)) + } else { + e.Title = myTitle + } + } + e.URLId = fic.ToURLid(e.Title) e.Title = fixnbsp(e.Title)