drop deprecated constructions

This commit is contained in:
yggverse 2024-10-12 11:24:43 +03:00
parent 3bba0bbb80
commit 54e370215b
3 changed files with 5 additions and 26 deletions

View File

@ -3,7 +3,6 @@ mod widget;
use parser::header::Header; use parser::header::Header;
use parser::link::Link; use parser::link::Link;
use parser::plain::Plain;
use widget::Widget; use widget::Widget;
use gtk::{ use gtk::{
@ -30,12 +29,13 @@ impl Reader {
// Init markup // Init markup
let buffer = TextBuffer::new(None); let buffer = TextBuffer::new(None);
// Parse lines
for line in gemtext.lines() { for line in gemtext.lines() {
/* /*
// Is header // Is header
if let Some(header) = Header::from(line) { if let Some(header) = Header::from(line) {
// Format // Format
markup.push_str(header.markup()); buffer.insert_markup(&mut buffer.end_iter(), header.markup());
// Set title from first document header tag // Set title from first document header tag
if title == None { if title == None {
@ -48,16 +48,15 @@ impl Reader {
// Is link // Is link
if let Some(link) = Link::from(line, base) { if let Some(link) = Link::from(line, base) {
// Format // Format
markup.push_str(link.markup()); buffer.insert_markup(&mut buffer.end_iter(), link.markup());
continue; continue;
} }
// Nothing match, escape string just // Nothing match, escape string just
markup.push_str(Plain::from(line).markup()) buffer.insert_markup(&mut buffer.end_iter(), Plain::from(line).markup()) */
*/
buffer.insert(&mut buffer.end_iter(), Plain::from(line).as_str()); buffer.insert(&mut buffer.end_iter(), format!("{line}\n").as_str()) // @TODO
} }
// Init widget // Init widget

View File

@ -1,3 +1,2 @@
pub mod header; pub mod header;
pub mod link; pub mod link;
pub mod plain;

View File

@ -1,19 +0,0 @@
use gtk::glib::{gformat, GString};
pub struct Plain {
line: GString,
}
impl Plain {
// Construct
pub fn from(line: &str) -> Self {
Self {
line: gformat!("{}\n", line),
}
}
// Getters
pub fn as_str(&self) -> &str {
self.line.as_str()
}
}