repochecker/grammalecte: Allow including quotes without checking

This commit is contained in:
nemunaire 2022-10-31 16:29:07 +01:00
parent d7ff10762e
commit ac25202024
1 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"log"
"strings"
"srs.epita.fr/fic-server/admin/sync"
"srs.epita.fr/fic-server/libfic"
@ -35,10 +36,21 @@ func GrammalecteCheckHint(hint *fic.EHint, exceptions *sync.CheckExceptions) (er
errs = append(errs, grammalecte("title ", hint.Title, exceptions, &CommonOpts)...)
}
// Hint content are checked through GrammalecteCheckMDText, no need to check them
return
}
func GrammalecteCheckMDText(str string, exceptions *sync.CheckExceptions) (errs []error) {
if exceptions != nil {
for k := range *exceptions {
tmp := strings.SplitN(k, ":", 3)
if len(tmp) == 3 && tmp[1] == "quote" {
str = strings.Replace(str, tmp[3], "une citation a été remplacée ici", -1)
}
}
}
errs = append(errs, grammalecte("", str, exceptions, &CommonOpts)...)
return