Remove basics section

This commit is contained in:
Laurenz 2023-02-07 12:10:52 +01:00
parent a0674990d3
commit 1d5bf56e58
12 changed files with 40 additions and 51 deletions

View File

@ -126,8 +126,7 @@ fn reference_page(resolver: &dyn Resolver) -> PageModel {
markdown_page(resolver, "/docs/reference/", "reference/styling.md"), markdown_page(resolver, "/docs/reference/", "reference/styling.md"),
markdown_page(resolver, "/docs/reference/", "reference/scripting.md"), markdown_page(resolver, "/docs/reference/", "reference/scripting.md"),
types_page(resolver, "/docs/reference/"), types_page(resolver, "/docs/reference/"),
category_page(resolver, "basics").with_part("Content"), category_page(resolver, "text").with_part("Content"),
category_page(resolver, "text"),
category_page(resolver, "math"), category_page(resolver, "math"),
category_page(resolver, "layout"), category_page(resolver, "layout"),
category_page(resolver, "visualize"), category_page(resolver, "visualize"),

View File

@ -12,11 +12,8 @@ types: |
In some places of Typst more specialized data types are used. Instead of listing In some places of Typst more specialized data types are used. Instead of listing
all of them here, they are explained where they are relevant. all of them here, they are explained where they are relevant.
basics: |
Basic structural elements of documents.
text: | text: |
Style and transform your text. Text styling.
The [text function]($func/text) is of particular interest. The [text function]($func/text) is of particular interest.
@ -87,21 +84,21 @@ math: |
affected by these rules. affected by these rules.
layout: | layout: |
Arrange elements on the page. Arranging elements on the page in different ways.
Combine layout functions to create complex and automatic layouts. By combining layout functions, you can create complex and automatic layouts.
visualize: | visualize: |
Draw and visualize data. Drawing and data visualization.
_Note:_ Functions for plotting and diagrams are not yet available. They will _Note:_ Functions for plotting and diagrams are not yet available. They will
be in the future. be in the future.
meta: | meta: |
Modify and use document metadata. Document structuring and metadata setup.
Here, you can also find functions to work with other elements in the document, Here, you can find functions to structure your document and configure its
such as labels and headings. metadata.
symbols: | symbols: |
These two modules give names to symbols and emoji to make them easy to insert These two modules give names to symbols and emoji to make them easy to insert
@ -111,34 +108,34 @@ symbols: |
because they also affect spacing and font style. because they also affect spacing and font style.
sym: | sym: |
Insert general symbols by name. Named general symbols.
For example, `#sym.arrow` produces the → symbol. Within For example, `#sym.arrow` produces the → symbol. Within
[formulas]($category/math), these symbols can be used without the `#sym.` [formulas]($category/math), these symbols can be used without the `#sym.`
prefix. prefix.
emoji: | emoji: |
Insert emoji by name. Named emoji.
For example, `#emoji.face` produces the 😀 emoji. If you frequently use For example, `#emoji.face` produces the 😀 emoji. If you frequently use
certain emojis, you can also import them from the `emoji` module (`[#import certain emojis, you can also import them from the `emoji` module (`[#import
emoji: face]`) to use them without the `#emoji.` prefix. emoji: face]`) to use them without the `#emoji.` prefix.
foundations: | foundations: |
Foundational functions. Foundational functions for computation.
calculate: | calculate: |
Calculate with and process numeric values. Calculations and processing of numeric values.
These functions are part of the `calc` module and not imported by default. In These functions are part of the `calc` module and not imported by default. In
addition to the functions listed below, the `calc` module also defines the addition to the functions listed below, the `calc` module also defines the
constants `pi`, `e`, `inf`, and `nan`. constants `pi`, `e`, `inf`, and `nan`.
construct: | construct: |
Construct and convert between values of different types. Construction of and conversions between values of different types.
data-loading: | data-loading: |
Load data from external files. Data loading from external files.
These functions help you with embedding data from experiments and APIs in your These functions help you with embedding data from experiments and APIs in your
documents. documents.

View File

@ -1,14 +0,0 @@
//! Common document elements.
#[path = "enum.rs"]
mod enum_;
mod heading;
mod list;
mod table;
mod terms;
pub use self::enum_::*;
pub use self::heading::*;
pub use self::list::*;
pub use self::table::*;
pub use self::terms::*;

View File

@ -80,7 +80,7 @@ use crate::prelude::*;
/// ``` /// ```
/// ///
/// ## Category /// ## Category
/// basics /// layout
#[func] #[func]
#[capable(Layout)] #[capable(Layout)]
#[derive(Debug, Hash)] #[derive(Debug, Hash)]

View File

@ -63,7 +63,7 @@ use crate::text::TextNode;
/// ``` /// ```
/// ///
/// ## Category /// ## Category
/// basics /// layout
#[func] #[func]
#[capable(Layout)] #[capable(Layout)]
#[derive(Debug, Hash)] #[derive(Debug, Hash)]

View File

@ -3,9 +3,12 @@
mod align; mod align;
mod columns; mod columns;
mod container; mod container;
#[path = "enum.rs"]
mod enum_;
mod flow; mod flow;
mod grid; mod grid;
mod hide; mod hide;
mod list;
mod pad; mod pad;
mod page; mod page;
mod par; mod par;
@ -13,14 +16,18 @@ mod place;
mod repeat; mod repeat;
mod spacing; mod spacing;
mod stack; mod stack;
mod table;
mod terms;
mod transform; mod transform;
pub use self::align::*; pub use self::align::*;
pub use self::columns::*; pub use self::columns::*;
pub use self::container::*; pub use self::container::*;
pub use self::enum_::*;
pub use self::flow::*; pub use self::flow::*;
pub use self::grid::*; pub use self::grid::*;
pub use self::hide::*; pub use self::hide::*;
pub use self::list::*;
pub use self::pad::*; pub use self::pad::*;
pub use self::page::*; pub use self::page::*;
pub use self::par::*; pub use self::par::*;
@ -28,6 +35,8 @@ pub use self::place::*;
pub use self::repeat::*; pub use self::repeat::*;
pub use self::spacing::*; pub use self::spacing::*;
pub use self::stack::*; pub use self::stack::*;
pub use self::table::*;
pub use self::terms::*;
pub use self::transform::*; pub use self::transform::*;
use std::mem; use std::mem;
@ -40,7 +49,6 @@ use typst::model::{
StyleVecBuilder, StyledNode, StyleVecBuilder, StyledNode,
}; };
use crate::basics::{EnumNode, ListNode, TermItem, TermsNode};
use crate::math::{FormulaNode, LayoutMath}; use crate::math::{FormulaNode, LayoutMath};
use crate::meta::DocumentNode; use crate::meta::DocumentNode;
use crate::prelude::*; use crate::prelude::*;

View File

@ -57,7 +57,7 @@ use crate::prelude::*;
/// See the [grid documentation]($func/grid) for more information on gutters. /// See the [grid documentation]($func/grid) for more information on gutters.
/// ///
/// ## Category /// ## Category
/// basics /// layout
#[func] #[func]
#[capable(Layout)] #[capable(Layout)]
#[derive(Debug, Hash)] #[derive(Debug, Hash)]

View File

@ -53,7 +53,7 @@ use crate::text::{SpaceNode, TextNode};
/// ``` /// ```
/// ///
/// ## Category /// ## Category
/// basics /// layout
#[func] #[func]
#[capable(Layout)] #[capable(Layout)]
#[derive(Debug, Hash)] #[derive(Debug, Hash)]

View File

@ -1,6 +1,5 @@
//! Typst's standard library. //! Typst's standard library.
pub mod basics;
pub mod compute; pub mod compute;
pub mod layout; pub mod layout;
pub mod math; pub mod math;
@ -28,13 +27,6 @@ pub fn build() -> Library {
fn global(math: Module, calc: Module) -> Module { fn global(math: Module, calc: Module) -> Module {
let mut global = Scope::deduplicating(); let mut global = Scope::deduplicating();
// Basics.
global.def_func::<basics::HeadingNode>("heading");
global.def_func::<basics::ListNode>("list");
global.def_func::<basics::EnumNode>("enum");
global.def_func::<basics::TermsNode>("terms");
global.def_func::<basics::TableNode>("table");
// Text. // Text.
global.def_func::<text::TextNode>("text"); global.def_func::<text::TextNode>("text");
global.def_func::<text::LinebreakNode>("linebreak"); global.def_func::<text::LinebreakNode>("linebreak");
@ -63,6 +55,10 @@ fn global(math: Module, calc: Module) -> Module {
global.def_func::<layout::HNode>("h"); global.def_func::<layout::HNode>("h");
global.def_func::<layout::BoxNode>("box"); global.def_func::<layout::BoxNode>("box");
global.def_func::<layout::BlockNode>("block"); global.def_func::<layout::BlockNode>("block");
global.def_func::<layout::ListNode>("list");
global.def_func::<layout::EnumNode>("enum");
global.def_func::<layout::TermsNode>("terms");
global.def_func::<layout::TableNode>("table");
global.def_func::<layout::StackNode>("stack"); global.def_func::<layout::StackNode>("stack");
global.def_func::<layout::GridNode>("grid"); global.def_func::<layout::GridNode>("grid");
global.def_func::<layout::ColumnsNode>("columns"); global.def_func::<layout::ColumnsNode>("columns");
@ -89,6 +85,7 @@ fn global(math: Module, calc: Module) -> Module {
global.def_func::<meta::RefNode>("ref"); global.def_func::<meta::RefNode>("ref");
global.def_func::<meta::LinkNode>("link"); global.def_func::<meta::LinkNode>("link");
global.def_func::<meta::OutlineNode>("outline"); global.def_func::<meta::OutlineNode>("outline");
global.def_func::<meta::HeadingNode>("heading");
// Symbols. // Symbols.
global.define("sym", symbols::sym()); global.define("sym", symbols::sym());
@ -185,11 +182,11 @@ fn items() -> LangItems {
}, },
link: |url| meta::LinkNode::from_url(url).pack(), link: |url| meta::LinkNode::from_url(url).pack(),
ref_: |target| meta::RefNode(target).pack(), ref_: |target| meta::RefNode(target).pack(),
heading: |level, body| basics::HeadingNode { level, title: body }.pack(), heading: |level, body| meta::HeadingNode { level, title: body }.pack(),
list_item: |body| layout::ListItem::List(body).pack(), list_item: |body| layout::ListItem::List(body).pack(),
enum_item: |number, body| layout::ListItem::Enum(number, body).pack(), enum_item: |number, body| layout::ListItem::Enum(number, body).pack(),
term_item: |term, description| { term_item: |term, description| {
layout::ListItem::Term(basics::TermItem { term, description }).pack() layout::ListItem::Term(layout::TermItem { term, description }).pack()
}, },
formula: |body, block| math::FormulaNode { body, block }.pack(), formula: |body, block| math::FormulaNode { body, block }.pack(),
math_align_point: || math::AlignPointNode.pack(), math_align_point: || math::AlignPointNode.pack(),

View File

@ -47,7 +47,7 @@ use crate::text::{SpaceNode, TextNode, TextSize};
/// The logical nesting depth of the heading, starting from one. /// The logical nesting depth of the heading, starting from one.
/// ///
/// ## Category /// ## Category
/// basics /// meta
#[func] #[func]
#[capable(Prepare, Show, Finalize)] #[capable(Prepare, Show, Finalize)]
#[derive(Debug, Hash)] #[derive(Debug, Hash)]

View File

@ -1,11 +1,13 @@
//! Interaction between document parts. //! Interaction between document parts.
mod document; mod document;
mod heading;
mod link; mod link;
mod reference;
mod outline; mod outline;
mod reference;
pub use self::document::*; pub use self::document::*;
pub use self::outline::*; pub use self::heading::*;
pub use self::link::*; pub use self::link::*;
pub use self::outline::*;
pub use self::reference::*; pub use self::reference::*;

View File

@ -1,4 +1,4 @@
use crate::basics::HeadingNode; use super::HeadingNode;
use crate::layout::{BlockNode, HNode, HideNode, RepeatNode, Spacing}; use crate::layout::{BlockNode, HNode, HideNode, RepeatNode, Spacing};
use crate::prelude::*; use crate::prelude::*;
use crate::text::{LinebreakNode, SpaceNode, TextNode}; use crate::text::{LinebreakNode, SpaceNode, TextNode};