aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cgit.css4
-rw-r--r--ui-shared.c43
-rw-r--r--ui-shared.h5
3 files changed, 33 insertions, 19 deletions
diff --git a/cgit.css b/cgit.css
index 82c755c..555dd7c 100644
--- a/cgit.css
+++ b/cgit.css
@@ -195,6 +195,10 @@ div#cgit table.list td a {
color: black;
}
+div#cgit table.list td a.FS-link {
+ color: blue;
+}
+
div#cgit table.list td a.ls-dir {
font-weight: bold;
color: #00f;
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>");
}
diff --git a/ui-shared.h b/ui-shared.h
index 9b972b5..6b4f9aa 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -1,6 +1,9 @@
#ifndef UI_SHARED_H
#define UI_SHARED_H
+#define ISSUE_MARKER "FS#"
+#define STRLEN_ISSUE_MARKER 3
+
extern const char *cgit_httpscheme(void);
extern char *cgit_hosturl(void);
extern const char *cgit_rooturl(void);
@@ -83,5 +86,5 @@ extern void cgit_add_hidden_formfields(int incl_head, int incl_search,
const char *page);
extern void cgit_author_link(const char *author, const char *head);
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);
#endif /* UI_SHARED_H */