Skip to content

Commit

Permalink
v0.8: markdown folder list
Browse files Browse the repository at this point in the history
  • Loading branch information
unytics committed Jun 12, 2024
1 parent 9e8268d commit 70d42da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions catalog_builder/catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def files_to_ignore(path, names):
return [
name
for name in names
if '.' in name and not name.endswith(('.md', '.css', '.js', '.html', '.png', '.jpg', '.jpeg'))
if '.' in name and not name.endswith(('.md', '.css', '.js', '.html', '.png', '.jpg', '.jpeg', '.avif'))
]

for folder in markdown_folder_paths_to_include:
Expand All @@ -115,9 +115,15 @@ def _generate_markdown_of_folders(self):
for root, folders, files in os.walk(self.generated_docs_folder):
index_file = next((file for file in files if file.lower() in ['index.md', 'readme.md']), None)
if index_file in files:
content = open(f"{root}/{index_file}", encoding="utf-8").read()
content = open(f"{root}/{index_file}", encoding="utf-8").read().strip()
if not content.startswith('# '):
content = (
"# " + os.path.basename(root).replace("_", " ").lower().title() +
'\n' * 2 +
content
)
else:
content = "# " + os.path.basename(root).replace("_", " ").title()
content = "# " + os.path.basename(root).replace("_", " ").lower().title()
if root == self.generated_docs_folder:
files_and_folders = None
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import setuptools


VERSION = '0.7'
VERSION = '0.8'


with open('README.md', 'r', encoding='utf-8') as fh:
Expand Down

0 comments on commit 70d42da

Please sign in to comment.