Render index.* like README.* when it's present in a directory
Resolves #18933
This commit is contained in:
parent
c0d30fad97
commit
cb3f851098
3 changed files with 11 additions and 2 deletions
5
changelogs/unreleased/18933-render-index-as-readme.yml
Normal file
5
changelogs/unreleased/18933-render-index-as-readme.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Make index.* render like README.* when it's present in a repository
|
||||
merge_request: 16550
|
||||
author: Jakub Jirutka
|
||||
type: added
|
|
@ -8,7 +8,7 @@ module Gitlab
|
|||
module FileDetector
|
||||
PATTERNS = {
|
||||
# Project files
|
||||
readme: %r{\Areadme[^/]*\z}i,
|
||||
readme: %r{\A(readme|index)[^\/]*\z}i,
|
||||
changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i,
|
||||
license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i,
|
||||
contributing: %r{\Acontributing[^/]*\z}i,
|
||||
|
|
|
@ -15,7 +15,11 @@ describe Gitlab::FileDetector do
|
|||
|
||||
describe '.type_of' do
|
||||
it 'returns the type of a README file' do
|
||||
expect(described_class.type_of('README.md')).to eq(:readme)
|
||||
%w(README readme INDEX index).each do |filename|
|
||||
%w(.md .adoc).each do |extname|
|
||||
expect(described_class.type_of(filename + extname)).to eq(:readme)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns nil for a README file in a directory' do
|
||||
|
|
Loading…
Reference in a new issue