doc: Add extension to generate repository links
To promote cross-links between the documentation and the code, create a small Sphinx extension which transforms links relative to the repository root into a reference to the repository URL. It attempts to read the version from the Read the Docs configuration and falls back to `git rev-parse HEAD`. The links can be written as follows: :repo:`path/to/file.bb` The environment variable REPO_URL_PATTERN can be used to modify the repo URL for development purposes. The Read the Docs version_name is not useful for determining the Git ref for the purposes of linking to the source code because of the special value "latest", which refers to the default branch. Use the gitlab_version variable instead, which despite the name is simply the "commit_name" of the version according to: https://github.com/readthedocs/readthedocs.org/blob/6.3.0/readthedocs/doc_builder/backends/sphinx.py#L95 and https://github.com/readthedocs/readthedocs.org/blob/6.3.0/readthedocs/builds/models.py#L254 Issue-Id: SCM-5314 Issue-Id: SCM-5624 Signed-off-by:Peter Hoyes <Peter.Hoyes@arm.com> Signed-off-by:
Robbie Cao <robbie.cao@arm.com> Signed-off-by:
Qi Feng <qi.feng@arm.com> Change-Id: Ic3c89208895f36dc3042f3bacbdd08547eb38265
Loading
Please register or sign in to comment