summaryrefslogtreecommitdiff
path: root/scripts/get_abi.pl
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-03-25 13:38:22 +0300
committerJonathan Corbet <corbet@lwn.net>2021-03-31 22:53:15 +0300
commitb0f9580a88803472d7c05d89365902a64f076df4 (patch)
tree3603e7647b9c398b6ee4f6ba3571d4931a26f1e2 /scripts/get_abi.pl
parent2bb5baf9d22764fff6baca4c3ad93055848bbf03 (diff)
downloadlinux-b0f9580a88803472d7c05d89365902a64f076df4.tar.xz
scripts: get_abi.pl: better handle escape chars on what:
The parser for the symbols defined on What: doesn't cover all chars that need to be scaped, like '{' and '}'. Change the logic to be more generic, and ensure that the same regex will be used on both What: and when parsing the cross-references. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/29cb56def89b508fe605bcd2ba74a4376cc08e35.1616668017.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/get_abi.pl')
-rwxr-xr-xscripts/get_abi.pl5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl
index 92d9aa6cc4f5..a9348b9bdaa4 100755
--- a/scripts/get_abi.pl
+++ b/scripts/get_abi.pl
@@ -283,6 +283,7 @@ sub create_labels {
# \b doesn't work well with paths. So, we need to define something else
my $bondary = qr { (?<![\w\/\`\{])(?=[\w\/\`\{])|(?<=[\w\/\`\{])(?![\w\/\`\{]) }x;
+my $symbols = qr { ([\x01-\x08\x0e-\x1f\x21-\x2f\x3a-\x40\x7b-\xff]) }x;
sub output_rest {
create_labels();
@@ -305,7 +306,6 @@ sub output_rest {
}
my $w = $what;
- $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g;
if ($type ne "File") {
my $cur_part = $what;
@@ -329,6 +329,7 @@ sub output_rest {
my $len = 0;
foreach my $name (@names) {
+ $name =~ s/$symbols/\\$1/g;
$name = "**$name**";
$len = length($name) if (length($name) > $len);
}
@@ -395,7 +396,7 @@ sub output_rest {
if (defined($data{$s}) && defined($data{$s}->{label})) {
my $xref = $s;
- $xref =~ s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g;
+ $xref =~ s/$symbols/\\$1/g;
$xref = ":ref:`$xref <" . $data{$s}->{label} . ">`";
$desc =~ s,$bondary$s$bondary,$xref,g;