mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
Move IsReadmeFile*
from modules/markup/
to modules/util
(#22877)
These functions don't examine contents, just filenames, so they don't fit in well in a markup module. This was originally part of https://github.com/go-gitea/gitea/pull/22177. Signed-off-by: Nick Guenther <nick.guenther@polymtl.ca>
This commit is contained in:
parent
51383ec084
commit
7b5b739a2f
5 changed files with 122 additions and 131 deletions
|
@ -96,7 +96,7 @@ func findReadmeFileInEntries(ctx *context.Context, entries []*git.TreeEntry) (*n
|
|||
}
|
||||
continue
|
||||
}
|
||||
if i, ok := markup.IsReadmeFileExtension(entry.Name(), exts...); ok {
|
||||
if i, ok := util.IsReadmeFileExtension(entry.Name(), exts...); ok {
|
||||
log.Debug("Potential readme file: %s", entry.Name())
|
||||
if readmeFiles[i] == nil || base.NaturalSortLess(readmeFiles[i].name, entry.Blob().Name()) {
|
||||
name := entry.Name()
|
||||
|
@ -423,7 +423,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
|
|||
rd := charset.ToUTF8WithFallbackReader(io.MultiReader(bytes.NewReader(buf), dataRc))
|
||||
|
||||
shouldRenderSource := ctx.FormString("display") == "source"
|
||||
readmeExist := markup.IsReadmeFile(blob.Name())
|
||||
readmeExist := util.IsReadmeFileName(blob.Name())
|
||||
ctx.Data["ReadmeExist"] = readmeExist
|
||||
|
||||
markupType := markup.Type(blob.Name())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue