summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2025-10-10 17:00:13 +0200
committerChristoph Schlosser <christoph@linux.com>2025-10-10 17:00:13 +0200
commit2a076517255c4585ac2bc475aaafdc728b6dae6f (patch)
tree1db9e6d5538944b15d593e308aed5795a160919c
parent04f8d5f3093e1b13aa704590f4d0bf9dce6afce9 (diff)
downloadgit2hugo-2a076517255c4585ac2bc475aaafdc728b6dae6f.tar.gz
g2h: Link uppercase file names to lowercase
Hugo will convert all uppercase names to lowercase and then it depends on the webserver :/
-rw-r--r--README.md3
-rw-r--r--src/g2h/tree_page.py2
-rw-r--r--test_repo/README.md3
-rw-r--r--test_repo/git.tgzbin42639 -> 43658 bytes
-rw-r--r--tests/tree_page_test.py2
5 files changed, 8 insertions, 2 deletions
diff --git a/README.md b/README.md
index 4faac5f..c908e1d 100644
--- a/README.md
+++ b/README.md
@@ -59,6 +59,7 @@ For a full list of options, their defaults and how they're changing the behavior
- [x] Don't treat pictures as binary files.
- [x] Breadcrumbs for navigating.
- [x] Escape markdown backticks in plaintext files.
+ - [ ] Render markdown files.
- [ ] Add button to download raw file.
- [x] Nav bar for navigating the pages mentioned above.
- [ ] Link to special readme, if a readme can be found, rendering markdown.
@@ -66,6 +67,8 @@ For a full list of options, their defaults and how they're changing the behavior
- [ ] Limit to certain branch(es).
- [ ] Limit commit range.
- [ ] Parallelize generating output.
+- [ ] Rename directories with a leading dot.
+- [ ] Fix filenames that contain markdown formatting, like Pythons `__init__.py`.
## Similar projects
diff --git a/src/g2h/tree_page.py b/src/g2h/tree_page.py
index df65a33..482ef99 100644
--- a/src/g2h/tree_page.py
+++ b/src/g2h/tree_page.py
@@ -25,7 +25,7 @@ class TreePage(Page):
else:
file_name = sanitize_file_name(name, self.tree.blobs)
entry = {
- 'file_name': file_name,
+ 'file_name': file_name.lower(),
'name': name,
'modified': latest_commit.committed_datetime
}
diff --git a/test_repo/README.md b/test_repo/README.md
new file mode 100644
index 0000000..5596b33
--- /dev/null
+++ b/test_repo/README.md
@@ -0,0 +1,3 @@
+# Test
+
+Repo
diff --git a/test_repo/git.tgz b/test_repo/git.tgz
index 0377aeb..bf20c4f 100644
--- a/test_repo/git.tgz
+++ b/test_repo/git.tgz
Binary files differ
diff --git a/tests/tree_page_test.py b/tests/tree_page_test.py
index 53738c6..7fe8fac 100644
--- a/tests/tree_page_test.py
+++ b/tests/tree_page_test.py
@@ -73,7 +73,7 @@ def test_context_entries():
page = TreePage('test/tree', 'tree test', commit, '', repo, '')
context = page.context()
assert(repo.iter_commits.called)
- assert(context['entries'] == [{'file_name': 'sub//', 'name': 'sub//', 'modified': 'Date Time'}, {'file_name': '_gitignore', 'name': '.gitignore', 'modified': 'Date Time'}, {'file_name': 'README', 'name': 'README', 'modified': 'Date Time'}])
+ assert(context['entries'] == [{'file_name': 'sub//', 'name': 'sub//', 'modified': 'Date Time'}, {'file_name': '_gitignore', 'name': '.gitignore', 'modified': 'Date Time'}, {'file_name': 'readme', 'name': 'README', 'modified': 'Date Time'}])
def test_traversal():
factory = MagicMock()