mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
fix default title on h1 not defined in gemtext
This commit is contained in:
parent
2d2620ffa2
commit
12ce56be6b
1 changed files with 10 additions and 4 deletions
|
|
@ -974,12 +974,18 @@ pub fn migrate(tx: &Transaction) -> Result<(), String> {
|
||||||
///
|
///
|
||||||
/// * this feature may be improved and moved outside @TODO
|
/// * this feature may be improved and moved outside @TODO
|
||||||
fn uri_to_title(uri: &Uri) -> GString {
|
fn uri_to_title(uri: &Uri) -> GString {
|
||||||
match uri.path().split('/').last() {
|
let title = GString::from(match uri.path().split('/').last() {
|
||||||
Some(filename) => gformat!("{filename}"),
|
Some(filename) => filename,
|
||||||
None => match uri.host() {
|
None => "",
|
||||||
|
});
|
||||||
|
|
||||||
|
if title.is_empty() {
|
||||||
|
match uri.host() {
|
||||||
Some(host) => gformat!("{host}"),
|
Some(host) => gformat!("{host}"),
|
||||||
None => gformat!("Untitled"),
|
None => gformat!("Untitled"),
|
||||||
},
|
}
|
||||||
|
} else {
|
||||||
|
title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue