Commit 7c9aa015 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet

scripts: kernel-doc: replace tabs by spaces

Sphinx has a hard time dealing with tabs, causing it to
misinterpret paragraph continuation.

As we're now mainly focused on supporting ReST output,
replace tabs by spaces, in order to avoid troubles when
the output is parsed by Sphinx.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent bdfe2be3
...@@ -1579,7 +1579,7 @@ sub tracepoint_munge($) { ...@@ -1579,7 +1579,7 @@ sub tracepoint_munge($) {
sub syscall_munge() { sub syscall_munge() {
my $void = 0; my $void = 0;
$prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs $prototype =~ s@[\r\n]+@ @gos; # strip newlines/CR's
## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
if ($prototype =~ m/SYSCALL_DEFINE0/) { if ($prototype =~ m/SYSCALL_DEFINE0/) {
$void = 1; $void = 1;
...@@ -1778,6 +1778,8 @@ sub process_file($) { ...@@ -1778,6 +1778,8 @@ sub process_file($) {
while (s/\\\s*$//) { while (s/\\\s*$//) {
$_ .= <IN>; $_ .= <IN>;
} }
# Replace tabs by spaces
while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
if ($state == STATE_NORMAL) { if ($state == STATE_NORMAL) {
if (/$doc_start/o) { if (/$doc_start/o) {
$state = STATE_NAME; # next line is always the function name $state = STATE_NAME; # next line is always the function name
...@@ -1877,8 +1879,7 @@ sub process_file($) { ...@@ -1877,8 +1879,7 @@ sub process_file($) {
$in_purpose = 0; $in_purpose = 0;
$contents = $newcontents; $contents = $newcontents;
$new_start_line = $.; $new_start_line = $.;
while ((substr($contents, 0, 1) eq " ") || while (substr($contents, 0, 1) eq " ") {
substr($contents, 0, 1) eq "\t") {
$contents = substr($contents, 1); $contents = substr($contents, 1);
} }
if ($contents ne "") { if ($contents ne "") {
...@@ -1947,8 +1948,7 @@ sub process_file($) { ...@@ -1947,8 +1948,7 @@ sub process_file($) {
$contents = $2; $contents = $2;
$new_start_line = $.; $new_start_line = $.;
if ($contents ne "") { if ($contents ne "") {
while ((substr($contents, 0, 1) eq " ") || while (substr($contents, 0, 1) eq " ") {
substr($contents, 0, 1) eq "\t") {
$contents = substr($contents, 1); $contents = substr($contents, 1);
} }
$contents .= "\n"; $contents .= "\n";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment