Struct gutenberg::Page
[−]
[src]
pub struct Page { pub file: FileInfo, pub meta: PageFrontMatter, pub raw_content: String, pub assets: Vec<PathBuf>, pub content: String, pub slug: String, pub path: String, pub permalink: String, pub summary: Option<String>, pub previous: Option<Box<Page>>, pub next: Option<Box<Page>>, pub toc: Vec<Header>, }
Fields
file: FileInfo
All info about the actual file
meta: PageFrontMatter
The front matter meta-data
raw_content: String
The actual content of the page, in markdown
assets: Vec<PathBuf>
All the non-md files we found next to the .md file
content: String
The HTML rendered of the page
slug: String
The slug of that page. First tries to find the slug in the meta and defaults to filename otherwise
path: String
The URL path of the page
permalink: String
The full URL for that page
summary: Option<String>
The summary for the article, defaults to None When is found in the text, will take the content up to that part as summary
previous: Option<Box<Page>>
The previous page, by whatever sorting is used for the index/section
next: Option<Box<Page>>
The next page, by whatever sorting is used for the index/section
toc: Vec<Header>
Toc made from the headers of the markdown file
Methods
impl Page
[src]
fn new<P: AsRef<Path>>(file_path: P, meta: PageFrontMatter) -> Page
fn parse(file_path: &Path, content: &str, config: &Config) -> Result<Page>
Parse a page given the content of the .md file Files without front matter or with invalid front matter are considered erroneous
fn from_file<P: AsRef<Path>>(path: P, config: &Config) -> Result<Page>
Read and parse a .md file into a Page struct
fn render_markdown(
&mut self,
permalinks: &HashMap<String, String>,
tera: &Tera,
config: &Config,
anchor_insert: InsertAnchor
) -> Result<()>
&mut self,
permalinks: &HashMap<String, String>,
tera: &Tera,
config: &Config,
anchor_insert: InsertAnchor
) -> Result<()>
We need access to all pages url to render links relative to content so that can't happen at the same time as parsing
fn render_html(
&self,
tera: &Tera,
config: &Config,
section: Option<&Section>
) -> Result<String>
&self,
tera: &Tera,
config: &Config,
section: Option<&Section>
) -> Result<String>
Renders the page using the default layout, unless specified in front-matter
Trait Implementations
impl Clone for Page
[src]
fn clone(&self) -> Page
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Page
[src]
impl PartialEq for Page
[src]
fn eq(&self, __arg_0: &Page) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Page) -> bool
This method tests for !=
.