Skip to content

Commit

Permalink
fix: use source_version instead of source_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Feb 3, 2024
1 parent 1ebf4e7 commit 49520c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/customisation/sidebar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ configuration. Simply add the following to your Sphinx ``conf.py`` file:
"source_type": "github|gitlab|bitbucket",
"source_user": "<username>",
"source_repo": "<repository>",
"source_branch": "master", # Optional
"source_version": "master", # Optional
"source_docs_path": "/docs/", # Optional
}
Expand Down
5 changes: 3 additions & 2 deletions src/shibuya/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def create_edit_source_link(context: Dict[str, Any]):
source_user = context.get("source_user")
source_repo = context.get("source_repo")
source_docs_path = context.get("source_docs_path", "/docs/")
source_branch = context.get("source_branch", "master")
source_version = context.get("source_version", "master")
source_edit_template = context.get("source_edit_template")

def edit_source_link(filename: str) -> str:
Expand All @@ -68,7 +68,7 @@ def edit_source_link(filename: str) -> str:
elif source_type == "bitbucket":
url = f"https://bitbucket.org/{source_user}/{source_repo}/src"

return f"{url}/{source_branch}{source_docs_path}{filename}"
return f"{url}/{source_version}{source_docs_path}{filename}"

return edit_source_link

Expand All @@ -86,5 +86,6 @@ def _normalize_readthedocs_context(context: Dict[str, Any]):
context["source_type"] = source_type
context["source_user"] = context.get(f"{source_type}_user")
context["source_repo"] = context.get(f"{source_type}_repo")
context["source_version"] = context.get(f"{source_type}_version")
context["source_docs_path"] = context.get("conf_py_path")
return source_type

0 comments on commit 49520c8

Please sign in to comment.