rustwell 0.1.0

A library for parsing and compiling fountain screenplay scripts.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::io::Write;

use typst_pdf::PdfOptions;

use crate::{export::typst::compile_document, screenplay::Screenplay};

/// Exports a `pdf` file and writes it to the provided writer. This is done by first constructing
/// a [typst] document and then, using [typst], exporting that to an actual `pdf` document.
pub fn export_pdf(screenplay: &Screenplay, mut writer: impl Write, synopses: bool) {
    let compiled_doc = compile_document(screenplay, synopses);
    let pdf = typst_pdf::pdf(&compiled_doc, &PdfOptions::default()).expect("Error generating PDF");
    writer.write_all(&pdf).expect("Error writing PDF");
}