From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C0A4C55179 for ; Wed, 28 Oct 2020 22:22:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AAD1206D9 for ; Wed, 28 Oct 2020 22:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603923752; bh=GiCl/xUCfPVPDTVlB/3S4Hm7u8cSqBu7i7gChQK+gmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fuvx/jQWPknYqRNrjxr2d/EYJfv5Mb20BlS+l/ZZV6k+mibR+KZC7ysdjWGClJd5O 4ue4tyMR16P2VTjI80iWxF/QoKWj+c/Up07/As0/0RRVvy2+v2x7RVrk74VPPF3c+e 0Te1Ku3DxewtzrN1srNVu0djZWA4sIVAmkg362o8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732671AbgJ1WW1 (ORCPT ); Wed, 28 Oct 2020 18:22:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:36812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732652AbgJ1WWX (ORCPT ); Wed, 28 Oct 2020 18:22:23 -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 7EF6524765; 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=GiCl/xUCfPVPDTVlB/3S4Hm7u8cSqBu7i7gChQK+gmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1w/aQy1ZX0+KiUDleMPOtKxirCT00oiaifrnMHx1xcEUzZR8ZSuK7UG83FxEClzBi N1YGuRfBB+S6QmcXnSDSNC+6/MO39HSx70DdIYJ/EOMSfsR8UKX347YDUMN0aHjFZy obzyH6xB8XcW6rI6ZIhwqU2B66fwOQJfrTJzAOqY= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kXmMO-003hl9-Fh; 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" , linux-kernel@vger.kernel.org Subject: [PATCH 10/33] scripts: get_abi.pl: auto-generate cross references Date: Wed, 28 Oct 2020 15:23:08 +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 There are several cross-references that can be automatically generated: - References to .rst files inside Documentation/ - References to other ABI files; - References to ABI symbols at /sys/*. Add a logic to automatically parse them and convert into cross references. Signed-off-by: Mauro Carvalho Chehab --- scripts/get_abi.pl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index b4868ee8e955..3cff7cdf1397 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -3,6 +3,7 @@ use strict; use warnings; +use utf8; use Pod::Usage; use Getopt::Long; use File::Find; @@ -272,6 +273,9 @@ sub create_labels { # Outputs the book on ReST format # +# \b doesn't work well with paths. So, we need to define something else +my $bondary = qr { (?"; + $desc =~ s,\bDocumentation/ABI/$f\b,:ref:`$xref`,g; + } + + @matches = $desc =~ m,$bondary(/sys/[^\s\.\,\;\:\*\s\`\'\(\)]+)$bondary,; + + foreach my $s (@matches) { + if (defined($data{$s}) && defined($data{$s}->{label})) { + my $xref = $s; + + $xref =~ s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g; + $xref = ":ref:`$xref <" . $data{$s}->{label} . ">`"; + + $desc =~ s,$bondary$s$bondary,$xref,g; + } + } + print "$desc\n\n"; } else { $desc =~ s/^\s+//; -- 2.26.2