@@ -13,15 +13,15 @@ def wrapper(*args, **kwargs):
1313
1414def 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
0 commit comments