linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@protonmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com
Subject: [PATCH 0/3] docs: Add automatic cross-reference for documentation pages
Date: Fri, 11 Sep 2020 13:34:27 +0000	[thread overview]
Message-ID: <20200911133339.327721-1-nfraprado@protonmail.com> (raw)

Cross-referencing from a documentation page to another can be done using the
:doc:`doc-file` directive from Sphinx.
This however introduces markup that could be avoided to increase readability in
plain text.
This patch series adds automatic markup for cross-referencing between
documentation pages.

This patch series depends on [1].

The first patch refactors the automarkup script to split regex matching and
iteration into one function and text markup substitution into another.
This enables each regex to have its own function that substitutes its matches'
text for the appropriate markup and is necessary for the automatic markup of
documentation pages since it requires slightly different logic from marking up
C references.

The second patch adds automatic markup for cross-referencing documentation
pages by adding an appropriate regex and function to do the markup.
This enables a text like "See Documentation/doc-guide/sphinx.rst." to be
substituted by a cross-reference to that document without any additional markup.
Since this automarkup doesn't work with relative paths (they always need to
start at Documentation/), it will almost always require more typing than the
equivalent :doc:`sphinx`, but it's purpose is to avoid the markup, making it
more readable in plain text.
The .rst extension was left as optional in the regex matching, even though it
only makes sense for .rst documents, because I thought not specifying the
extension, like "See Documentation/doc-guide/sphinx." also made sense as a
cross-reference.

The third patch adds a section about cross-referencing in the "Writing
Documentation" chapter since there was none (other than the one regarding
kernel-doc).
The section describes how to use the new automatic cross-referencing for
documentation pages, and also how to use the already in place Sphinx doc
directive.
It also points to the kernel-doc document for information on cross-referencing
kernel-doc functions and types (using the new automarkup, so it also serves as a
testcase for it).

Thanks,
Nícolas

[1]: https://lore.kernel.org/linux-doc/20200903005747.3900333-1-nfraprado@protonmail.com/

Nícolas F. R. A. Prado (3):
  docs: Allow multiple automarkup functions
  docs: Add automatic cross-reference for documentation pages
  docs: Document cross-referencing between documentation pages

 Documentation/doc-guide/sphinx.rst |  17 ++++
 Documentation/sphinx/automarkup.py | 134 ++++++++++++++++++++---------
 2 files changed, 109 insertions(+), 42 deletions(-)

-- 
2.28.0



             reply	other threads:[~2020-09-11 16:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 13:34 Nícolas F. R. A. Prado [this message]
2020-09-11 13:34 ` [PATCH 1/3] docs: Allow multiple automarkup functions Nícolas F. R. A. Prado
2020-09-11 13:34 ` [PATCH 2/3] docs: Add automatic cross-reference for documentation pages Nícolas F. R. A. Prado
2020-09-11 13:34 ` [PATCH 3/3] docs: Document cross-referencing between " Nícolas F. R. A. Prado
2020-09-16 17:48 ` [PATCH 0/3] docs: Add automatic cross-reference for " Jonathan Corbet

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=20200911133339.327721-1-nfraprado@protonmail.com \
    --to=nfraprado@protonmail.com \
    --cc=andrealmeid@collabora.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkcamp@lists.libreplanetbr.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;
as well as URLs for NNTP newsgroup(s).