summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-10-10 23:36:17 +0200
committerLaurenz <laurmaedje@gmail.com>2019-10-10 23:38:03 +0200
commit8f788f9a4f5e970bbe6147987b711470d57aca8d (patch)
treecc89008dfdfc62ecf4eb2517d92ec7c7095fa573 /src/lib.rs
parent61470fba68e9f19b481034427add5f3d8cfbc0a8 (diff)
Add standard `align` function and support right-alignment ➡️
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 1a97c560..cb4be8b4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,7 +20,7 @@ use toddle::query::{FontLoader, SharedFontLoader, FontProvider};
use crate::doc::Document;
use crate::func::Scope;
use crate::parsing::{parse, ParseContext, ParseResult, ParseError};
-use crate::layout::{layout, LayoutContext, LayoutSpace, LayoutError, LayoutResult};
+use crate::layout::{layout, LayoutContext, Alignment, LayoutSpace, LayoutError, LayoutResult};
use crate::layout::boxed::BoxLayout;
use crate::style::{PageStyle, TextStyle};
use crate::syntax::SyntaxTree;
@@ -35,6 +35,7 @@ pub mod parsing;
pub mod size;
pub mod style;
pub mod syntax;
+pub mod library;
/// Transforms source code into typesetted documents.
@@ -92,6 +93,7 @@ impl<'p> Typesetter<'p> {
space: LayoutSpace {
dimensions: self.page_style.dimensions,
padding: self.page_style.margins,
+ alignment: Alignment::Left,
shrink_to_fit: false,
},
})?;
@@ -184,5 +186,6 @@ mod test {
#[test]
fn shakespeare() {
test("shakespeare", include_str!("../test/shakespeare.tps"));
+ test("shakespeare-right", &format!("[align:right][{}]", include_str!("../test/shakespeare.tps")));
}
}