summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h1
-rw-r--r--ui-shared.c10
3 files changed, 13 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 64d95f9..2aef44d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -72,4 +72,6 @@ void config_cb(const char *name, const char *value)
else if (!strcmp(name, "cache-dynamic-ttl"))
ctx.cfg.cache_dynamic_ttl = atoi(value);
+ else if (!strcmp(name, "embedded"))
+ ctx.cfg.embedded = atoi(value);
else if (!strcmp(name, "max-message-length"))
ctx.cfg.max_msg_len = atoi(value);
diff --git a/cgit.h b/cgit.h
index 5f7af51..73d7208 100644
--- a/cgit.h
+++ b/cgit.h
@@ -172,4 +172,5 @@ struct cgit_config {
int summary_log;
int summary_tags;
+ int embedded;
};
diff --git a/ui-shared.c b/ui-shared.c
index de77bbf..f18b2c7 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -457,4 +457,7 @@ void cgit_print_age(time_t t, time_t max_relative, char *format)
void cgit_print_http_headers(struct cgit_context *ctx)
{
+ if (ctx->cfg.embedded)
+ return;
+
if (ctx->page.mimetype && ctx->page.charset)
htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype,
@@ -474,4 +477,7 @@ void cgit_print_http_headers(struct cgit_context *ctx)
void cgit_print_docstart(struct cgit_context *ctx)
{
+ if (ctx->cfg.embedded)
+ return;
+
char *host = cgit_hosturl();
html(cgit_doctype);
@@ -516,4 +522,7 @@ void cgit_print_docend()
html("</div>\n");
}
+ html("</div>");
+ if (ctx.cfg.embedded)
+ return;
html("</body>\n</html>\n");
}
@@ -610,4 +619,5 @@ void cgit_print_pageheader(struct cgit_context *ctx)
fallback_cmd = "summary";
+ html("<div id='cgit'>");
html("<table id='header'>\n");
html("<tr>\n");