diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-01-27 12:04:23 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-01-27 12:04:36 +0100 |
| commit | 1de53730bce0bd3f9de89db1da7c19b7889b9a75 (patch) | |
| tree | e2746f4853a5a8e99f32e8c52d6e4b4f411c1933 /library/src/lib.rs | |
| parent | 13efa128c855637a7fe3351a4579383359d1be1b (diff) | |
Symbol values and modules
Diffstat (limited to 'library/src/lib.rs')
| -rw-r--r-- | library/src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
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::TextNode>("text"); global.def_func::<text::LinebreakNode>("linebreak"); - global.def_func::<text::SymbolNode>("symbol"); global.def_func::<text::SmartQuoteNode>("smartquote"); global.def_func::<text::StrongNode>("strong"); global.def_func::<text::EmphNode>("emph"); @@ -49,6 +49,8 @@ fn global(math: Module) -> Module { global.def_func::<text::StrikeNode>("strike"); global.def_func::<text::OverlineNode>("overline"); global.def_func::<text::RawNode>("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::TextNode>(), text_str: |content| Some(&content.to::<text::TextNode>()?.0), - symbol: |notation| text::SymbolNode(notation).pack(), smart_quote: |double| text::SmartQuoteNode { double }.pack(), parbreak: || layout::ParbreakNode.pack(), strong: |body| text::StrongNode(body).pack(), |
