oxedyne/fe2o3/fe2o3_austenite/src/eval/lib/model/divider.rs
1.2 KiB, 1 run
created by r1870400018:63252, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Original work copyright (c) the Typst project authors (typst-library `model/divider.rs`, version 0.15.1). |
| 3 | // Modified for Austenite: the element's fields, defaults and default show, ported to Hematite's types, IR and error handling. |
| 4 | // The model family (U5's directory): divider. Typst's thematic break shows as a bare `line`; its full |
| 5 | // width, its 0.05em stroke and the 2em of block space around it are the element's built-in show-set styles, |
| 6 | // so `show divider: set line(..)` restyles it as in Typst. |
| 7 | |
| 8 | use crate::eval::content::{ |
| 9 | Content, |
| 10 | ElemKind, |
| 11 | }; |
| 12 | use crate::eval::lib::model::common; |
| 13 | use crate::eval::styles::Styles; |
| 14 | use crate::eval::value::{ |
| 15 | Length, |
| 16 | Ratio, |
| 17 | Relative, |
| 18 | Value, |
| 19 | }; |
| 20 | |
| 21 | use oxedyne_fe2o3_core::prelude::*; |
| 22 | |
| 23 | pub fn show_set() -> Outcome<Styles> { |
| 24 | common::props(vec![ |
| 25 | (ElemKind::Block, "above", common::em(2.0)), |
| 26 | (ElemKind::Block, "below", common::em(2.0)), |
| 27 | (ElemKind::Line, "length", Value::Relative(Relative { abs: Length::zero(), rel: Ratio(1.0) })), |
| 28 | (ElemKind::Line, "stroke", common::em(0.05)), |
| 29 | ]) |
| 30 | } |
| 31 | |
| 32 | pub fn show(elem: &Content) -> Outcome<Option<Content>> { |
| 33 | Ok(Some(Content::new(ElemKind::Line, Vec::new(), elem.span()))) |
| 34 | } |