mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
drop deprecated constructions
This commit is contained in:
parent
3bba0bbb80
commit
54e370215b
@ -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
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
pub mod header;
|
pub mod header;
|
||||||
pub mod link;
|
pub mod link;
|
||||||
pub mod plain;
|
|
||||||
|
@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user