mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
add missed trailing slash condition based on the current url
This commit is contained in:
parent
6a3ee89d8b
commit
4d1fa804ba
1 changed files with 41 additions and 33 deletions
|
|
@ -51,6 +51,9 @@ impl Nex for TextView {
|
|||
|
||||
// Collect links
|
||||
for line in data.lines() {
|
||||
// * skip links processing when the current location does not contain trailing slash
|
||||
// it may be confusing: gemini://bbs.geminispace.org/s/nex/29641
|
||||
if base.to_string().ends_with("/") {
|
||||
// just borrow ggemtext parser as compatible API
|
||||
if let Some(link) = ggemtext::line::Link::parse(line) {
|
||||
if let Some(uri) = link.uri(Some(base)) {
|
||||
|
|
@ -79,7 +82,11 @@ impl Nex for TextView {
|
|||
&[&a],
|
||||
);
|
||||
if let Some(alt) = link.alt {
|
||||
buffer.insert_with_tags(&mut buffer.end_iter(), &format!(" {alt}"), &[&p]);
|
||||
buffer.insert_with_tags(
|
||||
&mut buffer.end_iter(),
|
||||
&format!(" {alt}"),
|
||||
&[&p],
|
||||
);
|
||||
}
|
||||
buffer.insert(&mut buffer.end_iter(), NEW_LINE);
|
||||
|
||||
|
|
@ -88,6 +95,7 @@ impl Nex for TextView {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Nothing match custom tags above,
|
||||
// just append plain text covered in empty tag (to handle controller events properly)
|
||||
buffer.insert_with_tags(&mut buffer.end_iter(), line, &[&p]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue