List for cgit developers and users
 help / color / mirror / Atom feed
From: aklhfex at gmail.com (Chris Mayo)
Subject: [PATCH] ui-ssdiff: resolve HTML5 validation errors
Date: Thu, 21 Feb 2019 19:56:05 +0000
Message-ID: <20190221195605.15813-1-aklhfex@gmail.com> (raw)

- Remove ids from anchor elements. They were unusable because they were
  duplicated between files and versions of files.
- Always close span, with html().
- Fix missing / on closing tr element in cgit_ssdiff_header_end().

Signed-off-by: Chris Mayo <aklhfex at gmail.com>
---
 ui-ssdiff.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index c456033..b6dc5b0 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -207,11 +207,13 @@ static void print_part_with_lcs(char *class, char *line, char *lcs)
 			}
 		} else if (line[i] == lcs[j]) {
 			same = 1;
-			htmlf("</span>");
+			html("</span>");
 			j += 1;
 		}
 		html_txt(c);
 	}
+	if (!same)
+		html("</span>");
 }
 
 static void print_ssdiff_line(char *class,
@@ -236,7 +238,7 @@ static void print_ssdiff_line(char *class,
 		char *fileurl = cgit_fileurl(ctx.repo->url, "tree", old_file->path, id_str);
 		html("<td class='lineno'><a href='");
 		html(fileurl);
-		htmlf("' id='%s'>%s</a>", lineno_str, lineno_str + 1);
+		htmlf("'>%s</a>", lineno_str + 1);
 		html("</td>");
 		htmlf("<td class='%s'>", class);
 		free(fileurl);
@@ -259,7 +261,7 @@ static void print_ssdiff_line(char *class,
 		char *fileurl = cgit_fileurl(ctx.repo->url, "tree", new_file->path, id_str);
 		html("<td class='lineno'><a href='");
 		html(fileurl);
-		htmlf("' id='%s'>%s</a>", lineno_str, lineno_str + 1);
+		htmlf("'>%s</a>", lineno_str + 1);
 		html("</td>");
 		htmlf("<td class='%s'>", class);
 		free(fileurl);
@@ -405,7 +407,7 @@ void cgit_ssdiff_header_begin(void)
 
 void cgit_ssdiff_header_end(void)
 {
-	html("</td><tr>");
+	html("</td></tr>");
 }
 
 void cgit_ssdiff_footer(void)
-- 
2.20.1



             reply	other threads:[~2019-02-21 19:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 19:56 aklhfex [this message]
2019-02-22 23:08 ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190221195605.15813-1-aklhfex@gmail.com \
    --to= \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

List for cgit developers and users

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/cgit

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 cgit cgit/ http://inbox.vuxu.org/cgit \
		cgit@lists.zx2c4.com
	public-inbox-index cgit

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.cgit


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git