repochecker/grammalecte: Fix CodeSpan
This commit is contained in:
parent
fee1ab2a26
commit
84f85d631a
2 changed files with 20 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"srs.epita.fr/fic-server/admin/sync"
|
"srs.epita.fr/fic-server/admin/sync"
|
||||||
|
lib "srs.epita.fr/fic-server/repochecker/grammalecte/lib"
|
||||||
"srs.epita.fr/fic-server/repochecker/grammalecte/void"
|
"srs.epita.fr/fic-server/repochecker/grammalecte/void"
|
||||||
|
|
||||||
"github.com/yuin/goldmark"
|
"github.com/yuin/goldmark"
|
||||||
|
@ -62,7 +63,20 @@ func GrammalecteCheckMDText(str string, exceptions *sync.CheckExceptions, forbid
|
||||||
|
|
||||||
errs = append(errs, checker.errs...)
|
errs = append(errs, checker.errs...)
|
||||||
errs = append(errs, voidRenderer.Errors()...)
|
errs = append(errs, voidRenderer.Errors()...)
|
||||||
errs = append(errs, grammalecte("", buf.String(), 0, exceptions, &CommonOpts)...)
|
|
||||||
|
for _, err := range grammalecte("", buf.String(), 0, exceptions, &CommonOpts) {
|
||||||
|
if gerror, ok := err.(lib.GrammarError); ok {
|
||||||
|
if (gerror.RuleId == "redondances_paragraphe" || gerror.RuleId == "redondances_phrase") && gerror.GetPassage() == "SubstitutDeCode" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} else if serror, ok := err.(lib.SpellingError); ok {
|
||||||
|
if serror.Value == "SubstitutDeCode" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
errs = append(errs, err)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,11 @@ func (r *VoidRenderer) renderAutoLink(w util.BufWriter, source []byte, node ast.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *VoidRenderer) renderCodeSpan(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) {
|
func (r *VoidRenderer) renderCodeSpan(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) {
|
||||||
|
if !entering {
|
||||||
|
return ast.WalkContinue, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _ = w.WriteString(`SubstitutDeCode`)
|
||||||
return ast.WalkSkipChildren, nil
|
return ast.WalkSkipChildren, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue