Added README.md and makrdown Support
This commit is contained in:
parent
3aa2c29a9a
commit
89ffd78a33
18
README.md
Normal file
18
README.md
Normal file
@ -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**
|
||||
|
43
gitweb.cgi
43
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';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user