Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp257308pxx; Thu, 29 Oct 2020 01:41:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQgBBJaFPa/Kw9BShb5m8X1qUDk9VZa6boNQGUsIYQm7DdOIYWY8EYeQl0+7KNilUrb/br X-Received: by 2002:a17:906:3a97:: with SMTP id y23mr2997379ejd.250.1603960899739; Thu, 29 Oct 2020 01:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603960899; cv=none; d=google.com; s=arc-20160816; b=O37NR2lZtQIFmcrvH36G/fBQcI68Ihozcpj01Eb1JdVYFiEMF/fiRPK2z6K+3B3nGH j7H/OSASKLsYWLd6sLlmB2OxiPcy4xxaz4FUP9+VzOzVLMB0Ggig+8DK3r2b78bDzpzZ NcipcMMk6Mo69wvMUIyddyrjzlCREwxPoWTjWG3r4cPtLLyizo+rp22c6RtUuav2gA71 938b7euncJ8GU2gcM6rz1cMh0dYW+NF8KQ6AVQmTmilAQyB3z5J8Rb++JiQd3mS9hDFo vUz98xl0VxDd+S+a9dObN7cpa7r8whcqE6NDT8pN2tVbHL8GGlLH/khcmsBrh86F+r0j r6zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UEurMytx31zkJMuh4PN2PH/8N5y7MgjVV/1GZLN32Mk=; b=EjmbItr8zyzlZZbndDAc34Y0sHIWmATBWX4RY4y+qQHKstEX3ibjJpEsMDKalezkop ihZb2gcQCObw/7qOml4ahEBzSBUWNOAOvEJbW53ynvt5a1PhJKyjGX3y7RsJwvobB3XM q4kp2jXIJO5q+Nf7DEtK8XABWPVzC3JAmBz7p5CY0ZmO7cLgMJi0EJXg2pNrpGCVq/9O iNAyvr8QLlWOER0D8mS5eLUvyMpKdGNtjQp34RN2uIn3OWUbNDBhgYVByR9JnHlyBzBx vOojwIOC1IDnfY4BdctnCnmi/NikzQzEwYZAG33zzdlAQ38mstmJy6wSRSRYfua+rcsv SsOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JswyOE4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m6si1289835ejc.527.2020.10.29.01.41.18; Thu, 29 Oct 2020 01:41:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JswyOE4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727778AbgJ2A4Z (ORCPT + 99 others); Wed, 28 Oct 2020 20:56:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:60534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731623AbgJ1WRg (ORCPT ); Wed, 28 Oct 2020 18:17:36 -0400 Received: from mail.kernel.org (ip5f5ad5b2.dynamic.kabel-deutschland.de [95.90.213.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 780782473F; Wed, 28 Oct 2020 14:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603895014; bh=jzHm1QtzfpxDKadw+V1YfSIgkojRb8DPJUFpqgleivE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JswyOE4gDRTKpLISSXBMqRcrR6tNy8K+XUIamY0q15Ain5PW5AP9nle2v34paXMq1 s15zjiyAfatC7wvSBDrNEbPup6jHzwZVsVjE4cmFiM+ZCDeXlKfJrrysSXBnJj4lZ9 DMZWkMFhbPGBID+ikESfk3Sp57sA6O0/ZSwrihcA= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kXmMO-003hkp-3q; Wed, 28 Oct 2020 15:23:32 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , "Jonathan Corbet" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH 02/33] scripts: get_abi.pl: fix parsing on ReST mode Date: Wed, 28 Oct 2020 15:23:00 +0100 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mauro Carvalho Chehab 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 Signed-off-by: Mauro Carvalho Chehab --- 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.26.2