I squealed for help in another forum, and some nice fellow cooked this up! https://pypi.org/project/sphinx-version-ref/
I haven't figured out how to make it work yet (sphinx can't find the extension), but it looks quite promising! --William On Fri, Aug 9, 2019 at 6:38 AM Stefano David <[email protected]> wrote: > Hello William, > > On Thursday, 8 August 2019 18:08:12 UTC+2, William Abernathy wrote: >> >> I am trying to automate our documentation (rst/sphinx to html and to >> xetex/PDF output) >> >> I want to stick a version variable into a hyperlink as follows: >> >> `link text, version |version|< >> https://documentation.com/product/|version|/index.html>`_ >> >> From posts on other forums, I understand that this breaks the logic of >> RST (one apparently cannot nest inline markup). >> >> Is there a workaround, or has this been fixed? >> > You can simulate that result, but not perfectly, by using the extlinks > extension and defining a custom role. Setup: > * in conf.py: > extensions = [ 'sphinx.ext.extlinks' ] # add to your list of extensions > extlinks = { > 'ver': > ('https://documentation.com/product/%s/index.html', 'version ') > } > > * in any file, use the role _ver_ inline: > > please check :ver:`4.0` of the product. > > I thinks there's no better solution/workaround to your problem now, unless > the "link text" you mention is always the same (then put it in conf.py > instead of 'version ') or want to create a new role for each variant of > "link text". > > I can't figure out which version of Sphinx I have installed, and if you >> could help with that, I'd be most appreciative as well. >> > Issue sphinx-build --version from the command line. For the record, I > successfully use in my projects the same syntax used above since Sphinx 1.6. > > HTH, > Stefano > >> >> -- > You received this message because you are subscribed to the Google Groups > "sphinx-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sphinx-users/b80e6c8f-9c8b-47ab-8c6f-694df9b2cbde%40googlegroups.com > <https://groups.google.com/d/msgid/sphinx-users/b80e6c8f-9c8b-47ab-8c6f-694df9b2cbde%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- William Abernathy Sr. Tech Writer San Francisco -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAHz33vVN-J2HK%3Dki4PMJzddfY4UHtch0%3DSZw_U5G5FL7WbfBsQ%40mail.gmail.com.
