From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-kernel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>
Subject: [PATCH RFC 1/6] get_abi.pl: fix parsing on ReST mode
Date: Fri, 21 Jun 2019 09:32:01 -0300 [thread overview]
Message-ID: <25e3e20ef1a300ce2bb6f87dfbdc12dbdd7ffcb0.1561118631.git.mchehab+samsung@kernel.org> (raw)
In-Reply-To: <cover.1561118631.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 e2cd2234af34..03f3c57af7ab 100755
--- a/scripts/get_abi.pl
+++ b/scripts/get_abi.pl
@@ -159,7 +159,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;
}
@@ -174,31 +175,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-21 12:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 12:32 [PATCH RFC 0/6] Produce ABI guide without escaping ReST source files Mauro Carvalho Chehab
2019-06-21 12:32 ` Mauro Carvalho Chehab [this message]
2019-06-21 12:32 ` [PATCH RFC 2/6] ABI: sysfs-driver-mlxreg-io: fix the what fields Mauro Carvalho Chehab
2019-06-21 12:32 ` [PATCH RFC 3/6] ABI: README: specify that files should be ReST compatible Mauro Carvalho Chehab
2019-06-21 12:32 ` [PATCH RFC 4/6] ABI: stable: make files " Mauro Carvalho Chehab
2019-06-21 12:32 ` [PATCH RFC 5/6] docs: ABI: make it parse ABI/stable as ReST-compatible files Mauro Carvalho Chehab
2019-06-21 12:32 ` [PATCH RFC 6/6] docs: abi: create a 2-depth index for ABI Mauro Carvalho Chehab
2019-06-21 12:39 ` [PATCH RFC 0/6] Produce ABI guide without escaping ReST source files Mauro Carvalho Chehab
2019-06-21 13:04 ` Mauro Carvalho Chehab
2019-06-21 15:37 ` 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=25e3e20ef1a300ce2bb6f87dfbdc12dbdd7ffcb0.1561118631.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®