From: Lars Hjemli Date: Sat, 25 Jul 2009 10:29:22 +0000 (+0200) Subject: Merge branch 'lh/embedded' X-Git-Tag: v0.8.3~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=286a905842dc0bec6d21a614ec4a97c5f19d5bc4;p=cgit Merge branch 'lh/embedded' Conflicts: cgitrc.5.txt ui-shared.c --- 286a905842dc0bec6d21a614ec4a97c5f19d5bc4 diff --cc cgitrc.5.txt index 683f3b5,771bb7d..a207fe0 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@@ -59,7 -59,12 +59,12 @@@ css: Url which specifies the css document to include in all cgit pages. Default value: "/cgit.css". -embedded ++embedded:: + Flag which, when set to "1", will make cgit generate a html fragment + suitable for embedding in other html pages. Default value: none. See + also: "noheader". + -enable-index-links +enable-index-links:: Flag which, when set to "1", will make cgit generate extra links for each repo in the repository index (specifically, to the "summary", "commit" and "tree" pages). Default value: "0". @@@ -153,7 -154,11 +158,11 @@@ nocache: deprecated, and will not be honored starting with cgit-1.0. Default value: "0". -noheader ++noheader:: + Flag which, when set to "1", will make cgit omit the standard header + on all pages. Default value: none. See also: "embedded". + -renamelimit +renamelimit:: Maximum number of files to consider when detecting renames. The value "-1" uses the compiletime value in git (for further info, look at `man git-diff`). Default value: "-1". diff --cc ui-shared.c index 66d5b82,5e03a7a..015c52b --- a/ui-shared.c +++ b/ui-shared.c @@@ -467,10 -456,9 +467,13 @@@ void cgit_print_age(time_t t, time_t ma void cgit_print_http_headers(struct cgit_context *ctx) { + const char *method = getenv("REQUEST_METHOD"); + + if (ctx->cfg.embedded) + return; + + if (ctx->page.status) + htmlf("Status: %d %s\n", ctx->page.status, ctx->page.statusmsg); if (ctx->page.mimetype && ctx->page.charset) htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype, ctx->page.charset);