File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,7 @@ pub(crate) async fn generate(
5252 platform: params. service,
5353 user: & params. user,
5454 repo: & params. repo,
55- branch: params
56- . branch
57- . as_deref( )
58- . filter( |s| !s. is_empty( ) )
59- . unwrap_or( "master" ) ,
55+ branch: params. branch. as_deref( ) . filter( |s| !s. is_empty( ) ) ,
6056 }
6157 )
6258}
Original file line number Diff line number Diff line change @@ -18,5 +18,12 @@ pub struct RepoGeneratorInfo<'a> {
1818 pub platform : Platform ,
1919 pub user : & ' a str ,
2020 pub repo : & ' a str ,
21- pub branch : & ' a str ,
21+ pub branch : Option < & ' a str > ,
22+ }
23+
24+ impl RepoGeneratorInfo < ' _ > {
25+ pub fn query ( & self ) -> String {
26+ self . branch
27+ . map_or_else ( String :: new, |b| format ! ( "?branch={b}" ) )
28+ }
2229}
Original file line number Diff line number Diff line change 1010</ p >
1111
1212< pre >
13- [/@repo_info.user/@repo_info.repo?branch= @repo_info.branch) ](@base_url/@repo_info.platform.url_path()/@repo_info.user/@repo_info.repo/view?branch= @repo_info.branch )
13+ [/@repo_info.user/@repo_info.repo@repo_info.query()) ](@base_url/@repo_info.platform.url_path()/@repo_info.user/@repo_info.repo/view@repo_info.query() )
1414</ pre >
1515
1616< p >
1717It will be rendered like this
1818</ p >
1919
2020< pre >
21- < a href ="@base_url/@repo_info.platform.url_path()/@repo_info.user/@repo_info.repo/view?branch= @repo_info.branch "> < img src ="@base_url/@repo_info.platform.url_path()/@repo_info.user/@repo_info.repo?branch= @repo_info.branch " alt ="example badge " /> </ a >
21+ < a href ="@base_url/@repo_info.platform.url_path()/@repo_info.user/@repo_info.repo/view@repo_info.query() "> < img src ="@base_url/@repo_info.platform.url_path()/@repo_info.user/@repo_info.repo@repo_info.query() " alt ="example badge " /> </ a >
2222</ pre >
2323}, version_info, repo_count)
You can’t perform that action at this time.
0 commit comments