mirror of
https://github.com/lise-henry/crowbook
synced 2024-11-18 00:13:55 +01:00
54ca041d5a
- Book::new takes an additional `options` parameter. - Book::new_from_file_with_options becomes `new_from_file`, which got deleted. This way, each constructor takes an `options` parameter (which can be set to `&[]` for default options), allowing derived constructors to not replicate the setting options code.
18 lines
582 B
Rust
18 lines
582 B
Rust
extern crate crowbook;
|
|
use crowbook::{Book, InfoLevel};
|
|
use std::io;
|
|
|
|
#[test]
|
|
fn test_book() {
|
|
let book = Book::new_from_file(&format!("{}/{}", env!("CARGO_MANIFEST_DIR"), "tests/test.book"), InfoLevel::Error, &[]).unwrap();
|
|
book.render_html(&mut io::sink()).unwrap();
|
|
book.render_tex(&mut io::sink()).unwrap();
|
|
}
|
|
|
|
#[test]
|
|
fn book_example() {
|
|
let book = Book::new_from_file(&format!("{}/{}", env!("CARGO_MANIFEST_DIR"), "config.book"), InfoLevel::Error, &[]).unwrap();
|
|
book.render_html(&mut io::sink()).unwrap();
|
|
book.render_tex(&mut io::sink()).unwrap();
|
|
}
|