Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for uppercase readme only #2852

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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