Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp859264yba; Fri, 26 Apr 2019 09:54:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFW2ko9HUqU7TSsGmBAnaSOA1SFPo5HQ8d8EpMqfwG/NavPH0MUM9BZ6QG1TDToRC514+A X-Received: by 2002:a63:3fc1:: with SMTP id m184mr10903336pga.222.1556297698476; Fri, 26 Apr 2019 09:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556297698; cv=none; d=google.com; s=arc-20160816; b=1DFx6oS/crmR/0yP3Z5wRm74fa7+W+doIfTyx04jy/k5SDIEQNRTXZjMzj4sYnZgF1 EuI7RlqxU2AIoR23iW9bJXYRChbxDXtRHgZ8FpWMbnrFGFpTNoShcODEgr/yzzlds/fI Bb2ZcTKfAsUSpT4kGGZ0Wc3bRorcpDUWde1pPsQ5vKH7Ysp3EuOHbELRQXO9OVcFPkJn xVkU+Cb6KzXVQu7XK+zsBo8vf7fiE5Ef7E22M/nbw4CcaMPjgULRgXEh+P+rUQGKuQYe a5sNBZsIDmgGu8FN+Cnl6BZglVKwsqAVTcwVMeLSO8virA27tx+F+bDRbzw0n3pv1vUO Nzlw== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=xzkID6SpB5cF5asG3jpF9DL+jbsppf2JRC4JM/4PmQA=; b=oqQLd1wWRLjOWwkb0PI+L9TrA9tfdEPdy6mwwdtGbzSMov5dSasCVANu0ID2K3Au5F BE6Q4XRh3fvrrx0CXG0NNSRmqDV4Rd/3lg/TW92QEB65WPuklfMUSvJxZtsg0cnA5Nb4 xJzZRoEcY1xuLN/xVpgeyrsWywEQ1d+I7dY2xWh4KMvqAydG8JW7uPPcm0scZf9pofPn KLQHJzByR2i6aOoHiR1litMq8C9pgzTMrsqqoxlm68YClS8+tsaSBljZZ1Xa3wD2H4SF CIbkrXuobc/3p8UUlWUMOCxLU+Uy+ZYkg3GcwfigzhiH+3TeD3jbrdkwt43uengM2yJm NbmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si6623654pfd.80.2019.04.26.09.54.42; Fri, 26 Apr 2019 09:54:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726413AbfDZQwM (ORCPT + 99 others); Fri, 26 Apr 2019 12:52:12 -0400 Received: from ms.lwn.net ([45.79.88.28]:50112 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZQwL (ORCPT ); Fri, 26 Apr 2019 12:52:11 -0400 Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 50E6D7DF; Fri, 26 Apr 2019 16:52:10 +0000 (UTC) Date: Fri, 26 Apr 2019 10:52:09 -0600 From: Jonathan Corbet To: Jani Nikula Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Mauro Carvalho Chehab Subject: Re: [PATCH 1/2] Docs: An initial automarkup extension for sphinx Message-ID: <20190426105209.1e414eae@lwn.net> In-Reply-To: <87tvelrv8d.fsf@intel.com> References: <20190425200125.12302-1-corbet@lwn.net> <20190425200125.12302-2-corbet@lwn.net> <87tvelrv8d.fsf@intel.com> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Apr 2019 12:06:42 +0300 Jani Nikula wrote: > It's more involved, but I think the better place to do this (as well as > the kernel-doc transformations) would be in the doctree-read event, > after the rst parsing is done. You can traverse the doctree and find the > places which weren't special for Sphinx, and replace the plain text > nodes in-place. I've toyed with this in the past, but alas I didn't have > (and still don't) have the time to finish the job. I had thought about this; indeed, there's a comment in the posted patch to that effect. The tradeoff comes down to this, I think: - The fragility and inelegance of embedding a bit of redundant RST parsing into this extension v. that of adding a late parsing stage as a transform, trying to enumerate every node type that you might want to change, and digging into the C domain code to emulate its reference generation. - The time required to implement a solution; I'm having a bit of a hard time keeping up with docs at the moment as it is. - Regexes. This solution has more of them, but we're not going to get away from them regardless. I am not at all opposed to a more proper solution that might, in the long term, produce more deterministic results. I can even try to work in that direction. But this is something that can be done now that, IMO, doesn't in any way close off a better implementation in the future. If we agree that we should automatically generate references for occurrences of "function()", we can change how that is actually done later. I'll look into this further, but my inclination is to go forward with what I have now. It's simple and easy to understand, and doesn't seem to screw up anywhere in the current body of kernel docs as far as I can tell. > If you decide to go with regex anyway, I'd at least consider pulling the > transformations/highlights from kernel-doc the script to the Sphinx > extension, and use the exact same transformations for stuff in source > code comments and rst files. Pulling all RST manipulation out of kerneldoc has a great deal of appeal; assuming this goes forward that should indeed be high on the todo list. Thanks, jon