firefox doc: autolink "bug XXXXXX"
Categories
(Developer Infrastructure :: Source Documentation, enhancement)
Tracking
(firefox98 fixed)
Tracking | Status | |
---|---|---|
firefox98 | --- | fixed |
People
(Reporter: Sylvestre, Assigned: anastasiostam, Mentored)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug, Whiteboard: [lang=python])
Attachments
(3 files)
when we write some docs, if we have "bug XXXXXX", it is 99% of the time a link to bugzilla.m.o
Example:
https://phabricator.services.mozilla.com/D81805
We should automatically transform
bug xxxxxx to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=xxxx">bug xxx</a>
I don't know if sphinx has this capability but here is probably an extension to do it.
Comment 1•5 years ago
•
|
||
Awesome idea kudos , may be we can look into the irc bot we had on irc.m.o , it might be a little help I did not read much , look more into this on weekend but may be https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html can do the magic for us , might need to tweak the things little not sure
Comment 2•4 years ago
|
||
Intersphinx
uses a dictionary of the form intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
to map string into their respective links. This used in here https://searchfox.org/mozilla-central/source/testing/web-platform/tests/docs/conf.py#48,216 . Since we need to replace every Bug XXXXXX with its URL which doesn't seem feasible. Please help me If there is a way around this, I am willing to work on this.
Comment 3•4 years ago
|
||
After doing some research I found out that this extension is more appropriate for this work. We have to design a function and it will receive class:: and function::
type objects with some information and we can use it to not only make links for bug XXXXXXX type links but I think we can extend it for multiple uses. I am not sure if this is its designated use but I tried it on a temp project and it works.
We first add linkcode_resolve(domain, info)
function to conf.py file with appropriate description and then we use it in out rst files like
.. py:function:: Bugzilla192222()
this will set domain = py
and info = {'module': '', 'fullname': 'Bugzilla192222'}
. I have attached how this looks on my demo project please see it this is okay..I will implement this.
Reporter | ||
Comment 4•4 years ago
|
||
Shivam might be able to help here :)
Comment 5•4 years ago
|
||
(In reply to Akshat [:baka] from comment #3)
We first add
linkcode_resolve(domain, info)
function to conf.py file with appropriate description and then we use it in out rst files like
.. py:function:: Bugzilla192222()
this will setdomain = py
andinfo = {'module': '', 'fullname': 'Bugzilla192222'}
. I have attached how this looks on my demo project please see it this is okay..I will implement this.
I think it should work, but we actually want if someone just mentioned Bug 12345666666, it should autolink to it, we do not want to tweak the pre exisiting docs written by people in markdown and rst, on rendering level we have to make changes so that it links automatically, anyways raise the patch with r?ahal,sylvestre or me too may be. And then we will see how it goes. Thanks for researching on this
Comment 6•4 years ago
|
||
I tried implementing it but it doesn't look as good and has sufficient drawbacks. So this does not work. (I thought I could use something and make this a component such that not only for Bugzilla links but we could customize it for any link but this doesn't work at all). Sorry for wasting your time.
Comment 7•4 years ago
|
||
This is how it looks like and links are relative to the main link. This looks very bad especially for pages with multiple links.
Updated•4 years ago
|
Reporter | ||
Updated•3 years ago
|
Assignee | ||
Comment 8•3 years ago
|
||
I will take a shot at this bug
Assignee | ||
Comment 9•3 years ago
|
||
An extension is created that uses SphinxTransform to convert bug xxxxxxx strings that exist in docs to reference links that redirect to the appropriate bug in bugzilla
Updated•3 years ago
|
Comment 10•3 years ago
|
||
Comment 11•3 years ago
|
||
bugherder |
Reporter | ||
Comment 12•3 years ago
|
||
bravo for this patch :)
Updated•2 years ago
|
Description
•