From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
To: Miguel Ojeda <ojeda@kernel.org>,
Wedson Almeida Filho <wedsonaf@gmail.com>,
Alex Gaynor <alex.gaynor@gmail.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
patches@lists.linux.dev,
"FUJITA Tomonori" <fujita.tomonori@gmail.com>
Subject: Re: [PATCH] rust: support `srctree`-relative links
Date: Sat, 16 Dec 2023 10:56:25 -0300 [thread overview]
Message-ID: <08b3f964-a66e-483d-81dd-4f6f8f61bdbd@gmail.com> (raw)
In-Reply-To: <20231215235428.243211-1-ojeda@kernel.org>
On 12/15/23 20:54, Miguel Ojeda wrote:
> Some of our links use relative paths in order to point to files in the
> source tree, e.g.:
>
> //! C header: [`include/linux/printk.h`](../../../../include/linux/printk.h)
> /// [`struct mutex`]: ../../../../include/linux/mutex.h
>
> These are problematic because they are hard to maintain and do not support
> `O=` builds.
>
> Instead, provide support for `srctree`-relative links, e.g.:
>
> //! C header: [`include/linux/printk.h`](srctree/include/linux/printk.h)
> /// [`struct mutex`]: srctree/include/linux/mutex.h
>
> The links are fixed after `rustdoc` generation to be based on the absolute
> path to the source tree.
>
> Essentially, this is the automatic version of Tomonori's fix [1],
> suggested by Gary [2].
>
> Suggested-by: Gary Guo <gary@garyguo.net>
> Reported-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
> Closes: https://lore.kernel.org/r/20231026.204058.2167744626131849993.fujita.tomonori@gmail.com [1]
> Fixes: 48fadf440075 ("docs: Move rustdoc output, cross-reference it")
> Link: https://lore.kernel.org/rust-for-linux/20231026154525.6d14b495@eugeo/ [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> Documentation/rust/coding-guidelines.rst | 13 +++++++++++++
> rust/Makefile | 3 ++-
> rust/kernel/error.rs | 2 +-
> rust/kernel/ioctl.rs | 2 +-
> rust/kernel/kunit.rs | 2 +-
> rust/kernel/print.rs | 8 ++++----
> rust/kernel/sync/condvar.rs | 2 +-
> rust/kernel/sync/lock/mutex.rs | 2 +-
> rust/kernel/sync/lock/spinlock.rs | 2 +-
> rust/kernel/task.rs | 2 +-
> rust/kernel/workqueue.rs | 2 +-
> rust/macros/lib.rs | 2 +-
> 12 files changed, 28 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/rust/coding-guidelines.rst b/Documentation/rust/coding-guidelines.rst
> index aa8ed082613e..05542840b16c 100644
> [...]
> diff --git a/rust/Makefile b/rust/Makefile
> index 543b37f6c77f..73ea24117f07 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -98,7 +98,8 @@ rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
> $(Q)find $(rustdoc_output) -name '*.html' -type f -print0 | xargs -0 sed -Ei \
> -e 's:rust-logo-[0-9a-f]+\.svg:logo.svg:g' \
> -e 's:favicon-[0-9a-f]+\.svg:logo.svg:g' \
> - -e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g'
> + -e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g' \
> + -e 's:<a href="srctree/([^"]+)">:<a href="$(abs_srctree)/\1">:g'
Another way would be to not put `srctree` in the link and add
`abs_srctree` here to directories that are in `srctree`. But that might
be too wonky to rely on so this will be the way to go.
> $(Q)for f in $(rustdoc_output)/static.files/rustdoc-*.css; do \
> echo ".logo-container > img { object-fit: contain; }" >> $$f; done
>
> [...]
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
next prev parent reply other threads:[~2023-12-16 13:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 23:54 [PATCH] rust: support `srctree`-relative links Miguel Ojeda
2023-12-16 0:02 ` Miguel Ojeda
2023-12-16 13:56 ` Martin Rodriguez Reboredo [this message]
2023-12-18 16:47 ` Benno Lossin
2023-12-21 21:38 ` Miguel Ojeda
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=08b3f964-a66e-483d-81dd-4f6f8f61bdbd@gmail.com \
--to=yakoyoku@gmail.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=patches@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=wedsonaf@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.