sync: Handle title.txt in exercice dir
This commit is contained in:
parent
63d8ae4ecd
commit
40a9078b70
@ -103,6 +103,16 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
|
|||||||
return nil, p, eid, edir, errs
|
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.URLId = fic.ToURLid(e.Title)
|
||||||
e.Title = fixnbsp(e.Title)
|
e.Title = fixnbsp(e.Title)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user