sync: Handle finished.md as alternative to finished.txt
This commit is contained in:
parent
2df227c25b
commit
4b09efa9fd
@ -184,19 +184,21 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
|
|||||||
|
|
||||||
if i.exists(path.Join(epath, "finished.txt")) {
|
if i.exists(path.Join(epath, "finished.txt")) {
|
||||||
e.Finished, err = GetFileContent(i, path.Join(epath, "finished.txt"))
|
e.Finished, err = GetFileContent(i, path.Join(epath, "finished.txt"))
|
||||||
if err != nil {
|
} else if i.exists(path.Join(epath, "finished.md")) {
|
||||||
errs = append(errs, NewExerciceError(e, fmt.Errorf("finished.txt: %w", err), theme))
|
e.Finished, err = GetFileContent(i, path.Join(epath, "finished.md"))
|
||||||
} else {
|
}
|
||||||
// Call checks hooks
|
if err != nil {
|
||||||
for _, h := range hooks.mdTextHooks {
|
errs = append(errs, NewExerciceError(e, fmt.Errorf("finished.md: %w", err), theme))
|
||||||
for _, err := range h(e.Finished, exceptions.GetFileExceptions("finished.md", "finished.txt")) {
|
} else if len(e.Finished) > 0 {
|
||||||
errs = append(errs, NewExerciceError(e, fmt.Errorf("finished.md: %w", err)))
|
// Call checks hooks
|
||||||
}
|
for _, h := range hooks.mdTextHooks {
|
||||||
|
for _, err := range h(e.Finished, exceptions.GetFileExceptions("finished.md", "finished.txt")) {
|
||||||
|
errs = append(errs, NewExerciceError(e, fmt.Errorf("finished.md: %w", err)))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if e.Finished, err = ProcessMarkdown(i, e.Finished, epath); err != nil {
|
if e.Finished, err = ProcessMarkdown(i, e.Finished, epath); err != nil {
|
||||||
errs = append(errs, NewExerciceError(e, fmt.Errorf("finished.txt: an error occurs during markdown formating: %w", err), theme))
|
errs = append(errs, NewExerciceError(e, fmt.Errorf("finished.md: an error occurs during markdown formating: %w", err), theme))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user