Do optional the crate description
parent
d65343d912
commit
beead99db8
|
@ -4,7 +4,7 @@ use serde::Serialize;
|
|||
#[derive(Serialize, Debug, Clone)]
|
||||
pub struct CrateInfo {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub description: Option<String>,
|
||||
pub owner: String,
|
||||
pub latest_version: Version,
|
||||
pub versions: Vec<Version>,
|
||||
|
|
|
@ -106,11 +106,7 @@ pub fn search_crate(crate_name: String) -> Option<CrateInfo> {
|
|||
} else {
|
||||
let description = resp
|
||||
.css_once(".desc")
|
||||
.unwrap()
|
||||
.content()
|
||||
.trim()
|
||||
.replace('\n', " ")
|
||||
.into();
|
||||
.map(|desc| desc.content().trim().replace("\n", " ").into());
|
||||
let owner = resp
|
||||
.css("a.owner")
|
||||
.iter()
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
|
||||
{%- if item -%}
|
||||
## {{ item.name }} v{{ item.latest_version.version }}
|
||||
{% if item.description -%}
|
||||
> {{ item.description }}
|
||||
{%- endif %}
|
||||
by {{ item.owner }} {% if item.license %}[{{ item.license }}]{% endif %}
|
||||
|
||||
### Install by:
|
||||
|
|
Loading…
Reference in New Issue