Em Thu, 28 Sep 2017 18:28:32 +0200 Markus Heiser <markus.heiser@xxxxxxxxxxx> escreveu: > Hi Mauro, > > > Am 27.09.2017 um 23:10 schrieb Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxxx>: > > > I also untabified the example since tabs in reST are > a nightmare, especially in code blocks ... tabulators are the source > of all evil [1] ... > > Please, never use tabs in markups or programming languages > where indentation is a part of the markup respectively the > language!! Tabs will exist at the sources, as Kernel coding style recommends its usage. There's nothing that can be done to avoid. So, whatever scripts we use, it should handle it. Thankfully, solving this issue is a one line perl patch, as explained at: http://perldoc.perl.org/perlfaq4.html#How-do-I-expand-tabs-in-a-string? Something like the enclosed (untested) patch. Thanks, Mauro [PATCH] 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: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxxx> diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 69757ee9db4c..7bc139184177 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1544,7 +1544,7 @@ sub tracepoint_munge($) { sub syscall_munge() { 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/) { $void = 1; @@ -1743,6 +1743,8 @@ sub process_file($) { while (s/\\\s*$//) { $_ .= <IN>; } + # Replace tabs by spaces + while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; if ($state == STATE_NORMAL) { if (/$doc_start/o) { $state = STATE_NAME; # next line is always the function name @@ -1842,8 +1844,7 @@ sub process_file($) { $in_purpose = 0; $contents = $newcontents; $new_start_line = $.; - while ((substr($contents, 0, 1) eq " ") || - substr($contents, 0, 1) eq "\t") { + while (substr($contents, 0, 1) eq " ") { $contents = substr($contents, 1); } if ($contents ne "") { @@ -1912,8 +1913,7 @@ sub process_file($) { $contents = $2; $new_start_line = $.; if ($contents ne "") { - while ((substr($contents, 0, 1) eq " ") || - substr($contents, 0, 1) eq "\t") { + while (substr($contents, 0, 1) eq " ") { $contents = substr($contents, 1); } $contents .= "\n"; -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html