summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--html.c16
-rw-r--r--html.h1
-rw-r--r--ui-repolist.c8
-rw-r--r--ui-shared.c20
-rw-r--r--ui-shared.h1
5 files changed, 32 insertions, 14 deletions
diff --git a/html.c b/html.c
index 167127f..d7d9fd7 100644
--- a/html.c
+++ b/html.c
@@ -130,2 +130,18 @@ void html_attr(char *txt)
+void html_url_path(char *txt)
+{
+ char *t = txt;
+ while(t && *t){
+ int c = *t;
+ if (c=='"' || c=='#' || c=='\'' || c=='?') {
+ write(htmlfd, txt, t - txt);
+ write(htmlfd, fmt("%%%2x", c), 3);
+ txt = t+1;
+ }
+ t++;
+ }
+ if (t!=txt)
+ html(txt);
+}
+
void html_url_arg(char *txt)
diff --git a/html.h b/html.h
index 038cf60..a55d4b2 100644
--- a/html.h
+++ b/html.h
@@ -12,2 +12,3 @@ extern void html_ntxt(int len, char *txt);
extern void html_attr(char *txt);
+extern void html_url_path(char *txt);
extern void html_url_arg(char *txt);
diff --git a/ui-repolist.c b/ui-repolist.c
index 725338b..ab050c7 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -133,5 +133,3 @@ void cgit_print_repolist()
ctx.repo->group ? "sublevel-repo" : "toplevel-repo");
- html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL);
- html_txt(ctx.repo->name);
- html_link_close();
+ cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL);
html("</td><td>");
@@ -147,5 +145,3 @@ void cgit_print_repolist()
html("<td>");
- html_link_open(cgit_repourl(ctx.repo->url),
- NULL, "button");
- html("summary</a>");
+ cgit_summary_link("summary", NULL, "button", NULL);
cgit_log_link("log", NULL, "button", NULL, NULL, NULL,
diff --git a/ui-shared.c b/ui-shared.c
index a2f636c..1fc5c09 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -208,6 +208,6 @@ static char *repolink(char *title, char *class, char *page, char *head,
if (ctx.cfg.virtual_root) {
- html_attr(ctx.cfg.virtual_root);
+ html_url_path(ctx.cfg.virtual_root);
if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/')
html("/");
- html_attr(ctx.repo->url);
+ html_url_path(ctx.repo->url);
if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
@@ -215,6 +215,6 @@ static char *repolink(char *title, char *class, char *page, char *head,
if (page) {
- html(page);
+ html_url_path(page);
html("/");
if (path)
- html_attr(path);
+ html_url_path(path);
}
@@ -259,2 +259,7 @@ static void reporevlink(char *page, char *name, char *title, char *class,
+void cgit_summary_link(char *name, char *title, char *class, char *head)
+{
+ reporevlink(NULL, name, title, class, head, NULL, NULL);
+}
+
void cgit_tree_link(char *name, char *title, char *class, char *head,
@@ -600,4 +605,3 @@ void cgit_print_pageheader(struct cgit_context *ctx)
html(" : ");
- reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"),
- ctx->qry.head, NULL, NULL);
+ cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL, NULL);
html("</td><td class='form'>");
@@ -629,4 +633,4 @@ void cgit_print_pageheader(struct cgit_context *ctx)
if (ctx->repo) {
- reporevlink(NULL, "summary", NULL, hc(cmd, "summary"),
- ctx->qry.head, NULL, NULL);
+ cgit_summary_link(ctx->repo->name, ctx->repo->name, NULL,
+ ctx->qry.head);
cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
diff --git a/ui-shared.h b/ui-shared.h
index 747f092..0cd5ed1 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -12,2 +12,3 @@ extern void cgit_index_link(char *name, char *title, char *class,
char *pattern, int ofs);
+extern void cgit_summary_link(char *name, char *title, char *class, char *head);
extern void cgit_tree_link(char *name, char *title, char *class, char *head,