Properly return parsed elements

This commit is contained in:
Gabriel 2025-07-18 11:23:30 -04:00
parent dbb3dd5d27
commit becb51d8f8
3 changed files with 3266 additions and 26 deletions

3276
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,11 @@
[package]
name = "rss_content"
version = "0.1.3"
version = "0.1.4"
edition = "2024"
[dependencies]
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"}
#iced = { git = "https://github.com/iced-rs/iced", version = "0.14.0-dev" , features=["markdown"]}
rss = "2.0.12"

View file

@ -11,10 +11,11 @@ pub enum Content {
Markdown(String),
Image(String),
Audio(String),
Video(String)
Video(String),
Ignore
}
//double recursion? This seems dumb.
fn markdownify(item: &Item) -> String{
match markdown_content(item) {
@ -79,7 +80,7 @@ fn media_content(item: &Item) -> Content{
pub fn process_content(content: &str) -> Vec<Content> {
let items = itemize_content(content);
let mut result: Vec<Content> = Vec::new();
let _ = items.iter().map(|i| {
let cnt = items.iter().map(|i| {
match i {
Item::Paragraph(children) => {
result.push(markdown_content(i));
@ -99,11 +100,13 @@ pub fn process_content(content: &str) -> Vec<Content> {
Item::Audio(children) => {
result.push(media_content(i));
}
_ => {}
_ => {
result.push(Content::Ignore);
}
}
});
[Content::Markdown("Ayy lmao".to_owned())].to_vec()
result
}
#[derive(Debug)]