remove is_external detection from crate level

This commit is contained in:
yggverse 2025-03-15 13:56:40 +02:00
parent 2870aeb3fb
commit 638d3cff08

View file

@ -3,7 +3,6 @@ use glib::{DateTime, Regex, RegexCompileFlags, RegexMatchFlags, TimeZone, Uri, U
/// [Link](https://geminiprotocol.net/docs/gemtext-specification.gmi#link-lines) entity holder /// [Link](https://geminiprotocol.net/docs/gemtext-specification.gmi#link-lines) entity holder
pub struct Link { pub struct Link {
pub alt: Option<String>, // [optional] alternative link description pub alt: Option<String>, // [optional] alternative link description
pub is_external: Option<bool>, // [optional] external link indication, on base option provided
pub timestamp: Option<DateTime>, // [optional] valid link DateTime object pub timestamp: Option<DateTime>, // [optional] valid link DateTime object
pub uri: Uri, // [required] valid link URI object pub uri: Uri, // [required] valid link URI object
} }
@ -16,7 +15,6 @@ impl Link {
// Define initial values // Define initial values
let mut alt = None; let mut alt = None;
let mut timestamp = None; let mut timestamp = None;
let mut is_external = None;
// Begin line parse // Begin line parse
let regex = Regex::split_simple( let regex = Regex::split_simple(
@ -57,10 +55,7 @@ impl Link {
Ok(resolved_str) => { Ok(resolved_str) => {
// Try convert string to the valid URI // Try convert string to the valid URI
match Uri::parse(&resolved_str, UriFlags::NONE) { match Uri::parse(&resolved_str, UriFlags::NONE) {
Ok(resolved_uri) => { Ok(resolved_uri) => resolved_uri,
is_external = Some(resolved_uri.scheme() != base_uri.scheme());
resolved_uri
}
Err(_) => return None, Err(_) => return None,
} }
} }
@ -94,7 +89,6 @@ impl Link {
Some(Self { Some(Self {
alt, alt,
is_external,
timestamp, timestamp,
uri, uri,
}) })