Properly return parsed elements
This commit is contained in:
parent
dbb3dd5d27
commit
becb51d8f8
3 changed files with 3266 additions and 26 deletions
3276
Cargo.lock
generated
3276
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,11 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rss_content"
|
name = "rss_content"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ego-tree = "0.10.0"
|
ego-tree = "0.10.0"
|
||||||
|
iced = { git = "https://github.com/iced-rs/iced", version = "0.14.0-dev", features=["markdown"]}
|
||||||
reqwest = {features=["blocking"], version="0.12.22"}
|
reqwest = {features=["blocking"], version="0.12.22"}
|
||||||
#iced = { git = "https://github.com/iced-rs/iced", version = "0.14.0-dev" , features=["markdown"]}
|
#iced = { git = "https://github.com/iced-rs/iced", version = "0.14.0-dev" , features=["markdown"]}
|
||||||
rss = "2.0.12"
|
rss = "2.0.12"
|
||||||
|
|
13
src/lib.rs
13
src/lib.rs
|
@ -11,10 +11,11 @@ pub enum Content {
|
||||||
Markdown(String),
|
Markdown(String),
|
||||||
Image(String),
|
Image(String),
|
||||||
Audio(String),
|
Audio(String),
|
||||||
Video(String)
|
Video(String),
|
||||||
|
Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//double recursion? This seems dumb.
|
//double recursion? This seems dumb.
|
||||||
fn markdownify(item: &Item) -> String{
|
fn markdownify(item: &Item) -> String{
|
||||||
match markdown_content(item) {
|
match markdown_content(item) {
|
||||||
|
@ -79,7 +80,7 @@ fn media_content(item: &Item) -> Content{
|
||||||
pub fn process_content(content: &str) -> Vec<Content> {
|
pub fn process_content(content: &str) -> Vec<Content> {
|
||||||
let items = itemize_content(content);
|
let items = itemize_content(content);
|
||||||
let mut result: Vec<Content> = Vec::new();
|
let mut result: Vec<Content> = Vec::new();
|
||||||
let _ = items.iter().map(|i| {
|
let cnt = items.iter().map(|i| {
|
||||||
match i {
|
match i {
|
||||||
Item::Paragraph(children) => {
|
Item::Paragraph(children) => {
|
||||||
result.push(markdown_content(i));
|
result.push(markdown_content(i));
|
||||||
|
@ -99,11 +100,13 @@ pub fn process_content(content: &str) -> Vec<Content> {
|
||||||
Item::Audio(children) => {
|
Item::Audio(children) => {
|
||||||
result.push(media_content(i));
|
result.push(media_content(i));
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {
|
||||||
|
result.push(Content::Ignore);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
[Content::Markdown("Ayy lmao".to_owned())].to_vec()
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
Loading…
Reference in a new issue