aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvosjedev <vosje+git@vosjedev.net>2025-10-10 19:34:29 +0200
committervosjedev <vosje+git@vosjedev.net>2025-10-10 19:34:29 +0200
commitcd99253de289b28134b185803eb02b617b23ea81 (patch)
treea22ab7a550417ea4156a257340d4859249f56896
parent51b0e8520c4ec4d246511f272b3764d6dbed0943 (diff)
downloadcgit-cd99253de289b28134b185803eb02b617b23ea81.tar.gz
cgit-cd99253de289b28134b185803eb02b617b23ea81.tar.bz2
cgit-cd99253de289b28134b185803eb02b617b23ea81.tar.xz
ui-summary: add the readme to the summary page
Add the readme to the summary page. Also add some css. Signed-off-by: vosjedev <vosje+git@vosjedev.net>
-rw-r--r--cgit.css14
-rw-r--r--ui-summary.c27
2 files changed, 41 insertions, 0 deletions
diff --git a/cgit.css b/cgit.css
index dab5977..d80bec1 100644
--- a/cgit.css
+++ b/cgit.css
@@ -258,6 +258,11 @@ div#cgit div#summary {
margin-bottom: 1em;
}
+div#cgit div.embedded-readme {
+ margin-top: 1em;
+
+}
+
div#cgit table#downloads {
float: right;
border-collapse: collapse;
@@ -962,3 +967,12 @@ div#cgit span.libravatar:hover > img.onhover {
background-color: #eeeeee;
box-shadow: 2px 2px 7px rgba(100,100,100,0.75);
}
+
+
+div#cgit div.embedded-readme {
+ border-top: solid 2px #ccc;
+ background-color: #eee;
+ padding: 1.5em;
+ margin-top: 2em;
+}
+
diff --git a/ui-summary.c b/ui-summary.c
index 947812a..4f6b34d 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -62,6 +62,33 @@ void cgit_print_summary(void)
urls = 0;
cgit_add_clone_urls(print_url);
html("</table>");
+
+ /* the following code was modified from cgit_print_repo_readme() */
+
+ if (ctx.repo->readme.nr >= 1) {
+ char *filename, *ref;
+
+ filename = ctx.repo->readme.items[0].string;
+ ref = ctx.repo->readme.items[0].util;
+
+ /* Print the calculated readme, either from the git repo or from the
+ * filesystem, while applying the about-filter.
+ */
+ html("<div id='summary' class='embedded-readme'>");
+ cgit_open_filter(ctx.repo->about_filter, filename);
+ if (ref)
+ cgit_print_file(filename, ref, 1);
+ else
+ html_include(filename);
+ cgit_close_filter(ctx.repo->about_filter);
+
+ html("</div>");
+ }
+
+
+ /* end of code taken from cgit_print_repo_readme() */
+
+
cgit_print_layout_end();
}