Struct epub_builder::EpubContent
[−]
[src]
pub struct EpubContent<R: Read> { pub toc: TocElement, pub content: R, }
Represents a XHTML file that can be added to an EPUB document.
This struct is designed to be used with the add_content method
of the `EpubBuilder.
Example
use epub_builder::{EpubContent, TocElement}; let page_content = "Some XHTML content"; // Creates a new EpubContent let content = EpubContent::new("intro.xhtml", page_content.as_bytes()) // ... and sets a title so it is added to the TOC .title("Introduction") // ... and add some toc information on the document structure .child(TocElement::new("intro.xhtml#1", "Section 1")) .child(TocElement::new("intro.xhtml#2", "Section 2"));
Fields
toc: TocElement
The title and url, plus sublevels
content: R
The content
Methods
impl<R: Read> EpubContent<R>[src]
fn new<S: Into<String>>(href: S, content: R) -> Self
Creates a new EpubContent
By default, this element is at level 1, and it has no title
(meaning it won't be added to the Table of Contents.
fn title<S: Into<String>>(self, title: S) -> Self
Set the title of this content. If no title is set, this part of the book will not be displayed in the table of content.
fn level(self, level: i32) -> Self
Set the level
fn child(self, elem: TocElement) -> Self
Adds a sublevel to the toc