Open Bug 1650197 Opened 1 year ago Updated 4 months ago

firefox doc: autolink "bug XXXXXX"

Categories

(Firefox Build System :: Documentation Infrastructure, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: Sylvestre, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 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.

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

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.

Flags: needinfo?(sledru)
Attached image Bugzilla.png

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.

Shivam might be able to help here :)

Flags: needinfo?(sledru) → needinfo?(shivams2799)

(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 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.

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

Flags: needinfo?(shivams2799)

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.

Flags: needinfo?(shivams2799)
Attached image Bugzilla2.png

This is how it looks like and links are relative to the main link. This looks very bad especially for pages with multiple links.

Flags: needinfo?(shivams2799)
You need to log in before you can comment on or make changes to this bug.