Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit d5955a0

Browse files
authored
Merge pull request #15 from wleepang/github-links
use github for viewing source
2 parents 4c7fbb3 + 7ec8b9a commit d5955a0

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

main.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ def wrapper(*args, **kwargs):
1313

1414
def declare_variables(variables, macro):
1515

16-
_variables = variables[variables['staging']]
16+
_artifacts = variables['artifacts']
1717

1818
@macro
1919
@dedented
2020
def cfn_button(name, template):
2121
"""
2222
create an cloudformation launch button
2323
"""
24-
s3 = _variables['s3']
24+
s3 = _artifacts['s3']
2525

2626
if template.lower().startswith('http'):
2727
cfn_url = template
@@ -51,19 +51,27 @@ def download_button(path, icon="cloud_download"):
5151
"""
5252
create a download button
5353
"""
54-
s3 = _variables['s3']
54+
repo_url = variables['repo_url']
55+
s3 = _artifacts['s3']
5556

5657
if path.lower().startswith('http'):
5758
src_url = path
5859
else:
59-
s3['object'] = "/".join(
60-
filter(None, [s3.get('prefix'), path])
61-
)
60+
# s3['object'] = "/".join(
61+
# filter(None, [s3.get('prefix'), path])
62+
# )
6263

63-
src_url = "https://s3.amazonaws.com/{bucket}/{object}".format(**s3)
64+
# src_url = "https://s3.amazonaws.com/{bucket}/{object}".format(**s3)
65+
if repo_url.endswith("/"):
66+
repo_url = repo_url[:-1]
67+
68+
if path.startswith("/"):
69+
path = path[1:]
70+
71+
src_url = f"{repo_url}/blob/master/src/{path}"
6472

6573
return """
66-
<a href="{url}"><i class="material-icons">{icon}</i></a>
74+
<a href="{url}" target="_blank"><i class="material-icons">{icon}</i></a>
6775
""".format(icon=icon, url=src_url)
6876

6977
@macro

mkdocs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ markdown_extensions:
3737
- pymdownx.emoji:
3838
emoji_generator: !!python/name:pymdownx.emoji.to_png
3939

40-
repo_url: https://github.com/aws-samples/aws-genomics-workflows/
40+
repo_url: &repo_url https://github.com/aws-samples/aws-genomics-workflows/
4141
repo_name: Contribute
4242
copyright: 2019 Amazon Web Services
4343

@@ -46,11 +46,11 @@ plugins:
4646
- macros
4747

4848
extra:
49-
staging: develop
50-
develop:
49+
repo_url: *repo_url
50+
artifacts:
5151
s3:
5252
bucket: aws-genomics-workflows
53-
production:
53+
site:
5454
s3:
5555
bucket: docs.opendata.aws
5656
prefix: genomics-workflows

0 commit comments

Comments
 (0)