Noah Massman-Hall <noah.mass...@gmail.com> added the comment:

I took a crack at the rst side of this, to see if I could reduce it to just one 
easy to parse for line in each file that needs to be modified.

Yeah, not so easy.

Substituting text in rst isn't hard, you just insert '|ucd_version|' where the 
version string should go and then include the following line somewhere below.

.. |ucd_version| replace:: 12.1.0

The problem is that I cant find any combination that makes this work for 
substituting the version string inside of a hyperlink. I've tried multiple 
combinations and every time the hyperlink gets broken.

So this, inside Doc/library/stdtypes.rst:

See http://www.unicode.org/Public/\ |ucd_version|\ 
/ucd/extracted/DerivedNumericType.txt

Becomes this in the html:

See <a class="reference external" 
href="http://www.unicode.org/Public/";>http://www.unicode.org/Public/</a>12.1.0/ucd/extracted/DerivedNumericType.txt

It does in fact do the substitution, but the substituted text onward doesn't 
get included in the hyperlink.

It gets worse if you try to hyperlink text instead of just the url.

In Doc/library/unicodedata.rst I tried this:

compiled from the |ucd_link|_.

.. |ucd_link| replace:: UCD version |ucd_version|
.. _ucd_link: http://www.unicode.org/Public/|ucd_version|/ucd

and got:

compiled from the <a class="reference external" 
href="http://www.unicode.org/Public/|ucd_version|/ucd">UCD version 12.1.0</a>

The sub inside a sub works fine, but no combination I tried could get it to 
work in the hyperlink itself.

Near as I can tell, the only way to accomplish this would require adding or 
possibly creating a plugin for sphinx.

----------
nosy: +nmassman

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue22593>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to