sync: import texts as Markdown

This commit is contained in:
nemunaire 2018-08-17 21:18:10 +02:00 committed by Pierre-Olivier Mercier
parent be7a159815
commit c33390fa80
4 changed files with 16 additions and 6 deletions

View file

@ -7,6 +7,7 @@ import (
"strconv"
"srs.epita.fr/fic-server/libfic"
"gopkg.in/russross/blackfriday.v2"
)
// getExercices returns all exercice directories existing in a given theme, considering the given Importer.
@ -83,6 +84,10 @@ func SyncExercices(i Importer, theme fic.Theme) []string {
videoURI = ""
}
// Markdown pre-formating
statement = string(blackfriday.Run([]byte(statement)))
overview = string(blackfriday.Run([]byte(overview)))
if e, err := theme.GetExerciceByTitle(ename); err != nil {
if ex, err := theme.AddExercice(ename, fic.ToURLid(ename), path.Join(theme.Path, edir), statement, overview, nil, gain, videoURI); err != nil {
errs = append(errs, fmt.Sprintf("%q: error on exercice add: %s", edir, err))