From 0cbb50841ac82e08e715bbff614f96c7d5ba22fa Mon Sep 17 00:00:00 2001
From: Lars Hjemli
Date: Thu, 22 Jan 2009 23:33:56 +0100
Subject: Add support for an 'embedded' option in cgitrc
When activated, cgit will neither generate http headers nor any 'framing'
html elements (like and
). Also, all page content is now
wrapped in a element to make it easier to select the
correct cgit classes when embedded/themed.
Suggested-by: Matt Sealey
Signed-off-by: Lars Hjemli
---
cgit.c | 2 ++
1 file changed, 2 insertions(+)
(limited to 'cgit.c')
diff --git a/cgit.c b/cgit.c
index 64d95f9..2aef44d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -71,6 +71,8 @@ void config_cb(const char *name, const char *value)
ctx.cfg.cache_static_ttl = atoi(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);
else if (!strcmp(name, "max-repodesc-length"))
--
cgit v1.2.3-70-g09d2
From ef0c6aadf70e33ef63f0a68ca16338a49d0a3f1f Mon Sep 17 00:00:00 2001
From: Lars Hjemli
Date: Sat, 25 Jul 2009 12:19:31 +0200
Subject: Add support for 'noheader' option
This option can be used to disable the standard cgit page header, which
might be useful in combination with the 'embedded' option.
Suggested-by: Mark Constable
Signed-off-by: Lars Hjemli
---
cgit.c | 2 ++
cgit.h | 1 +
ui-shared.c | 20 +++++++++++++-------
3 files changed, 16 insertions(+), 7 deletions(-)
(limited to 'cgit.c')
diff --git a/cgit.c b/cgit.c
index 2aef44d..38f0fdd 100644
--- a/cgit.c
+++ b/cgit.c
@@ -49,6 +49,8 @@ void config_cb(const char *name, const char *value)
ctx.cfg.virtual_root = "";
} else if (!strcmp(name, "nocache"))
ctx.cfg.nocache = atoi(value);
+ else if (!strcmp(name, "noheader"))
+ ctx.cfg.noheader = atoi(value);
else if (!strcmp(name, "snapshots"))
ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
else if (!strcmp(name, "enable-index-links"))
diff --git a/cgit.h b/cgit.h
index 73d7208..1056231 100644
--- a/cgit.h
+++ b/cgit.h
@@ -172,6 +172,7 @@ struct cgit_config {
int summary_log;
int summary_tags;
int embedded;
+ int noheader;
};
struct cgit_page {
diff --git a/ui-shared.c b/ui-shared.c
index f18b2c7..5e03a7a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -611,14 +611,8 @@ char *hc(struct cgit_cmd *cmd, const char *page)
return (strcmp(cmd ? cmd->name : fallback_cmd, page) ? NULL : "active");
}
-void cgit_print_pageheader(struct cgit_context *ctx)
+static void print_header(struct cgit_context *ctx)
{
- struct cgit_cmd *cmd = cgit_get_cmd(ctx);
-
- if (!cmd && ctx->repo)
- fallback_cmd = "summary";
-
- html("");
html("