aboutsummaryrefslogtreecommitdiff
path: root/templates/repo_folder.html
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-22 06:44:04 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-22 06:44:04 -0600
commit7620dd41ca41cf4fb445d6a6e9afe2607ed77a95 (patch)
tree7dbe0decfae17563886418ef653d5461c57e51cb /templates/repo_folder.html
parent1fc46e3c0bd0075f6ca9eeb50eecad10dbf767b8 (diff)
downloadgityeet-7620dd41ca41cf4fb445d6a6e9afe2607ed77a95.tar.gz
gityeet-7620dd41ca41cf4fb445d6a6e9afe2607ed77a95.zip
actually handle subfolders
Diffstat (limited to 'templates/repo_folder.html')
-rw-r--r--templates/repo_folder.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/templates/repo_folder.html b/templates/repo_folder.html
new file mode 100644
index 0000000..6f6b3a9
--- /dev/null
+++ b/templates/repo_folder.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport"
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ <title>{{ title }}</title>
+</head>
+<body>
+<h1><a href="/">gityeet</a></h1>
+<p>{{ rel_path }}</p>
+{%- macro effective_name(entry) -%}
+ {{- entry.name().unwrap() -}}
+ {%- match entry.kind() -%}
+ {%- when Some with (x) %}{% match x %}{% when git2::ObjectType::Tree %}/{% else %}{% endmatch %}
+ {%- else -%}
+ {%- endmatch -%}
+{%- endmacro -%}
+<ul>
+ {% for entry in tree -%}
+ <li><a href="/{{ repo_path }}/tree{{ rel_path }}{% call effective_name(entry) %}">
+ {%- call effective_name(entry) -%}
+ </a></li>
+ {%- endfor %}
+</ul>
+{% for entry in tree -%}
+{% if entry.name().unwrap() == "README.md" -%}
+{{ entry.to_object(repo).unwrap().into_blob().unwrap().content()|from_utf8_lossy|markdown|safe }}
+{%- endif %}
+{%- endfor %}
+</body>
+</html>