File tree Expand file tree Collapse file tree 5 files changed +21
-8
lines changed Expand file tree Collapse file tree 5 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ struct GitHubMetadata {
53
53
stars : i32 ,
54
54
forks : i32 ,
55
55
issues : i32 ,
56
+ name : Option < String > ,
56
57
}
57
58
58
59
fn optional_markdown < S > ( markdown : & Option < String > , serializer : S ) -> Result < S :: Ok , S :: Error >
@@ -101,6 +102,7 @@ impl CrateDetails {
101
102
github_repos.stars AS github_stars,
102
103
github_repos.forks AS github_forks,
103
104
github_repos.issues AS github_issues,
105
+ github_repos.name AS github_name,
104
106
releases.is_library,
105
107
releases.yanked,
106
108
releases.doc_targets,
@@ -136,6 +138,7 @@ impl CrateDetails {
136
138
issues : krate. get ( "github_issues" ) ,
137
139
stars : krate. get ( "github_stars" ) ,
138
140
forks : krate. get ( "github_forks" ) ,
141
+ name : krate. get ( "github_name" ) ,
139
142
} )
140
143
} else {
141
144
None
Original file line number Diff line number Diff line change @@ -301,9 +301,9 @@ impl tera::Filter for IconType {
301
301
let mut aria_hidden = true ;
302
302
let icon_name = tera:: escape_html ( value. as_str ( ) . expect ( "Icons only take strings" ) ) ;
303
303
let class = if args. get ( "fw" ) . and_then ( |fw| fw. as_bool ( ) ) . unwrap_or ( false ) {
304
- "class= \" fa-svg fa-svg-fw\" "
304
+ "fa-svg fa-svg-fw"
305
305
} else {
306
- "class= \" fa-svg\" "
306
+ "fa-svg"
307
307
} ;
308
308
let aria_label = args
309
309
. get ( "aria-label" )
@@ -332,9 +332,12 @@ impl tera::Filter for IconType {
332
332
let icon_file_string = font_awesome_as_a_crate:: svg ( type_, & icon_name[ ..] ) . unwrap_or ( "" ) ;
333
333
334
334
let icon = format ! (
335
- r#"<span {class} aria-hidden="{aria_hidden}"{aria_label}{id}>{icon_file_string}</span>"# ,
335
+ "<span \
336
+ class=\" {class} {class_extra}\" \
337
+ aria-hidden=\" {aria_hidden}\" {aria_label}{id}>{icon_file_string}</span>",
336
338
icon_file_string = icon_file_string,
337
339
class = class,
340
+ class_extra = args. get( "extra" ) . and_then( |s| s. as_str( ) ) . unwrap_or( "" ) ,
338
341
aria_hidden = aria_hidden,
339
342
aria_label = aria_label,
340
343
id = id,
Original file line number Diff line number Diff line change 76
76
{# TODO: add support for hosts besides github (#35) #}
77
77
{%- if details.github_metadata -%}
78
78
{{ "github" | fab(fw=true) }}
79
- {{ "star" | fas(fw=true) }} {{ details.github_metadata.stars }}
79
+ {% if details.github_metadata.name %}
80
+ {{details.github_metadata.name}}
81
+ {% else %}
82
+ Repository
83
+ {% endif %}
84
+ < br >
85
+ {{ "star" | fas(fw=true, extra="left-margin") }} {{ details.github_metadata.stars }}
80
86
{{ "code-branch" | fas(fw=true) }} {{ details.github_metadata.forks }}
81
87
{{ "exclamation-circle" | fas(fw=true) }} {{ details.github_metadata.issues }}
82
88
Original file line number Diff line number Diff line change 62
62
{%- if krate.github_metadata -%}
63
63
< li class ="pure-menu-item ">
64
64
< a href ="{{ krate.repository_url }} " class ="pure-menu-link ">
65
- {{ "github" | fab(fw=true) }}
66
- {{ "star" | fas(fw=true) }} {{ krate.github_metadata.stars }}
67
- {{ "code-branch" | fas(fw=true) }} {{ krate.github_metadata.forks }}
68
- {{ "exclamation-circle" | fas(fw=true) }} {{ krate.github_metadata.issues }}
65
+ {{ "code-branch" | fas(fw=true) }} Repository
69
66
</ a >
70
67
</ li >
71
68
Original file line number Diff line number Diff line change 4
4
display : inline-block ;
5
5
}
6
6
7
+ .fa-svg.left-margin {
8
+ margin-left : 1.25em ;
9
+ }
10
+
7
11
.fa-svg svg {
8
12
width : 1em ;
9
13
height : 1em ;
You can’t perform that action at this time.
0 commit comments