diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-10-13 13:10:21 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-10-13 13:10:21 +0200 |
| commit | 7c0899b5373cdc4f1083a0a8515856207c431423 (patch) | |
| tree | ee1ecade4022f1fa3f666feb55097f7bdcae69ed /src/lib.rs | |
| parent | 5c04185892947969005ffcf6412d7190dafb3a79 (diff) | |
Run rustfmt 🚿
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 48 |
1 files changed, 26 insertions, 22 deletions
@@ -1,26 +1,28 @@ //! The compiler for the _Typst_ typesetting language. //! //! # Steps -//! - **Parsing:** The parsing step first transforms a plain string into an [iterator of -//! tokens](crate::parsing::Tokens). Then parser constructs a syntax tree from the token stream. -//! The structures describing the tree can be found in the [syntax]. Dynamic functions parse -//! their own bodies themselves. -//! - **Layouting:** The next step is to transform the syntax tree into a portable representation of -//! the typesetted document. Types for these can be found in the [layout] module. -//! - **Exporting:** The finished document can then be exported into supported formats. Submodules -//! for the supported formats are located in the [export] module. Currently the only supported -//! format is _PDF_. +//! - **Parsing:** The parsing step first transforms a plain string into an +//! [iterator of tokens](crate::parsing::Tokens). Then parser constructs a +//! syntax tree from the token stream. The structures describing the tree can +//! be found in the [syntax]. Dynamic functions parse their own bodies +//! themselves. +//! - **Layouting:** The next step is to transform the syntax tree into a +//! portable representation of the typesetted document. Types for these can be +//! found in the [layout] module. +//! - **Exporting:** The finished document can then be exported into supported +//! formats. Submodules for the supported formats are located in the [export] +//! module. Currently the only supported format is _PDF_. pub extern crate toddle; use std::cell::RefCell; -use toddle::query::{FontLoader, SharedFontLoader, FontProvider}; +use toddle::query::{FontLoader, FontProvider, SharedFontLoader}; use crate::func::Scope; -use crate::parsing::{parse, ParseContext, ParseResult, ParseError}; use crate::layout::{layout_tree, LayoutContext, MultiLayout}; -use crate::layout::{LayoutSpace, Alignment, LayoutError, LayoutResult}; +use crate::layout::{Alignment, LayoutError, LayoutResult, LayoutSpace}; +use crate::parsing::{parse, ParseContext, ParseError, ParseResult}; use crate::style::{PageStyle, TextStyle}; use crate::syntax::SyntaxTree; @@ -29,12 +31,11 @@ mod macros; pub mod export; pub mod func; pub mod layout; +pub mod library; pub mod parsing; pub mod size; pub mod style; pub mod syntax; -pub mod library; - /// Transforms source code into typesetted documents. /// @@ -73,7 +74,8 @@ impl<'p> Typesetter<'p> { /// Add a font provider to the context of this typesetter. #[inline] - pub fn add_font_provider<P: 'p>(&mut self, provider: P) where P: FontProvider { + pub fn add_font_provider<P: 'p>(&mut self, provider: P) + where P: FontProvider { self.loader.get_mut().add_provider(provider); } @@ -98,12 +100,15 @@ impl<'p> Typesetter<'p> { shrink_to_fit: false, }; - let pages = layout_tree(&tree, LayoutContext { - loader: &self.loader, - style: &self.text_style, - space, - extra_space: Some(space), - })?; + let pages = layout_tree( + &tree, + LayoutContext { + loader: &self.loader, + style: &self.text_style, + space, + extra_space: Some(space), + }, + )?; Ok(pages) } @@ -116,7 +121,6 @@ impl<'p> Typesetter<'p> { } } - /// The general error type for typesetting. pub enum TypesetError { /// An error that occured while parsing. |
