aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortinfoil-hat <mail@tinfoil-hat.net>2021-08-20 22:42:18 +0200
committertinfoil-hat <mail@tinfoil-hat.net>2021-08-20 22:42:18 +0200
commit89ffd78a33addc6f18d86b6ac9370476be6955f2 (patch)
tree71efe798fdc1b88f0b696b707b4d91b363474adc
parent3aa2c29a9ad084639a1ea348809210dd781cb41d (diff)
downloadgitweb-89ffd78a33addc6f18d86b6ac9370476be6955f2.tar.gz
gitweb-89ffd78a33addc6f18d86b6ac9370476be6955f2.tar.bz2
gitweb-89ffd78a33addc6f18d86b6ac9370476be6955f2.zip
Added README.md and makrdown Support
-rw-r--r--README.md18
-rwxr-xr-xgitweb.cgi43
2 files changed, 61 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1b47653
--- /dev/null
+++ b/README.md
@@ -0,0 +1,18 @@
+# README
+
+Forked from qorg11.net
+
+A modified gitweb.css with dak theme and Support for displaying README.md
+
+On Debian based Systems you need to install the Package *Markdown*
+
+<code>apt-get install markdown</code>
+
+to apply the theme copy the files to */usr/share/gitweb/gitweb.cgi* and */usr/share/gitweb/static/gitweb.css*
+
+Do not forget to configure your <code>/etc/gitweb.conf</code> to support css and javascript
+
+*this theme is hardforked from* [https://github.com/kogakure/gitweb-theme](https://github.com/kogakure/gitweb-theme)
+
+**NOTE: README.md needs to be XML compatible otherwise Gitweb will fail to display correctly**
+
diff --git a/gitweb.cgi b/gitweb.cgi
index 429cf64..77d7035 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -4206,6 +4206,49 @@ EOF
}
}
+ if (!$prevent_xss) {
+ $file_name = "README.md";
+ my $proj_head_hash = git_get_head_hash($project);
+ my $readme_blob_hash = git_get_hash_by_path($proj_head_hash, "README.md", "blob");
+
+ if ($readme_blob_hash) { # if README.md exists
+ # print "<div class=\"header\">readme</div>\n";
+ print "<div class=\"readme page_body\">"; # TODO find/create a better CSS class than page_body
+
+ my $cmd_markdownify = $GIT . " " . git_cmd() . " cat-file blob " . $readme_blob_hash . " | markdown |";
+ open FOO, $cmd_markdownify or die_error(500, "Open git-cat-file blob '$hash' failed");
+ while (<FOO>) {
+ print $_;
+ }
+ close(FOO);
+
+ print "</div>";
+ }
+ }
+
+ if (!$prevent_xss) {
+ $file_name = "LICENSE";
+ my $proj_head_hash = git_get_head_hash($project);
+ my $readme_blob_hash = git_get_hash_by_path($proj_head_hash, "LICENSE", "blob");
+
+ if ($readme_blob_hash) { # if README.md exists
+ # print "<div class=\"header\">readme</div>\n";
+ print "<div class=\"readme page_body\">"; # TODO find/create a better CSS class than page_body
+
+ my $cmd_markdownify = $GIT . " " . git_cmd() . " cat-file blob " . $readme_blob_hash . " | markdown |";
+ open FOO, $cmd_markdownify or die_error(500, "Open git-cat-file blob '$hash' failed");
+ while (<FOO>) {
+ print $_;
+ }
+ close(FOO);
+
+ print "</div>";
+ }
+ }
+
+
+
+
sub git_footer_html {
my $feed_class = 'rss_logo';