about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--html.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/html.c b/html.c
index 77438a0..34ffb16 100644
--- a/html.c
+++ b/html.c
@@ -228,12 +228,12 @@ static void swap(char *a, char *b) {
 
 static int htmlMarkupURLs(FILE *file, char *buf) {
 	static regex_t regex;
-	compile(&regex, "(^|[[:space:]<])(https?:[^[:space:]>]+)(.|$)");
+	compile(&regex, "(^|[[:space:]<])(https?:[^[:space:]>]+)");
 
 	int error;
 	char *ptr;
-	regmatch_t match[4];
-	for (ptr = buf; !regexec(&regex, ptr, 4, match, 0); ptr += match[2].rm_eo) {
+	regmatch_t match[3];
+	for (ptr = buf; !regexec(&regex, ptr, 3, match, 0); ptr += match[2].rm_eo) {
 		char nul = '\0';
 
 		swap(&ptr[match[2].rm_so], &nul);
@@ -242,14 +242,14 @@ static int htmlMarkupURLs(FILE *file, char *buf) {
 		swap(&ptr[match[2].rm_so], &nul);
 
 		const char *template = Q(<a href="[url]">[url]</a>);
-		swap(&ptr[match[3].rm_so], &nul);
+		swap(&ptr[match[2].rm_eo], &nul);
 		struct Variable vars[] = {
 			{ "url", &ptr[match[2].rm_so] },
 			{0},
 		};
 		error = templateRender(file, template, vars, escapeXML);
 		if (error) return error;
-		swap(&ptr[match[3].rm_so], &nul);
+		swap(&ptr[match[2].rm_eo], &nul);
 	}
 	return escapeXML(file, ptr);
 }
d> 2019-12-23Rename music.md to music.txtJune McEnroe 2019-12-23Add DO YOU DOUBT ME TRAITORJune McEnroe 2019-12-22Add license header to cgit CSSJune McEnroe 2019-12-22Add The Book of EttaJune McEnroe 2019-12-21Revert "Add first working version of imbox"June McEnroe 2019-12-21Add first working version of imboxJune McEnroe 2019-12-20Respect mailmap in gl pretty formatJune McEnroe 2019-12-20Set LANG in cgit filtersJune McEnroe 2019-12-20Source .editrc before applying -v or -eJune McEnroe 2019-12-20Disable signing commitsJune McEnroe 2019-12-19Ignore about-filterJune McEnroe 2019-12-19Fix matching make tags with no sourcesJune McEnroe 2019-12-19Avoid matching := assignments as tagsJune McEnroe 2019-12-18Hide line numbers when rendering mdocJune McEnroe 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe 2019-12-16Post "cgit setup"June McEnroe