Skip to content

Commit

Permalink
Giving flag to Sphinx templates to determine whether the code at the …
Browse files Browse the repository at this point in the history
…end of the github/bitbucket link is editable (it's a branch) or not (it's a specific commit).
  • Loading branch information
gregmuellegger committed Jun 25, 2015
1 parent dfcf47a commit 4619c82
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions readthedocs/doc_builder/backends/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@ def append_conf(self, **kwargs):
outfile.write("\n")
conf_py_path = version_utils.get_conf_py_path(self.version)
remote_version = version_utils.get_vcs_version_slug(self.version)
github_user, github_repo = version_utils.get_github_username_repo(url=self.version.project.repo)
bitbucket_user, bitbucket_repo = version_utils.get_bitbucket_username_repo(url=self.version.project.repo)

github_user, github_repo = version_utils.get_github_username_repo(url=self.version.project.repo)
github_version_is_editable = (self.version.type == 'branch')
display_github = github_user is not None

bitbucket_user, bitbucket_repo = version_utils.get_bitbucket_username_repo(url=self.version.project.repo)
bitbucket_version_is_editable = (self.version.type == 'branch')
display_bitbucket = bitbucket_user is not None

rtd_ctx = Context({
Expand All @@ -88,12 +91,14 @@ def append_conf(self, **kwargs):
# GitHub
'github_user': github_user,
'github_repo': github_repo,
'github_version': remote_version,
'github_version': remote_version,
'github_version_is_editable': github_version_is_editable,
'display_github': display_github,
# BitBucket
'bitbucket_user': bitbucket_user,
'bitbucket_repo': bitbucket_repo,
'bitbucket_version': remote_version,
'bitbucket_version': remote_version,
'bitbucket_version_is_editable': bitbucket_version_is_editable,
'display_bitbucket': display_bitbucket,
'commit': self.version.project.vcs_repo(self.version.slug).commit,
})
Expand Down

0 comments on commit 4619c82

Please sign in to comment.