Closed Bug 1650197 Opened 5 years ago Closed 3 years ago

firefox doc: autolink "bug XXXXXX"

Categories

(Developer Infrastructure :: Source Documentation, enhancement)

enhancement

Tracking

(firefox98 fixed)

RESOLVED FIXED
98 Branch
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.

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)
Mentor: sledru
Keywords: good-first-bug
Whiteboard: [lang=python]

I will take a shot at this bug

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

Assignee: nobody → anastasiostam
Status: NEW → ASSIGNED
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/510e359ac62a Add an extension to autolink bug xxxxxxx strings in docs to bugzilla hyperlinks r=sylvestre DONTBUILD
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch

bravo for this patch :)

Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: