Openstackdocstheme: log-a-bug prefills wrong source file

When clicking on the bug icon on RST-based documentation
pages, the launchpad page that is opened sports a wrong
link to the source file.
Current code assumes that all source files reside in the
same directory as the conf.py file. This assumption is
wrong; source files may well live in subdirectories.

The fix is in script_footer.html. The Javascript code
used to use Jinja2 variable "sourcename", which doesn't
contain the subdirectory of a source file.
This is changed to "pagename", which does.

Change-Id: I3289f6c7a672fbc20c0d9e1183c65ffa49d4db9d
Closes-Bug: #1446444
This commit is contained in:
Bernd Bausch 2015-04-21 03:18:35 +09:00
parent 1209178d24
commit 415893ae82

View File

@ -21,9 +21,10 @@
var lineFeed = "%0A";
{%- if show_source and has_source and sourcename %}
/* for some reason, sphinx replaces the rst extension with
a txt one. Replace it back. */
var sourceFile = "{{ pathto(sourcename,1) }}".replace(/\.txt$/,".rst")
/* "pagename" is the path to the source file, relative to conf.py's
directory. However, "pagename" is missing the rst extension. */
var sourceFile = "{{ pagename }}" + ".rst"
/* Using the current working directory, figure out
in which book we are and use that information to