From 1de53730bce0bd3f9de89db1da7c19b7889b9a75 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 27 Jan 2023 12:04:23 +0100 Subject: Symbol values and modules --- library/src/lib.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'library/src/lib.rs') diff --git a/library/src/lib.rs b/library/src/lib.rs index bdb2cc90..76245b9e 100644 --- a/library/src/lib.rs +++ b/library/src/lib.rs @@ -17,13 +17,14 @@ use self::layout::LayoutRoot; /// Construct the standard library. pub fn build() -> Library { - let math = math::module(); - let global = global(math.clone()); + let sym = text::sym(); + let math = math::module(&sym); + let global = global(sym, math.clone()); Library { global, math, styles: styles(), items: items() } } /// Construct the module with global definitions. -fn global(math: Module) -> Module { +fn global(sym: Module, math: Module) -> Module { let mut global = Scope::deduplicating(); // Basics. @@ -36,7 +37,6 @@ fn global(math: Module) -> Module { // Text. global.def_func::("text"); global.def_func::("linebreak"); - global.def_func::("symbol"); global.def_func::("smartquote"); global.def_func::("strong"); global.def_func::("emph"); @@ -49,6 +49,8 @@ fn global(math: Module) -> Module { global.def_func::("strike"); global.def_func::("overline"); global.def_func::("raw"); + global.define("sym", sym); + global.define("emoji", text::emoji()); // Math. global.define("math", math); @@ -169,7 +171,6 @@ fn items() -> LangItems { text: |text| text::TextNode(text).pack(), text_id: NodeId::of::(), text_str: |content| Some(&content.to::()?.0), - symbol: |notation| text::SymbolNode(notation).pack(), smart_quote: |double| text::SmartQuoteNode { double }.pack(), parbreak: || layout::ParbreakNode.pack(), strong: |body| text::StrongNode(body).pack(), -- cgit v1.2.3