mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2024-11-27 02:46:23 +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
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -151,7 +151,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dalet"
|
||||
version = "1.0.0-pre.13"
|
||||
version = "1.0.0-pre.14"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"clap",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "dalet"
|
||||
version = "1.0.0-pre.13"
|
||||
version = "1.0.0-pre.14"
|
||||
edition = "2021"
|
||||
authors = ["artegoser"]
|
||||
license = "MIT"
|
||||
|
|
|
@ -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
Reference in a new issue