diff options
Diffstat (limited to 'src/posts/fs_post.rs')
-rw-r--r-- | src/posts/fs_post.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/posts/fs_post.rs b/src/posts/fs_post.rs index 8b8e725..8f1a435 100644 --- a/src/posts/fs_post.rs +++ b/src/posts/fs_post.rs @@ -21,6 +21,18 @@ impl Post for FsPost { let article = fs::read_to_string(&self.file).unwrap(); Cow::Owned(article) } + + fn get_description(&self) -> Cow<str> { + let article = self.get_article(); + Cow::Owned( + article + .split_once("\n") + .map(|(first, _)| first) + .unwrap_or_default() + .trim_start_matches('_') + .to_owned(), + ) + } } impl Ord for FsPost { |