From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id D9ECA7D043 for ; Tue, 19 Jun 2018 08:09:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756378AbeFSIJz (ORCPT ); Tue, 19 Jun 2018 04:09:55 -0400 Received: from mga12.intel.com ([192.55.52.136]:63615 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756247AbeFSIJx (ORCPT ); Tue, 19 Jun 2018 04:09:53 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2018 01:09:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,242,1526367600"; d="scan'208";a="65329893" Received: from jnikula-mobl2.fi.intel.com (HELO localhost) ([10.237.66.53]) by fmsmga001.fm.intel.com with ESMTP; 19 Jun 2018 01:09:51 -0700 From: Jani Nikula To: Mike Rapoport Cc: Jonathan Corbet , Matthew Wilcox , linux-doc@vger.kernel.org Subject: Re: [PATCH 1/2] Documentation/sphinx: add "nodocs" directive In-Reply-To: <20180619075017.GB19099@rapoport-lnx> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <1529328996-16247-1-git-send-email-rppt@linux.vnet.ibm.com> <1529328996-16247-2-git-send-email-rppt@linux.vnet.ibm.com> <87h8lzyicj.fsf@intel.com> <20180619050349.GA19099@rapoport-lnx> <87602fxmi7.fsf@intel.com> <20180619075017.GB19099@rapoport-lnx> Date: Tue, 19 Jun 2018 11:09:42 +0300 Message-ID: <871sd3xkmx.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Tue, 19 Jun 2018, Mike Rapoport wrote: > On Tue, Jun 19, 2018 at 10:29:20AM +0300, Jani Nikula wrote: >> On Tue, 19 Jun 2018, Mike Rapoport wrote: >> > On Mon, Jun 18, 2018 at 11:01:32PM +0300, Jani Nikula wrote: >> >> On Mon, 18 Jun 2018, Mike Rapoport wrote: >> >> > When kernel-doc:: specified in .rst document without explicit directives, >> >> > it outputs both comment and DOC: sections. If a DOC: section was explictly >> >> > included in the same document it will be duplicated. For example, the >> >> > output generated for Documentation/core-api/idr.rst [1] has "IDA >> >> > description" in the "IDA usage" section and in the middle of the API >> >> > reference. >> >> > >> >> > Addition of "nodocs" directive prevents the duplication without the need to >> >> > explicitly define what functions should be include in the API reference. >> >> > >> >> > [1] https://www.kernel.org/doc/html/v4.17/core-api/idr.html >> >> > >> >> > Signed-off-by: Mike Rapoport >> >> > --- >> >> > Documentation/sphinx/kerneldoc.py | 3 +++ >> >> > 1 file changed, 3 insertions(+) >> >> > >> >> > diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py >> >> > index fbedcc3..bc5dd05 100644 >> >> > --- a/Documentation/sphinx/kerneldoc.py >> >> > +++ b/Documentation/sphinx/kerneldoc.py >> >> > @@ -50,6 +50,7 @@ class KernelDocDirective(Directive): >> >> > 'functions': directives.unchanged_required, >> >> > 'export': directives.unchanged, >> >> > 'internal': directives.unchanged, >> >> > + 'nodocs': directives.unchanged, >> >> >> >> I'm not convinved this is the prettiest way to achieve what you >> >> want. 'nodocs' seems kind of clunky. >> >> >> >> I'd suggest supporting 'functions' without option arguments, and turning >> >> that into kernel-doc -no-doc-sections. >> > >> > Do you mean something like this: >> >> Yes. >> >> > >> > diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py >> > index fbedcc3..9d0a7f0 100644 >> > --- a/Documentation/sphinx/kerneldoc.py >> > +++ b/Documentation/sphinx/kerneldoc.py >> > @@ -47,7 +47,7 @@ class KernelDocDirective(Directive): >> > optional_arguments = 4 >> > option_spec = { >> > 'doc': directives.unchanged_required, >> > - 'functions': directives.unchanged_required, >> > + 'functions': directives.unchanged, >> > 'export': directives.unchanged, >> > 'internal': directives.unchanged, >> > } >> > @@ -75,8 +75,12 @@ class KernelDocDirective(Directive): >> > elif 'doc' in self.options: >> > cmd += ['-function', str(self.options.get('doc'))] >> > elif 'functions' in self.options: >> > - for f in str(self.options.get('functions')).split(): >> > - cmd += ['-function', f] >> > + functions = self.options.get('functions').split() >> >> Does .split() get upset if there's no argument? Or do you get an empty >> string if there are no options? I forget. > > "".split() gives an empty list. I tried to say, does self.options.get('functions') return an empty string or None if there are no options? BR, Jani. > >> BR, >> Jani. >> >> > + if functions: >> > + for f in functions: >> > + cmd += ['-function', f] >> > + else: >> > + cmd += ['-no-doc-sections'] >> > >> > for pattern in export_file_patterns: >> > for f in glob.glob(env.config.kerneldoc_srctree + '/' + pattern): >> > >> >> The usage in patch 2/2 would turn into: >> >> >> >> .. kernel-doc:: include/linux/idr.h >> >> :functions: >> >> >> >> which I think is much better overall in the rst source, complementing >> >> the places where you use :doc:. >> >> >> >> BR, >> >> Jani. >> >> >> >> > } >> >> > has_content = False >> >> > >> >> > @@ -77,6 +78,8 @@ class KernelDocDirective(Directive): >> >> > elif 'functions' in self.options: >> >> > for f in str(self.options.get('functions')).split(): >> >> > cmd += ['-function', f] >> >> > + elif 'nodocs' in self.options: >> >> > + cmd += ['-no-doc-sections'] >> >> > >> >> > for pattern in export_file_patterns: >> >> > for f in glob.glob(env.config.kerneldoc_srctree + '/' + pattern): >> >> >> >> -- >> >> Jani Nikula, Intel Open Source Graphics Center >> >> >> >> -- >> Jani Nikula, Intel Open Source Graphics Center >> -- Jani Nikula, Intel Open Source Graphics Center -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html