summaryrefslogtreecommitdiff
path: root/Documentation/sphinx
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-07 12:27:54 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-07 12:36:46 +0300
commit6fe79d1edea4861d7453915e596cc39a83ddc683 (patch)
tree826eb5848c2d03696941e9ebed5f63e935cb33a0 /Documentation/sphinx
parent1ae6439538082f2be3e82364ffd85a05271cb832 (diff)
downloadlinux-6fe79d1edea4861d7453915e596cc39a83ddc683.tar.xz
doc-rst: parse-headers: improve delimiters to detect symbols
As we had to escape the symbols for the ReST markup to not do the wrong thing, the logic to discover start/end of strings are not trivial. Improve the end delimiter detection, in order to highlight more occurrences of the strings. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'Documentation/sphinx')
-rwxr-xr-xDocumentation/sphinx/parse-headers.pl27
1 files changed, 14 insertions, 13 deletions
diff --git a/Documentation/sphinx/parse-headers.pl b/Documentation/sphinx/parse-headers.pl
index 287f6459e13a..ec9537ef586f 100755
--- a/Documentation/sphinx/parse-headers.pl
+++ b/Documentation/sphinx/parse-headers.pl
@@ -200,78 +200,79 @@ $data =~ s,([\_\`\*\<\>\&\\\\:\/]),\\$1,g;
# Add references
#
-my $separators = "[\n \t\,\)\=\:\{\}\;]";
+my $start_delim = "[ \n\t\(\=\*\@]";
+my $end_delim = "(\\s|,|\\\\=|\\\\:|\\;|\\\)|\\}|\\{)";
foreach my $r (keys %ioctls) {
my $n = $ioctls{$r};
- my $s = ":ref:`$r <$n>`";
+ my $s = "\\ :ref:`$r <$n>`\\ ";
$r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g;
print "$r -> $s\n" if ($debug);
- $data =~ s/([\s])($r)($separators)/$1$s$3/g;
+ $data =~ s/($start_delim)($r)$end_delim/$1$s$3/g;
}
foreach my $r (keys %defines) {
my $n = $defines{$r};
- my $s = ":ref:`$r <$n>`";
+ my $s = "\\ :ref:`$r <$n>`\\ ";
$r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g;
print "$r -> $s\n" if ($debug);
- $data =~ s/([\s])($r)($separators)/$1$s$3/g;
+ $data =~ s/($start_delim)($r)$end_delim/$1$s$3/g;
}
foreach my $r (keys %enum_symbols) {
my $n = $enum_symbols{$r};
- my $s = ":ref:`$r <$n>`";
+ my $s = "\\ :ref:`$r <$n>`\\ ";
$r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g;
print "$r -> $s\n" if ($debug);
- $data =~ s/([\s])($r)($separators)/$1$s$3/g;
+ $data =~ s/($start_delim)($r)$end_delim/$1$s$3/g;
}
foreach my $r (keys %enums) {
my $n = $enums{$r};
- my $s = ":ref:`enum $r <$n>`";
+ my $s = "\\ :ref:`enum $r <$n>`\\ ";
$r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g;
print "$r -> $s\n" if ($debug);
- $data =~ s/enum\s+($r)($separators)/$s$2/g;
+ $data =~ s/enum\s+($r)$end_delim/$s$2/g;
}
foreach my $r (keys %structs) {
my $n = $structs{$r};
- my $s = ":ref:`struct $r <$n>`";
+ my $s = "\\ :ref:`struct $r <$n>`\\ ";
$r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g;
print "$r -> $s\n" if ($debug);
- $data =~ s/struct\s+($r)($separators)/$s$2/g;
+ $data =~ s/struct\s+($r)$end_delim/$s$2/g;
}
foreach my $r (keys %typedefs) {
my $n = $typedefs{$r};
- my $s = ":ref:`$r <$n>`";
+ my $s = "\\ :ref:`$r <$n>`\\ ";
$r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g;
print "$r -> $s\n" if ($debug);
- $data =~ s/([\s\(\,\=])($r)($separators)/$1$s$3/g;
+ $data =~ s/($start_delim)($r)$end_delim/$1$s$3/g;
}
#