mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
fix default title on h1 not defined in gemtext
This commit is contained in:
parent
2d2620ffa2
commit
12ce56be6b
@ -974,12 +974,18 @@ pub fn migrate(tx: &Transaction) -> Result<(), String> {
|
||||
///
|
||||
/// * this feature may be improved and moved outside @TODO
|
||||
fn uri_to_title(uri: &Uri) -> GString {
|
||||
match uri.path().split('/').last() {
|
||||
Some(filename) => gformat!("{filename}"),
|
||||
None => match uri.host() {
|
||||
let title = GString::from(match uri.path().split('/').last() {
|
||||
Some(filename) => filename,
|
||||
None => "",
|
||||
});
|
||||
|
||||
if title.is_empty() {
|
||||
match uri.host() {
|
||||
Some(host) => gformat!("{host}"),
|
||||
None => gformat!("Untitled"),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
title
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user