From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>,
gregkh@linuxfoundation.org, Jonathan Corbet <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 02/12] scripts/get_abi.pl: fix parsing on ReST mode
Date: Sat, 22 Jun 2019 13:58:43 -0300 [thread overview]
Message-ID: <73fb0849e7832dfa010f790bfa2a3e47f0b0c57a.1561221403.git.mchehab+samsung@kernel.org> (raw)
In-Reply-To: <cover.1561221403.git.mchehab+samsung@kernel.org>
When the source ABI file is using ReST notation, the script
should handle whitespaces and lines with care, as otherwise
the file won't be properly recognized.
Address the bugs that are on such part of the script.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
scripts/get_abi.pl | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl
index 107672cdacb3..0c403af86fd5 100755
--- a/scripts/get_abi.pl
+++ b/scripts/get_abi.pl
@@ -151,7 +151,8 @@ sub parse_abi {
$content = $2;
}
while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
- $data{$what}->{$tag} .= $content;
+
+ $data{$what}->{$tag} .= "$content\n" if ($content);
} else {
$data{$what}->{$tag} = $content;
}
@@ -166,31 +167,28 @@ sub parse_abi {
}
if ($tag eq "description") {
+ my $content = $_;
+ while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
if (!$data{$what}->{description}) {
- s/^($space)//;
- if (m/^(\s*)(.*)/) {
- my $sp = $1;
- while ($sp =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
- my $content = "$sp$2";
-
- $content =~ s/^($space)//;
-
- $data{$what}->{$tag} .= "$content";
+ # Preserve initial spaces for the first line
+ if ($content =~ m/^(\s*)(.*)$/) {
+ $space = $1;
+ $content = $2;
}
+
+ $data{$what}->{$tag} .= "$content\n" if ($content);
} else {
- my $content = $_;
if (m/^\s*\n/) {
$data{$what}->{$tag} .= $content;
next;
}
- while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}
$space = "" if (!($content =~ s/^($space)//));
- # Compress spaces with tabs
- $content =~ s<^ {8}> <\t>;
- $content =~ s<^ {1,7}\t> <\t>;
- $content =~ s< {1,7}\t> <\t>;
+# # Compress spaces with tabs
+# $content =~ s<^ {8}> <\t>;
+# $content =~ s<^ {1,7}\t> <\t>;
+# $content =~ s< {1,7}\t> <\t>;
$data{$what}->{$tag} .= $content;
}
next;
--
2.21.0
next prev parent reply other threads:[~2019-06-22 16:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-22 16:58 [PATCH 00/12] Add the ABI documentation to the admin guide Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 01/12] scripts/get_abi.pl: change script to allow parsing in ReST mode Mauro Carvalho Chehab
2019-06-22 16:58 ` Mauro Carvalho Chehab [this message]
2019-06-22 16:58 ` [PATCH 03/12] scripts/get_abi.pl: Allow optionally record from where a line came from Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 04/12] docs: kernellog.py: add support for info() Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 05/12] docs: kernel_abi.py: add a script to parse ABI documentation Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 06/12] docs: kernel_abi.py: fix UTF-8 support Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 07/12] docs: kernel_abi.py: make it compatible with Sphinx 1.7+ Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 08/12] docs: kernel_abi.py: Update copyrights Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 09/12] docs: kernel_abi.py: add a SPDX header file Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 10/12] docs: kernel_abi.py: use --enable-lineno for get_abi.pl Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 11/12] docs: kernel_abi.py: Handle with a lazy Sphinx parser Mauro Carvalho Chehab
2019-06-22 16:58 ` [PATCH 12/12] docs: add ABI documentation to the admin-guide book Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=73fb0849e7832dfa010f790bfa2a3e47f0b0c57a.1561221403.git.mchehab+samsung@kernel.org \
--to=mchehab+samsung@kernel.org \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®