diff options
author | tinfoil-hat <mail@tinfoil-hat.net> | 2021-08-20 22:42:18 +0200 |
---|---|---|
committer | tinfoil-hat <mail@tinfoil-hat.net> | 2021-08-20 22:42:18 +0200 |
commit | 89ffd78a33addc6f18d86b6ac9370476be6955f2 (patch) | |
tree | 71efe798fdc1b88f0b696b707b4d91b363474adc | |
parent | 3aa2c29a9ad084639a1ea348809210dd781cb41d (diff) | |
download | gitweb-89ffd78a33addc6f18d86b6ac9370476be6955f2.tar.gz gitweb-89ffd78a33addc6f18d86b6ac9370476be6955f2.tar.bz2 gitweb-89ffd78a33addc6f18d86b6ac9370476be6955f2.zip |
Added README.md and makrdown Support
-rw-r--r-- | README.md | 18 | ||||
-rwxr-xr-x | gitweb.cgi | 43 |
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** + @@ -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'; |