diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Tidy the structure of the generated markup
Diffstat (limited to 'source')
-rw-r--r--source/ui-commit.c14
-rw-r--r--source/ui-diff.c16
-rw-r--r--source/ui-log.c2
-rw-r--r--source/ui-refs.c10
-rw-r--r--source/ui-repolist.c10
-rw-r--r--source/ui-shared.c18
-rw-r--r--source/ui-ssdiff.c10
-rw-r--r--source/ui-stats.c18
-rw-r--r--source/ui-summary.c4
9 files changed, 51 insertions, 51 deletions
diff --git a/source/ui-commit.c b/source/ui-commit.c
index 5a71954..befff25 100644
--- a/source/ui-commit.c
+++ b/source/ui-commit.c
@@ -55,7 +55,7 @@ static int print_parent_rows(struct commit *commit, const char *rev,
if (!parent) {
html("<tr><td colspan='3'>");
cgit_print_error("Error reading parent commit");
- html("</td></tr>");
+ html("</td></tr>\n");
continue;
}
html("<tr><th>parent</th>"
@@ -68,7 +68,7 @@ static int print_parent_rows(struct commit *commit, const char *rev,
html(" (");
cgit_diff_link("diff", NULL, NULL, ctx.qry.head, rev,
oid_to_hex(&p->item->object.oid), prefix);
- html(")</td></tr>");
+ html(")</td></tr>\n");
parents++;
}
return parents;
@@ -153,16 +153,16 @@ void cgit_print_commit(char *hex, const char *prefix)
html("<div class='commit-subject'>");
print_filtered_text(info->subject);
cgit_print_commit_decorations(commit);
- html("</div>");
+ html("</div>\n");
html("<div class='commit-msg'>");
print_filtered_text(info->msg);
- html("</div>");
+ html("</div>\n");
if (notes.len != 0) {
- html("<div class='notes-header'>Notes</div>");
+ html("<div class='notes-header'>Notes</div>\n");
html("<div class='notes'>");
print_filtered_text(notes.buf);
- html("</div>");
- html("<div class='notes-footer'></div>");
+ html("</div>\n");
+ html("<div class='notes-footer'></div>\n");
}
if (parents < OCTOPUS_PARENTS) {
diff --git a/source/ui-diff.c b/source/ui-diff.c
index 4ac3673..d6232a3 100644
--- a/source/ui-diff.c
+++ b/source/ui-diff.c
@@ -468,8 +468,8 @@ static void print_diffstat(const struct object_id *old_oid,
html_txt(prefix);
html("')");
}
- html("</div>");
- html("<table summary='diffstat' class='diffstat'>");
+ html("</div>\n");
+ html("<table class='diffstat'>\n");
max_changes = 0;
cgit_diff_tree(old_oid, new_oid, inspect_filepair, prefix,
ctx.qry.ignorews);
@@ -719,11 +719,11 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
return;
}
- html("<div class='diff-scroll'>");
+ html("<div class='diff-scroll'>\n");
if (use_ssdiff) {
- html("<table summary='ssdiff' class='ssdiff'>");
+ html("<table class='ssdiff'>\n");
} else {
- html("<table summary='diff' class='diff'>");
+ html("<table class='diff'>\n");
html("<tr><td>");
}
if (bodies_usable) {
@@ -738,9 +738,9 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
ctx.qry.ignorews);
}
if (!use_ssdiff)
- html("</td></tr>");
- html("</table>");
- html("</div>");
+ html("</td></tr>\n");
+ html("</table>\n");
+ html("</div>\n");
if (show_ctrls)
cgit_print_layout_end();
diff --git a/source/ui-log.c b/source/ui-log.c
index 97c8925..6c428f3 100644
--- a/source/ui-log.c
+++ b/source/ui-log.c
@@ -544,7 +544,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep,
if (pager) {
cgit_print_layout_start();
- html("<table class='list'>");
+ html("<table class='list'>\n");
}
html("<tr class='nohover'>");
diff --git a/source/ui-refs.c b/source/ui-refs.c
index 8490417..624d1a0 100644
--- a/source/ui-refs.c
+++ b/source/ui-refs.c
@@ -186,7 +186,7 @@ static void print_refs_link(const char *path)
{
html("<tr class='nohover'><td colspan='5'>");
cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path);
- html("</td></tr>");
+ html("</td></tr>\n");
}
static void print_ref_pager(int ofs, int pagesize, int count, const char *path)
@@ -214,7 +214,7 @@ static void print_ref_pager(int ofs, int pagesize, int count, const char *path)
html("'>[next]</a>");
free(url);
}
- html("</td></tr>");
+ html("</td></tr>\n");
}
static struct ref_page page_bounds(int pagesize, int count)
@@ -334,7 +334,7 @@ void cgit_print_tags(int maxcount)
void cgit_print_refs(void)
{
cgit_print_layout_start();
- html("<table class='list'>");
+ html("<table class='list'>\n");
if (ctx.qry.path && starts_with(ctx.qry.path, "heads"))
print_branches_page(ctx.cfg.max_ref_count);
@@ -342,9 +342,9 @@ void cgit_print_refs(void)
print_tags_page(ctx.cfg.max_ref_count);
else {
cgit_print_branches(ctx.cfg.max_ref_count);
- html("<tr class='nohover'><td colspan='5'>&nbsp;</td></tr>");
+ html("<tr class='nohover'><td colspan='5'>&nbsp;</td></tr>\n");
cgit_print_tags(ctx.cfg.max_ref_count);
}
- html("</table>");
+ html("</table>\n");
cgit_print_layout_end();
}
diff --git a/source/ui-repolist.c b/source/ui-repolist.c
index a8b401f..c81d822 100644
--- a/source/ui-repolist.c
+++ b/source/ui-repolist.c
@@ -217,7 +217,7 @@ static void print_section_row(const char *section, int columns)
htmlf("<tr class='nohover-highlight'><td colspan='%d' class='reposection'>",
columns);
html_txt(section);
- html("</td></tr>");
+ html("</td></tr>\n");
}
static void print_repo_row(const char *currenturl, int sublevel)
@@ -269,7 +269,7 @@ static void print_pager(int total, int pagelen, char *search, char *sort)
int i, ofs;
char *class = NULL;
- html("<ul class='pager'>");
+ html("<ul class='pager'>\n");
for (i = 0, ofs = 0; ofs < total; i++, ofs = i * pagelen) {
class = (ctx.qry.ofs == ofs) ? "current" : NULL;
html("<li>");
@@ -277,7 +277,7 @@ static void print_pager(int total, int pagelen, char *search, char *sort)
class, search, sort, ofs, 0);
html("</li>");
}
- html("</ul>");
+ html("</ul>\n");
}
static int cmp_str(const char *s1, const char *s2)
@@ -424,7 +424,7 @@ void cgit_print_repolist(void)
sort_repolist("section");
currenturl = cgit_currenturl();
- html("<table class='list repolist'>");
+ html("<table class='list repolist'>\n");
for (i = 0; i < cgit_repolist.count; i++) {
char *section;
@@ -452,7 +452,7 @@ void cgit_print_repolist(void)
}
print_repo_row(currenturl, !column_sorted && section);
}
- html("</table>");
+ html("</table>\n");
if (hits > ctx.cfg.max_repo_count)
print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search, ctx.qry.sort);
free(currenturl);
diff --git a/source/ui-shared.c b/source/ui-shared.c
index 1f45520..12df3b2 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -302,7 +302,7 @@ static void print_abs_date(time_t t, int tz)
html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601)));
html("'>");
html_txt(show_date(t, tz, configured_date_mode()));
- html("</span>");
+ html("</time>");
}
static void print_rel_date(time_t t, int tz, double count, const char *class,
@@ -349,7 +349,7 @@ static int emit_css_link(struct string_list_item *item, void *fallback)
html_attr(item->string);
else
html_attr((const char *)fallback);
- html("'/>\n");
+ html("'>\n");
return 0;
}
@@ -651,10 +651,10 @@ static void self_link(const char *name, const char *title, const char *class)
cgit_stats_link(name, title, class, ctx.qry.head,
ctx.qry.path);
else {
+ // A page name this switch does not know still gets a plain
+ // repolink, which covers any simple page added later.
repolink(title, class, ctx.qry.page, ctx.qry.head, ctx.qry.path);
- html("><!-- cgit_self_link() doesn't know how to make link for page '");
- html_txt(ctx.qry.page);
- html("' -->");
+ html("'>");
html_txt(name);
html("</a>");
}
@@ -1216,7 +1216,7 @@ void cgit_print_docend(void)
{
html("</main>\n");
if (ctx.cfg.embedded) {
- html("</div> <!-- id=cgit -->\n");
+ html("</div>\n");
if (ctx.cfg.footer)
html_include(ctx.cfg.footer);
return;
@@ -1229,7 +1229,7 @@ void cgit_print_docend(void)
html_txt(show_date(time(NULL), 0, cgit_date_mode(DATE_ISO8601)));
html("</footer>\n");
}
- html("</div> <!-- id=cgit -->\n");
+ html("</div>\n");
html("</body>\n</html>\n");
}
@@ -1306,7 +1306,7 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search,
void cgit_print_pageheader(void)
{
- html("<div id='cgit'>");
+ html("<div id='cgit'>\n");
if (!ctx.env.authenticated || !ctx.cfg.noheader)
print_header();
@@ -1340,7 +1340,7 @@ void cgit_print_pageheader(void)
ctx.qry.follow = !ctx.qry.follow;
html(")");
}
- html("</nav>");
+ html("</nav>\n");
}
html("<main class='content'>\n");
}
diff --git a/source/ui-ssdiff.c b/source/ui-ssdiff.c
index 7f3d194..8651ce7 100644
--- a/source/ui-ssdiff.c
+++ b/source/ui-ssdiff.c
@@ -240,7 +240,7 @@ static void print_row(const char *class,
html_txt(new_line);
}
- html("</td></tr>");
+ html("</td></tr>\n");
free(lcs);
free(new_line);
free(old_line);
@@ -414,11 +414,11 @@ void cgit_ssdiff_line_cb(char *line, int len)
} else if (line[0] == '@') {
html("<tr><td colspan='4' class='hunk'>");
html_txt(line);
- html("</td></tr>");
+ html("</td></tr>\n");
} else {
html("<tr><td colspan='4' class='ctx'>");
html_txt(line);
- html("</td></tr>");
+ html("</td></tr>\n");
}
line[len - 1] = terminator;
}
@@ -433,12 +433,12 @@ void cgit_ssdiff_header_begin(void)
void cgit_ssdiff_header_end(void)
{
- html("</td></tr>");
+ html("</td></tr>\n");
}
void cgit_ssdiff_footer(void)
{
if (deferred_old || deferred_new)
print_deferred_lines();
- html("<tr><td class='foot' colspan='4'></td></tr>");
+ html("<tr><td class='foot' colspan='4'></td></tr>\n");
}
diff --git a/source/ui-stats.c b/source/ui-stats.c
index 89bb05f..f1a4d65 100644
--- a/source/ui-stats.c
+++ b/source/ui-stats.c
@@ -354,7 +354,7 @@ static void print_summary_row(struct string_list *authors, size_t from,
htmlf("<td class='%s'>%ld</td>", centerclass, subtotal);
total += subtotal;
}
- htmlf("<td class='%s'>%ld</td></tr>", rightclass, total);
+ htmlf("<td class='%s'>%ld</td></tr>\n", rightclass, total);
}
static void print_authors(struct string_list *authors, int max_rows,
@@ -365,7 +365,7 @@ static void print_authors(struct string_list *authors, int max_rows,
size_t i, column, rows;
long total;
- html("<table class='stats'><tr><th>Author</th>");
+ html("<table class='stats'>\n<tr><th>Author</th>");
for (column = 0; column < labels->nr; column++)
htmlf("<th>%s</th>", labels->items[column].string);
html("<th>Total</th></tr>\n");
@@ -392,7 +392,7 @@ static void print_authors(struct string_list *authors, int max_rows,
total += (uintptr_t)bucket->util;
}
}
- htmlf("<td class='sum'>%ld</td></tr>", total);
+ htmlf("<td class='sum'>%ld</td></tr>\n", total);
}
if (rows < authors->nr)
@@ -401,7 +401,7 @@ static void print_authors(struct string_list *authors, int max_rows,
print_summary_row(authors, 0, authors->nr, "Total",
"total", "sum", "sum", labels);
- html("</table>");
+ html("</table>\n");
}
static const char *language_of(const char *pathname)
@@ -512,8 +512,8 @@ static void print_languages(const struct lang_sizes *sizes)
other += (uintptr_t)sizes->langs.items[i].util;
}
- html("<h2>Languages</h2>");
- html("<table class='stats'>");
+ html("<h2>Languages</h2>\n");
+ html("<table class='stats'>\n");
html("<tr><th>Language</th><th>Size</th><th>Share</th></tr>\n");
shown = 0;
for (i = 0; i < sizes->langs.nr && shown < MAX_LANGUAGE_ROWS; i++) {
@@ -526,7 +526,7 @@ static void print_languages(const struct lang_sizes *sizes)
}
if (other)
print_language_row("Other", other, sizes->total);
- html("</table>");
+ html("</table>\n");
}
static void print_options_form(const struct cgit_period *period, int top)
@@ -547,7 +547,7 @@ static void print_options_form(const struct cgit_period *period, int top)
html_option(cgit_fmt("%c", periods[i].code),
periods[i].name,
cgit_fmt("%c", period->code));
- html("</select></td></tr>");
+ html("</select></td></tr>\n");
}
html("<tr><td class='label'>Authors:</td>");
html("<td class='ctrl'><select name='ofs' data-autosubmit='1'>");
@@ -638,7 +638,7 @@ void cgit_show_stats(void)
html_txt(ctx.qry.path);
html("')");
}
- html("</h2>");
+ html("</h2>\n");
labels = build_period_labels(period);
print_authors(&authors, top, &labels);
diff --git a/source/ui-summary.c b/source/ui-summary.c
index e4069c6..2310e5c 100644
--- a/source/ui-summary.c
+++ b/source/ui-summary.c
@@ -44,7 +44,7 @@ static void print_clone_url(const char *url)
// cgit_add_clone_urls may call back no times at all, so the heading
// waits for a first url rather than being printed ahead of the walk.
if (clone_urls_printed++ == 0) {
- htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
+ htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>\n", columns);
htmlf("<tr class='nohover'><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
}
@@ -128,7 +128,7 @@ void cgit_print_summary(void)
}
clone_urls_printed = 0;
cgit_add_clone_urls(print_clone_url);
- html("</table>");
+ html("</table>\n");
cgit_print_layout_end();
}