diff options
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -59,16 +59,33 @@ use crate::layout::Frame; use crate::loading::Loader; /// Process source code directly into a collection of layouted frames. +/// +/// # Parameters +/// - The `loader` is used to load fonts, images and other source files. +/// - The `cache` stores things that are reusable across several compilations +/// like loaded fonts, decoded images and layouting artifacts. +/// - The `path` should point to the source file if `src` comes from the file +/// system and is used to resolve relative paths (for importing and image +/// loading). +/// - The `src` is the _Typst_ source code to typeset. +/// - The `scope` contains definitions that are available everywhere, +/// typically the standard library. +/// - The `state` defines initial properties for page size, font selection and +/// so on. +/// +/// # Return value +/// Returns a vector of frames representing individual pages alongside +/// diagnostic information (errors and warnings). pub fn typeset( loader: &mut dyn Loader, cache: &mut Cache, - path: &Path, + path: Option<&Path>, src: &str, - base: &Scope, + scope: &Scope, state: State, ) -> Pass<Vec<Frame>> { let parsed = parse::parse(src); - let evaluated = eval::eval(loader, cache, path, Rc::new(parsed.output), base); + let evaluated = eval::eval(loader, cache, path, Rc::new(parsed.output), scope); let executed = exec::exec(&evaluated.output.template, state); let layouted = layout::layout(loader, cache, &executed.output); |
