diff options
author | Akshay <[email protected]> | 2023-05-30 06:26:39 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2023-05-30 06:26:39 +0100 |
commit | 757090d32980564896d79301152490dc9b24bbb3 (patch) | |
tree | d07676b4937491128301a8cd9c5348e64ee15b19 /src/feed.rs | |
parent | eb08fd76ffbb5f16c5644547aaaa9e7f1249ee4d (diff) |
fix an assortment of bugs
- fix entry ordering for non-chronological rss feeds
- fix link shortening by stripping http
- begin work on adding more than one feed
Diffstat (limited to 'src/feed.rs')
-rw-r--r-- | src/feed.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/feed.rs b/src/feed.rs index f9a7893..77f1a45 100644 --- a/src/feed.rs +++ b/src/feed.rs | |||
@@ -104,6 +104,7 @@ impl Feed { | |||
104 | 104 | ||
105 | // update entries | 105 | // update entries |
106 | self.entries = entries.into_iter().map(Result::unwrap).collect(); | 106 | self.entries = entries.into_iter().map(Result::unwrap).collect(); |
107 | self.entries.sort_by(|a, b| b.published.cmp(&a.published)); | ||
107 | 108 | ||
108 | Ok(pull_status) | 109 | Ok(pull_status) |
109 | } | 110 | } |
@@ -166,16 +167,16 @@ impl fmt::Display for Entry { | |||
166 | f, | 167 | f, |
167 | "{} {} {}", | 168 | "{} {} {}", |
168 | self.published.format(crate::DATE_FMT), | 169 | self.published.format(crate::DATE_FMT), |
170 | Style::new().dimmed().paint(self.title.to_ascii_lowercase()), | ||
169 | Style::new().fg(Color::Cyan).paint( | 171 | Style::new().fg(Color::Cyan).paint( |
170 | self.link | 172 | self.link |
171 | .as_str() | 173 | .as_str() |
172 | .trim_end_matches('/') | 174 | .trim_end_matches('/') |
173 | .trim_start_matches("http://") | ||
174 | .trim_start_matches("https://") | ||
175 | .trim_start_matches("http://www.") | 175 | .trim_start_matches("http://www.") |
176 | .trim_start_matches("https://www.") | 176 | .trim_start_matches("https://www.") |
177 | .trim_start_matches("https://") | ||
178 | .trim_start_matches("http://") | ||
177 | ), | 179 | ), |
178 | Style::new().dimmed().paint(self.title.to_ascii_lowercase()), | ||
179 | ) | 180 | ) |
180 | } | 181 | } |
181 | } | 182 | } |