Merge pull request '[BUG] Make chroma match case-insenstive' (#5530) from gusted/forgejo-case-insensitive-highlight into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5530 Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
commit
c59f64fab9
2 changed files with 8 additions and 2 deletions
|
@ -96,7 +96,7 @@ func Code(fileName, language, code string) (output template.HTML, lexerName stri
|
|||
}
|
||||
|
||||
if lexer == nil {
|
||||
lexer = lexers.Match(fileName)
|
||||
lexer = lexers.Match(strings.ToLower(fileName))
|
||||
if lexer == nil {
|
||||
lexer = lexers.Fallback
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ func File(fileName, language string, code []byte) ([]template.HTML, string, erro
|
|||
|
||||
lexer = lexers.Get(guessLanguage)
|
||||
if lexer == nil {
|
||||
lexer = lexers.Match(fileName)
|
||||
lexer = lexers.Match(strings.ToLower(fileName))
|
||||
if lexer == nil {
|
||||
lexer = lexers.Fallback
|
||||
}
|
||||
|
|
|
@ -109,6 +109,12 @@ c=2
|
|||
),
|
||||
lexerName: "Python",
|
||||
},
|
||||
{
|
||||
name: "DOS.PAS",
|
||||
code: "",
|
||||
want: lines(""),
|
||||
lexerName: "ObjectPascal",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
Loading…
Add table
Reference in a new issue