[][src]Struct bookbinder_ast::BookSrcBuilder

pub struct BookSrcBuilder<'a> { /* fields omitted */ }

The source for a particular book; essentially a way to create a BookSrc using a builder pattern.

Example usage

use bookbinder_ast::BookSrcBuilder;

let processed = BookSrcBuilder::new("Book Title")
    .subtitle("Being the Memoirs of Book Author")
    .author("Book Author")
    .set_dedication("To Someone")
    .publisher("Publisher Name")
    .add_mainmatter("# I am born\n\nThe day of my birth (the 22^nd^ of January) was a dark cold day...")
    .add_mainmatter("# I grow up\n\nI grew strong and I grew tall. I remember my uncle who left the farm after some wild quarrel and rode off whistling on his sorrel.")
    .add_acknowledgements("This was of course a very serious and highly researched work", Some("Author's Note"))
    .process();
// now the processed work can be rendered to a particular output format from a combination of metadata and book events.

Implementations

impl<'a> BookSrcBuilder<'a>[src]

pub fn new<S: Into<Cow<'a, str>>>(title: S) -> Self[src]

Begin building a new book with title

pub fn do_not_generate_halftitle(&mut self) -> &mut Self[src]

Do not include a halftitle if it has not been explicitly set

pub fn do_not_generate_titlepage(&mut self) -> &mut Self[src]

Do not generate a titlepage if it has not been explicitly set

pub fn do_not_generate_copyrightpage(&mut self) -> &mut Self[src]

Do not generate a copyright page if it has not been explicitly set

Set the copyright page of this book explicitly; if this is not set, it will be generated from metadata unless do_not_generate_copyrightpage was called.

Set the copyright page from a file

pub fn author<A: ContributorSource<'a>>(&mut self, val: A) -> &mut Self[src]

Add an author or authors

pub fn translator<A: ContributorSource<'a>>(&mut self, val: A) -> &mut Self[src]

Add a translator or translators

pub fn editor<A: ContributorSource<'a>>(&mut self, val: A) -> &mut Self[src]

Add an editor or editors

pub fn cover_designer<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

Name the cover designer of this work

pub fn shorttitle<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

Set the short title, a briefer version of the title used where a full title might be unneccesarily verbose

pub fn subtitle<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

Set the work's subtitle

Name the copyright holder in any author photograph included in the work or on the covers

pub fn paperback_isbn<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

An isbn for the paperback edition of this book

pub fn hardback_isbn<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

An isbn for the hardback edition of this book

pub fn epub_isbn<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

An isbn for the epub edition of this book

pub fn publisher<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

The name of the publisher of this book

pub fn publisher_address<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

An address for the publisher

pub fn publisher_url<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

A url for the publisher

pub fn print_location<S: Into<Cow<'a, str>>>(&mut self, val: S) -> &mut Self[src]

State where the work will be printed

pub fn copyright_statement<S: Into<Cow<'a, str>>>(
    &mut self,
    val: S
) -> &mut Self
[src]

Set a custom copyright statement

pub fn do_not_assert_moral_rights(&mut self) -> &mut Self[src]

Set this flag if you do not wish to assert the moral rights of the author on the copyright page

pub fn is_not_first_publication(&mut self) -> &mut Self[src]

Set this flag if this is not the book's first publication

pub fn set_halftitle<S: ParseHelper<'a>>(&mut self, halftitle: S) -> &mut Self[src]

Specifically set the halftitle of this work, rather than relying on its generation from metadata.

pub fn set_dedication<S: ParseHelper<'a>>(&mut self, dedication: S) -> &mut Self[src]

Set the work's dedication, a brief inscription to a person or note of thanks. Longer thanks should be added as an acknowledgement.

pub fn set_colophon<S: ParseHelper<'a>>(&mut self, colophon: S) -> &mut Self[src]

Set the work's colophon, a block of inline text with simple information about its production or licensing.

pub fn add_foreword<P, A>(
    &mut self,
    text: P,
    title: Option<P>,
    authors: A
) -> &mut Self where
    A: ContributorSource<'a>,
    P: ParseHelper<'a>, 
[src]

Add a foreword, with an optional title and authors. If no title is set but the text of the foreword begins with a title, this will be used instead.

pub fn add_foreword_from_file<A, P>(
    &mut self,
    filepath: P,
    authors: A
) -> Result<&mut Self, Error> where
    A: ContributorSource<'a>,
    P: AsRef<Path>, 
[src]

Add a foreword from a file

pub fn add_afterword<P, A>(
    &mut self,
    text: P,
    title: Option<P>,
    authors: A
) -> &mut Self where
    A: ContributorSource<'a>,
    P: ParseHelper<'a>, 
[src]

Add an afterword, with an optional title and authors. If no title is set but the text of the afterword begins with a title, this will be used instead.

pub fn add_afterword_from_file<A, P>(
    &mut self,
    filepath: P,
    authors: A
) -> Result<&mut Self, Error> where
    A: ContributorSource<'a>,
    P: AsRef<Path>, 
[src]

Add an afterword from a file

pub fn add_introduction<P, A>(
    &mut self,
    text: P,
    title: Option<P>,
    authors: A
) -> &mut Self where
    A: ContributorSource<'a>,
    P: ParseHelper<'a>, 
[src]

Add an introduction, with an optional title and authors. If no title is set but the text of the introduction begins with a title, this will be used instead.

pub fn add_introduction_from_file<A, P>(
    &mut self,
    filepath: P,
    authors: A
) -> Result<&mut Self, Error> where
    A: ContributorSource<'a>,
    P: AsRef<Path>, 
[src]

Add an introduction from a file

pub fn add_preface<P>(&mut self, text: P, title: Option<P>) -> &mut Self where
    P: ParseHelper<'a>, 
[src]

Add a preface

pub fn add_preface_from_file<P, S>(
    &mut self,
    filepath: P,
    title: Option<S>
) -> Result<&mut Self, Error> where
    P: AsRef<Path>,
    S: ToString
[src]

Add a preface from a file

pub fn add_acknowledgements<P>(
    &mut self,
    text: P,
    title: Option<P>
) -> &mut Self where
    P: ParseHelper<'a>, 
[src]

Add acknowledgements or an author's note

pub fn add_acknowledgements_from_file<P, S>(
    &mut self,
    filepath: P,
    title: Option<S>
) -> Result<&mut Self, Error> where
    P: AsRef<Path>,
    S: ToString
[src]

Add acknowledgements from a file

pub fn add_appendix<P>(&mut self, text: P, title: Option<P>) -> &mut Self where
    P: ParseHelper<'a>, 
[src]

Add an appendix

pub fn add_appendix_from_file<P, S>(
    &mut self,
    filepath: P,
    title: Option<S>
) -> Result<&mut Self, Error> where
    P: AsRef<Path>,
    S: ToString
[src]

Add an appendix from a file

pub fn add_mainmatter<P: ParseHelper<'a>>(&mut self, text: P) -> &mut Self[src]

Add a fragment of mainmatter

pub fn add_mainmatter_from_file<P: AsRef<Path>>(
    &mut self,
    filepath: P
) -> Result<&mut Self, Error>
[src]

Add a fragment of mainmatter from a file

pub fn add_epigraph<P1, P2>(
    &mut self,
    text: P1,
    source: Option<P2>
) -> &mut Self where
    P1: ParseHelper<'a>,
    P2: ParseHelper<'a>, 
[src]

Add an epigraph

pub fn add_explicit_epigraph<P: ParseHelper<'a>>(
    &mut self,
    text: P,
    author: Option<&str>,
    title_of_source: Option<&str>,
    quote_title: bool
) -> &mut Self
[src]

Add an epigraph where the source is generated; it will default to representing the author of the epigraph's source in small caps, and the title of the epigraph's source in italics or in single quotes if quote_title is true

pub fn process(&mut self) -> BookSrc<'a>[src]

Finish processing this book, generate missing sections such as a titlepage (unless they have been suppressed), do some tidying like normalising image paths and return a BookSrc ready for rendering

Trait Implementations

impl<'a> Clone for BookSrcBuilder<'a>[src]

impl<'a> Debug for BookSrcBuilder<'a>[src]

impl<'a> Default for BookSrcBuilder<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for BookSrcBuilder<'a>

impl<'a> Send for BookSrcBuilder<'a>

impl<'a> Sync for BookSrcBuilder<'a>

impl<'a> Unpin for BookSrcBuilder<'a>

impl<'a> UnwindSafe for BookSrcBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,