Diff options
Diffstat (limited to 'source/ui-shared.c')
-rw-r--r--source/ui-shared.c41
1 file changed, 17 insertions, 24 deletions
diff --git a/source/ui-shared.c b/source/ui-shared.c
index afdf991..687b773 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -72,23 +72,11 @@ static void site_url(const char *page, const char *search, const char *sort, int
}
/*
- * Write the class of a link, and mark the link as the current one for
- * assistive technology when the class says it is the active tab or the
+ * Open an anchor up to the start of its href, marking the link as the current
+ * one for assistive technology when the class says it is the active tab or the
* current page of a pager.
*/
-static void link_class(const char *class)
-{
- if (!class)
- return;
- html(" class='");
- html_attr(class);
- html("'");
- if (!strcmp(class, "active") || !strcmp(class, "current"))
- html(" aria-current='page'");
-}
-
-static void site_link(const char *page, const char *name, const char *title,
- const char *class, const char *search, const char *sort, int ofs, int always_root)
+static void open_link(const char *title, const char *class)
{
html("<a");
if (title) {
@@ -96,8 +84,20 @@ static void site_link(const char *page, const char *name, const char *title,
html_attr(title);
html("'");
}
- link_class(class);
+ if (class) {
+ html(" class='");
+ html_attr(class);
+ html("'");
+ if (!strcmp(class, "active") || !strcmp(class, "current"))
+ html(" aria-current='page'");
+ }
html(" href='");
+}
+
+static void site_link(const char *page, const char *name, const char *title,
+ const char *class, const char *search, const char *sort, int ofs, int always_root)
+{
+ open_link(title, class);
site_url(page, search, sort, ofs, always_root);
html("'>");
html_txt(name);
@@ -140,14 +140,7 @@ static const char *repolink(const char *title, const char *class, const char *pa
{
const char *delim = "?";
- html("<a");
- if (title) {
- html(" title='");
- html_attr(title);
- html("'");
- }
- link_class(class);
- html(" href='");
+ open_link(title, class);
write_page_url(page, path);
if (head_is_named(head))
delim = url_arg(delim, "h", head);