hippogriffe 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hippogriffe/_extension.py CHANGED
@@ -235,18 +235,6 @@ def _get_repo_url(repo_url: None | str) -> tuple[pathlib.Path, str]:
235
235
  "`hippogriffe.show_source_links` requires specifying a top-level "
236
236
  "`repo_url`."
237
237
  )
238
- is_github = (
239
- repo_url.removeprefix("https://")
240
- .removeprefix("https://")
241
- .startswith("github.com")
242
- )
243
- if not is_github:
244
- # We need to format the `repo_url` to what the repo expects, so we have to
245
- # hardcode this in.
246
- raise ValueError(
247
- "`hippogriffe.show_source_links` currently only supports "
248
- "`repo_url: https://github.com/...`."
249
- )
250
238
  try:
251
239
  git_head = subprocess.run(
252
240
  ["git", "rev-parse", "HEAD"], capture_output=True, check=False
@@ -264,9 +252,19 @@ def _get_repo_url(repo_url: None | str) -> tuple[pathlib.Path, str]:
264
252
  else:
265
253
  toplevel = pathlib.Path(git_toplevel.stdout.decode().strip())
266
254
  commit_hash = git_head.stdout.decode().strip()
267
- repo_url = (
268
- f"{repo_url.removesuffix('/')}/blob/{commit_hash}/{{path}}#L{{start}}-{{end}}"
269
- )
255
+ raw_url = repo_url.removeprefix("https://").removeprefix("https://")
256
+ if raw_url.startswith("github.com") or raw_url.startswith("gitlab.com"):
257
+ repo_url = (
258
+ f"{repo_url.removesuffix('/')}/blob/{commit_hash}/{{path}}"
259
+ "#L{start}-{end}"
260
+ )
261
+ else:
262
+ # We need to format the `repo_url` to what the repo expects, so we have to
263
+ # hardcode this in.
264
+ raise ValueError(
265
+ "`hippogriffe.show_source_links` currently only supports "
266
+ "`repo_url: https://github.com/...` and `repo_url: https://gitlab.com/...`."
267
+ )
270
268
  return toplevel, repo_url
271
269
 
272
270
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hippogriffe
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: A simple ipynb->md converter for MkDocs
5
5
  Project-URL: repository, https://github.com/patrick-kidger/hippogriffe
6
6
  Author-email: Patrick Kidger <contact@kidger.site>
@@ -1,12 +1,12 @@
1
1
  hippogriffe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- hippogriffe/_extension.py,sha256=8hNBWcIxG5ux6iOnPUWOf5Ks6oxPZy6mjXez21bNaJM,13948
2
+ hippogriffe/_extension.py,sha256=zg3Q5h5ziLOX46BXYOpwrXQ7EFGJP7UwKXjKMh7GYjY,14014
3
3
  hippogriffe/_plugin.py,sha256=H0oPka_7URED9wOVYAWUNTWTJXFmH6q7g2W2G5hy64c,4564
4
4
  hippogriffe/assets/_hippogriffe.css,sha256=BgyZLCaOaZNgQErdUb01vpNso4ilUMmoZ5d_OeVpfRE,147
5
5
  hippogriffe/templates/material/hippogriffe/class.html.jinja,sha256=5i624gIuZfnf5toH3jWclzg1qlekqIZ2ODbpzeZcULw,954
6
6
  hippogriffe/templates/material/hippogriffe/fn.html.jinja,sha256=vxrWOPkPkGD3Po9hbcYlyEjsJKhJmOHic4G5t2J0djc,196
7
7
  hippogriffe/templates/material/hippogriffe/hippogriffe.jinja,sha256=KxTBKY0XqiFzqTT1iqFxhN2GhmtwLT4GWc8S86zyjOc,583
8
- hippogriffe-0.1.1.dist-info/METADATA,sha256=1Hl3bjXgHzuBbA7muETfEYYF1iT0jvoTWxw7nIgeF1A,16274
9
- hippogriffe-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- hippogriffe-0.1.1.dist-info/entry_points.txt,sha256=Et3dFNWG-biZ7XCvPI9na-buFT_hht1YT0p0JDNEQQM,158
11
- hippogriffe-0.1.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
- hippogriffe-0.1.1.dist-info/RECORD,,
8
+ hippogriffe-0.1.2.dist-info/METADATA,sha256=IiWbdutZDQd0mrtyQyES29rTdHJEyrZmK7I0jQL0UJ0,16274
9
+ hippogriffe-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ hippogriffe-0.1.2.dist-info/entry_points.txt,sha256=Et3dFNWG-biZ7XCvPI9na-buFT_hht1YT0p0JDNEQQM,158
11
+ hippogriffe-0.1.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
+ hippogriffe-0.1.2.dist-info/RECORD,,