markdown_compiler/
model.rs1use crate::{LogicalContentPath, PostCollection};
2
3#[derive(Clone, Debug)]
4pub struct PublicationSource<'source> {
5 pub path: LogicalContentPath,
6 pub contents: &'source str,
7}
8
9impl<'source> PublicationSource<'source> {
10 pub fn new(path: impl Into<String>, contents: &'source str) -> Self {
11 Self {
12 path: LogicalContentPath::new(path),
13 contents,
14 }
15 }
16}
17
18#[derive(Clone, Debug)]
19pub struct PostSource<'source> {
20 pub path: LogicalContentPath,
21 pub contents: &'source str,
22 pub collection: PostCollection,
23}
24
25impl<'source> PostSource<'source> {
26 pub fn in_posts(path: impl Into<String>, contents: &'source str) -> Self {
27 Self {
28 path: LogicalContentPath::new(path),
29 contents,
30 collection: PostCollection::Posts,
31 }
32 }
33
34 pub fn in_drafts(path: impl Into<String>, contents: &'source str) -> Self {
35 Self {
36 path: LogicalContentPath::new(path),
37 contents,
38 collection: PostCollection::Drafts,
39 }
40 }
41}