Skip to content

Commit

Permalink
Check only for uppercase README.md file (#2852)
Browse files Browse the repository at this point in the history
  • Loading branch information
drts01 committed Jul 18, 2022
1 parent 82bd8ba commit 042d7c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mkdocs/structure/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ def get_files(config):
if _filter_paths(basename=filename, path=path, is_dir=False, exclude=exclude):
continue
# Skip README.md if an index file also exists in dir
if filename.lower() == 'readme.md' and 'index.md' in filenames:
log.warning(f"Both index.md and readme.md found. Skipping readme.md from {source_dir}")
if filename == 'README.md' and 'index.md' in filenames:
log.warning(f"Both index.md and README.md found. Skipping README.md from {source_dir}")
continue
files.append(File(path, config['docs_dir'], config['site_dir'], config['use_directory_urls']))

Expand Down
3 changes: 2 additions & 1 deletion mkdocs/tests/structure/file_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def test_get_relative_url(self):

@tempdir(files=[
'index.md',
'readme.md',
'bar.css',
'bar.html',
'bar.jpg',
Expand All @@ -603,7 +604,7 @@ def test_get_relative_url(self):
def test_get_files(self, tdir):
config = load_config(docs_dir=tdir, extra_css=['bar.css'], extra_javascript=['bar.js'])
files = get_files(config)
expected = ['index.md', 'bar.css', 'bar.html', 'bar.jpg', 'bar.js', 'bar.md']
expected = ['index.md', 'bar.css', 'bar.html', 'bar.jpg', 'bar.js', 'bar.md', 'readme.md']
self.assertIsInstance(files, Files)
self.assertEqual(len(files), len(expected))
self.assertEqual([f.src_path for f in files], expected)
Expand Down

0 comments on commit 042d7c2

Please sign in to comment.