Skip to contentSkip to conversation

docparse: Make tags in table clickable

PATCH New Petr Vorel 2 participants 3 messages May 3, 2021 – May 4, 2021

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 docparse: Make tags in table clickable

linked to the section.

---
Hi,

minor but useful improvement.

 docparse/testinfo.pl | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
docparse/testinfo.pl +9 -3
index ccce67be4..76ca7a66c 100755
@@ -125,7 +125,12 @@ sub paragraph
 
 sub reference
 {
-	return "xref:$_[0]\[$_[0]\]" . (defined($_[1]) ? $_[1] : "") . "\n";
+	my ($link, %args) = @_;
+
+	$args{text} //= $link;
+	$args{delimiter} //= "";
+
+	return "xref:$link\[$args{text}\]$args{delimiter}\n";
 }
 
 sub table
@@ -179,7 +184,7 @@ sub get_test_names
 			$content .= "\n";
 		}
 
-		$content .= reference($name, " ");
+		$content .= reference($name, delimiter => " ");
 		$prev_letter = $letter;
 	}
 	$content .= "\n";
@@ -242,6 +247,7 @@ sub content_filters
 	for my $k (sort keys %$data) {
 		my $tag = tag2title($k);
 		my ($letter, $prev_letter);
+		$content .= label($k);
 		$content .= h2($tag);
 		$content .= paragraph("Tests containing $tag flag.");
 		$content .= get_test_names(\@{$h{$k}});
@@ -357,7 +363,7 @@ sub content_all_tests
 				$content .= table . "|Key|Value\n\n"
 			}
 
-			$content .= "|" . tag2title($k) . "\n|";
+			$content .= "|" . reference($k, text => tag2title($k)) . "\n|";
 
 			if (ref($v) eq 'ARRAY') {
 				# two dimensional array
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/1 docparse: Make tags in table clickable

Hi!

Quoted 1 line

linked to the section.

Looks good, acked.

Btw, when I was looking at the page today I noticed that in the tags table the tag points to the git/CVE page and not the actuall hash or ID. I would expect that linux-git would be normal text and the commit id would link to the kernel.org repo, and same for the CVE...

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#2 lore raw

PATCH 1/1 docparse: Make tags in table clickable

Hi Cyril,

Quoted 10 lines

Hi!

Quoted 1 line

linked to the section.

Looks good, acked.

Btw, when I was looking at the page today I noticed that in the tags table the tag points to the git/CVE page and not the actuall hash or ID. I would expect that linux-git would be normal text and the commit id would link to the kernel.org repo, and same for the CVE...

Well, no problem, but I'd prefer for commits to move the hash to the text, e.g.

from:
|linux-git-fbe0e839d1e2 | futex: Prevent overflow by strengthen input validation| to:
|linux-git | fbe0e839d1e2 ("futex: Prevent overflow by strengthen input validation")|

I'll send v2 where I'll implement it and as a second commit I'll change "CVE" and "linux-git" (and others) pointing to tags metadata.html#tags.

And as TODO I should divide .tags into subsections containing list of actual tag values (e.g. list of CVE, linux-git (and others)) and point these links to these sections.

Thanks for your time!

Kind regards,
Petr