From 261ef9e33a8548d4b7aa53e69e71866648982ae8 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 16 Nov 2019 10:37:30 +0100 Subject: =?UTF-8?q?Generalize=20tree=20layouter=20=F0=9F=8C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/library/structure.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/library') diff --git a/src/library/structure.rs b/src/library/structure.rs index e6d242a0..2bcd2744 100644 --- a/src/library/structure.rs +++ b/src/library/structure.rs @@ -1,30 +1,36 @@ use crate::func::prelude::*; use Command::*; -/// 📜 `page.break`: Ends the current page. +/// ↩ `line.break`, `n`: Ends the current line. #[derive(Debug, PartialEq)] -pub struct Pagebreak; +pub struct Linebreak; function! { - data: Pagebreak, + data: Linebreak, parse: plain, - - layout(_, _) { - Ok(commands![FinishLayout]) - } + layout(_, _) { Ok(commands![FinishFlexRun]) } } -/// 🔙 `line.break`, `n`: Ends the current line. +/// ↕ `paragraph.break`: Ends the current paragraph. +/// +/// This has the same effect as two subsequent newlines. #[derive(Debug, PartialEq)] -pub struct Linebreak; +pub struct Parbreak; function! { - data: Linebreak, + data: Parbreak, parse: plain, + layout(_, _) { Ok(commands![FinishFlexLayout]) } +} - layout(_, _) { - Ok(commands![FinishFlexRun]) - } +/// 📜 `page.break`: Ends the current page. +#[derive(Debug, PartialEq)] +pub struct Pagebreak; + +function! { + data: Pagebreak, + parse: plain, + layout(_, _) { Ok(commands![FinishLayout]) } } /// 📐 `align`: Aligns content in different ways. -- cgit v1.2.3