Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-25 19:26:09 +01:00

Merge pull request '[v9.0/forgejo] [BUG] Make chroma match case-insenstive' (#5532) from bp-v9.0/forgejo-dcc4423 into v9.0/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5532
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Otto 2024-10-11 19:07:06 +00:00
commit 26f0a7e779
2 changed files with 8 additions and 2 deletions

View file

@ -96,7 +96,7 @@ func Code(fileName, language, code string) (output template.HTML, lexerName stri
} }
if lexer == nil { if lexer == nil {
lexer = lexers.Match(fileName) lexer = lexers.Match(strings.ToLower(fileName))
if lexer == nil { if lexer == nil {
lexer = lexers.Fallback lexer = lexers.Fallback
} }
@ -165,7 +165,7 @@ func File(fileName, language string, code []byte) ([]template.HTML, string, erro
lexer = lexers.Get(guessLanguage) lexer = lexers.Get(guessLanguage)
if lexer == nil { if lexer == nil {
lexer = lexers.Match(fileName) lexer = lexers.Match(strings.ToLower(fileName))
if lexer == nil { if lexer == nil {
lexer = lexers.Fallback lexer = lexers.Fallback
} }

View file

@ -109,6 +109,12 @@ c=2
), ),
lexerName: "Python", lexerName: "Python",
}, },
{
name: "DOS.PAS",
code: "",
want: lines(""),
lexerName: "ObjectPascal",
},
} }
for _, tt := range tests { for _, tt := range tests {