aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 059f449..d978524 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -366,17 +366,17 @@ void cgit_commit_link2(char *name, const char *title, const char *class,
int last_match = 0;
int offset = 0;
for (;;) {
- const char* sub = strstr(name + last_match + offset, "FS#");
- if (sub != NULL) {
+ const char* sub = strstr(name + last_match + offset, ISSUE_MARKER);
+ if (sub) {
int found_pos = (sub - (name + last_match));
- sub += 3;
+ sub += STRLEN_ISSUE_MARKER;
int numbercount = 0;
while (*sub >= '0' && *sub <= '9') {
numbercount++;
sub++;
}
if (!numbercount) {
- offset = found_pos + 3;
+ offset = found_pos + STRLEN_ISSUE_MARKER;
continue;
} else {
offset = 0;
@@ -386,10 +386,10 @@ void cgit_commit_link2(char *name, const char *title, const char *class,
cgit_commit_link3(left_part, title, class, head, rev, path);
free(left_part);
}
- char* issue_part = sub_str(name, last_match + found_pos, last_match + found_pos + 3 + numbercount);
- cgit_issue_link(issue_part);
+ char* issue_part = sub_str(name, last_match + found_pos, last_match + found_pos + STRLEN_ISSUE_MARKER + numbercount);
+ cgit_issue_link(issue_part, "FS-link");
free(issue_part);
- last_match += found_pos + 3 + numbercount;
+ last_match += found_pos + STRLEN_ISSUE_MARKER + numbercount;
} else {
if (strlen(name + last_match)) {
cgit_commit_link3(name + last_match, title, class, head, rev, path);
@@ -1159,7 +1159,7 @@ extern void cgit_author_link(const char *author, const char *head)
delim = repolink(NULL, NULL, "log", head ? head : ctx.qry.head, NULL);
html(delim);
- htmlf("qt=author&amp;q=");
+ html("qt=author&amp;q=");
html_url_arg(author);
html("'>");
html_txt(author);
@@ -1171,17 +1171,17 @@ extern void cgit_check_text_for_issue_link(const char* text)
int last_match = 0;
int offset = 0;
for (;;) {
- const char* sub = strstr(text + last_match + offset, "FS#");
- if(sub != NULL) {
+ const char* sub = strstr(text + last_match + offset, ISSUE_MARKER);
+ if(sub) {
int found_pos = (sub - (text + last_match));
- sub += 3;
+ sub += STRLEN_ISSUE_MARKER;
int numbercount = 0;
while (*sub >= '0' && *sub <= '9') {
numbercount++;
sub++;
}
if (!numbercount) {
- offset = found_pos + 3;
+ offset = found_pos + STRLEN_ISSUE_MARKER;
continue;
} else {
offset = 0;
@@ -1191,10 +1191,10 @@ extern void cgit_check_text_for_issue_link(const char* text)
html_txt(left_part);
free(left_part);
}
- char* issue_part = sub_str(text, last_match + found_pos, last_match + found_pos + 3 + numbercount);
- cgit_issue_link(issue_part);
+ char* issue_part = sub_str(text, last_match + found_pos, last_match + found_pos + STRLEN_ISSUE_MARKER + numbercount);
+ cgit_issue_link(issue_part, NULL);
free(issue_part);
- last_match += found_pos + 3 + numbercount;
+ last_match += found_pos + STRLEN_ISSUE_MARKER + numbercount;
} else {
if (strlen(text + last_match)) {
html_txt(text + last_match);
@@ -1204,14 +1204,21 @@ extern void cgit_check_text_for_issue_link(const char* text)
}
}
-extern void cgit_issue_link(const char* issue)
+extern void cgit_issue_link(const char* issue, const char* class)
{
html("<a href='");
htmlf(ctx.cfg.issue_link);
if (strlen(issue) > 3) {
- htmlf(issue + 3);
+ html(issue + 3);
}
- html("' target='_blank'>");
+ html("'");
+ if (class) {
+ html(" class='");
+ html(class);
+ html("'");
+ }
+ html(" target='_blank'");
+ html(">");
html_txt(issue);
html("</a>");
}