mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2025-03-13 03:04:37 +03:00
fix: type in resolve title
This commit is contained in:
parent
f3231b52c4
commit
915c5c0a6d
4 changed files with 7 additions and 7 deletions
|
@ -4,23 +4,23 @@ use crate::typed::{
|
|||
};
|
||||
|
||||
impl ResolveTitle for Page {
|
||||
fn resolve_title(&self) -> Option<&String> {
|
||||
fn resolve_title(&self) -> Option<String> {
|
||||
resolve_from_tags(&self.data)
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_from_tags(tags: &Vec<Tag>) -> Option<&String> {
|
||||
fn resolve_from_tags(tags: &Vec<Tag>) -> Option<String> {
|
||||
for tag in tags {
|
||||
match tag {
|
||||
H(title, level) => {
|
||||
if *level == Hl::One {
|
||||
return Some(title);
|
||||
return Some(title.to_owned());
|
||||
}
|
||||
}
|
||||
|
||||
Meta(body, key) => {
|
||||
if key == "title" {
|
||||
return Some(body);
|
||||
return Some(body.to_owned());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,5 +109,5 @@ pub enum Hl {
|
|||
}
|
||||
|
||||
pub trait ResolveTitle {
|
||||
fn resolve_title(&self) -> Option<&String>;
|
||||
fn resolve_title(&self) -> Option<String>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue