remove html from blob output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
diff --git a/gotweb/files/cgi-bin/gw_tmpl/blob.tmpl b/gotweb/files/cgi-bin/gw_tmpl/blob.tmpl
index 1281926..e434f32 100644
--- a/gotweb/files/cgi-bin/gw_tmpl/blob.tmpl
+++ b/gotweb/files/cgi-bin/gw_tmpl/blob.tmpl
@@ -1,22 +1 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>@@title@@</title>
- @@head@@
- </head>
- <body>
- <div id="gw_body">
- <div id="header">
- @@header@@
- </div>
- <div id="site_path">
- @@sitepath@@
- @@search@@
- </div>
- <div id="content">
- @@content@@
- </div>
- @@siteowner@@
- </div>
- </body>
-</html>
+@@content@@
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index f1c85a7..b660738 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -367,7 +367,7 @@ gw_blob(struct gw_trans *gw_trans)
{
const struct got_error *error = NULL;
struct gw_header *header = NULL;
- char *blob = NULL, *blob_html = NULL, *blob_html_disp = NULL;
+ char *blob = NULL;
enum kcgi_err kerr;
if (pledge("stdio rpath wpath cpath proc exec sendfd unveil",
@@ -385,37 +385,22 @@ gw_blob(struct gw_trans *gw_trans)
if (error)
goto done;
- blob_html = gw_get_file_blame_blob(gw_trans);
+ blob = gw_get_file_blame_blob(gw_trans);
- if (blob_html == NULL) {
- blob_html = strdup("");
- if (blob_html == NULL) {
+ if (blob == NULL) {
+ blob = strdup("");
+ if (blob == NULL) {
error = got_error_from_errno("strdup");
goto done;
}
}
- if (asprintf(&blob_html_disp, blob_header,
- gw_gen_age_header(gw_get_time_str(header->committer_time, TM_LONG)),
- gw_gen_commit_msg_header(gw_html_escape(header->commit_msg)),
- blob_html) == -1) {
- error = got_error_from_errno("asprintf");
- goto done;
- }
-
- if (asprintf(&blob, blob_wrapper, blob_html_disp) == -1) {
- error = got_error_from_errno("asprintf");
- goto done;
- }
-
kerr = khttp_puts(gw_trans->gw_req, blob);
if (kerr != KCGI_OK)
error = gw_kcgi_error(kerr);
done:
got_ref_list_free(&header->refs);
gw_free_headers(header);
- free(blob_html_disp);
- free(blob_html);
free(blob);
return error;
}
@@ -1194,8 +1179,8 @@ gw_parse_querystring(struct gw_trans *gw_trans)
if ((p = gw_trans->gw_req->fieldmap[KEY_PAGE]))
gw_trans->page = p->parsed.i;
- /* if (gw_trans->action == GW_RAW) */
- /* gw_trans->mime = KMIME_TEXT_PLAIN; */
+ if (gw_trans->action == GW_BLOB)
+ gw_trans->mime = KMIME_TEXT_PLAIN;
return error;
}
diff --git a/gotweb/gotweb_ui.h b/gotweb/gotweb_ui.h
index 47c732d..fb264cc 100644
--- a/gotweb/gotweb_ui.h
+++ b/gotweb/gotweb_ui.h
@@ -208,30 +208,6 @@ char *briefs_navs =
"<a href='?path=%s&action=tree&commit=%s'>tree</a><!--/* | " \
"<a href='?path=%s&action=snapshot&commit=%s'>snapshot</a> */-->";
-/* blob.tmpl */
-
-char *blob_wrapper =
- "<div id='blob_title_wrapper'>" \
- "<div id='blob_title'>Blob</div></div>" \
- "<div id='blob_content'>%s</div>";
-
-char *blob_header =
- "<div id='blob_header_wrapper'>" \
- "<div id='blob_header'>%s%s</div>" \
- "</div>" \
- "<div id='dotted_line'></div>" \
- "<div id='blob'>%s</div>" \
- "</div>";
-
-char *blob_line =
- "<div id='blob_wrapper'>" \
- "<div id='blob_number'>%.*d</div>" \
- "<div id='blob_hash'>%.8s</div>" \
- "<div id='blob_date'>%s</div>" \
- "<div id='blob_author'>%-8s</div>" \
- "<div id='blob_code'>%s</div>" \
- "</div>";
-
/* blame.tmpl */
char *blame_wrapper =