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

@ -12,6 +12,7 @@ import (
"srs.epita.fr/fic-server/libfic"
"gopkg.in/russross/blackfriday.v2"
_ "golang.org/x/crypto/blake2b"
)
@ -69,12 +70,11 @@ func SyncExerciceHints(i Importer, exercice fic.Exercice) (errs []string) {
hint.Content = s
}
}
}
// At this point, filename should have been replaced by Content if filled, so let's ensure that
if hint.Content == "" {
} else if hint.Content == "" {
errs = append(errs, fmt.Sprintf("%q: challenge.txt: hint %s (%d): content and filename can't be empty at the same time", path.Base(exercice.Path), hint.Title, n+1))
continue
} else {
hint.Content = string(blackfriday.Run([]byte(hint.Content)))
}
// Import hint