mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Spelling (#5020)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
parent
3c90878460
commit
ca1f749c08
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -49,7 +49,7 @@ jobs:
|
|||||||
- run: cargo doc --workspace --no-deps
|
- run: cargo doc --workspace --no-deps
|
||||||
|
|
||||||
min-version:
|
min-version:
|
||||||
name: Check mininum Rust version
|
name: Check minimum Rust version
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -59,7 +59,7 @@ impl TermOut {
|
|||||||
// We don't want to clear anything that is not a TTY.
|
// We don't want to clear anything that is not a TTY.
|
||||||
if self.inner.stream.supports_color() {
|
if self.inner.stream.supports_color() {
|
||||||
// First, move the cursor up `lines` lines.
|
// First, move the cursor up `lines` lines.
|
||||||
// Then, clear everything between between the cursor to end of screen.
|
// Then, clear everything between the cursor to end of screen.
|
||||||
let mut stream = self.inner.stream.lock();
|
let mut stream = self.inner.stream.lock();
|
||||||
write!(stream, "\x1B[1F\x1B[0J")?;
|
write!(stream, "\x1B[1F\x1B[0J")?;
|
||||||
stream.flush()?;
|
stream.flush()?;
|
||||||
|
@ -33,7 +33,7 @@ openssl = { workspace = true, optional = true }
|
|||||||
[features]
|
[features]
|
||||||
default = ["fonts", "packages"]
|
default = ["fonts", "packages"]
|
||||||
|
|
||||||
# Add font loading utilitites
|
# Add font loading utilities
|
||||||
fonts = ["dep:fontdb", "fontdb/memmap", "fontdb/fontconfig"]
|
fonts = ["dep:fontdb", "fontdb/memmap", "fontdb/fontconfig"]
|
||||||
|
|
||||||
# Add generic downloading utilities
|
# Add generic downloading utilities
|
||||||
|
@ -161,7 +161,7 @@ impl FontSearcher {
|
|||||||
let path = match &face.source {
|
let path = match &face.source {
|
||||||
Source::File(path) | Source::SharedFile(path, _) => path,
|
Source::File(path) | Source::SharedFile(path, _) => path,
|
||||||
// We never add binary sources to the database, so there
|
// We never add binary sources to the database, so there
|
||||||
// shouln't be any.
|
// shouldn't be any.
|
||||||
Source::Binary(_) => continue,
|
Source::Binary(_) => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
//! - For math: New Computer Modern Math
|
//! - For math: New Computer Modern Math
|
||||||
//! - For code: Deja Vu Sans Mono
|
//! - For code: Deja Vu Sans Mono
|
||||||
//! - [download] contains functionality for making simple web requests with
|
//! - [download] contains functionality for making simple web requests with
|
||||||
//! status reporting, useful for downloading packages from package registires.
|
//! status reporting, useful for downloading packages from package registries.
|
||||||
//! It is enabled by the `downloads` feature flag, additionally the
|
//! It is enabled by the `downloads` feature flag, additionally the
|
||||||
//! `vendor-openssl` can be used on operating systems other than macOS and
|
//! `vendor-openssl` can be used on operating systems other than macOS and
|
||||||
//! Windows to vendor OpenSSL when building.
|
//! Windows to vendor OpenSSL when building.
|
||||||
|
@ -52,13 +52,13 @@ impl PackageStorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a the path at which non-local packages should be stored when
|
/// Returns the path at which non-local packages should be stored when
|
||||||
/// downloaded.
|
/// downloaded.
|
||||||
pub fn package_cache_path(&self) -> Option<&Path> {
|
pub fn package_cache_path(&self) -> Option<&Path> {
|
||||||
self.package_cache_path.as_deref()
|
self.package_cache_path.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a the path at which local packages are stored.
|
/// Returns the path at which local packages are stored.
|
||||||
pub fn package_path(&self) -> Option<&Path> {
|
pub fn package_path(&self) -> Option<&Path> {
|
||||||
self.package_path.as_deref()
|
self.package_path.as_deref()
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ pub fn write_font_descriptor<'a>(
|
|||||||
#[typst_macros::time(name = "subset font")]
|
#[typst_macros::time(name = "subset font")]
|
||||||
fn subset_font(font: &Font, glyph_remapper: &GlyphRemapper) -> Arc<Vec<u8>> {
|
fn subset_font(font: &Font, glyph_remapper: &GlyphRemapper) -> Arc<Vec<u8>> {
|
||||||
let data = font.data();
|
let data = font.data();
|
||||||
// TODO: Fail export instead of unwrapping once export diagnoistics exist.
|
// TODO: Fail export instead of unwrapping once export diagnostics exist.
|
||||||
let subsetted = subsetter::subset(data, font.index(), glyph_remapper).unwrap();
|
let subsetted = subsetter::subset(data, font.index(), glyph_remapper).unwrap();
|
||||||
|
|
||||||
let mut data = subsetted.as_ref();
|
let mut data = subsetted.as_ref();
|
||||||
|
@ -183,7 +183,7 @@ fn encode_alpha(raster: &RasterImage) -> (Vec<u8>, Filter) {
|
|||||||
/// Encode an SVG into a chunk of PDF objects.
|
/// Encode an SVG into a chunk of PDF objects.
|
||||||
#[typst_macros::time(name = "encode svg")]
|
#[typst_macros::time(name = "encode svg")]
|
||||||
fn encode_svg(svg: &SvgImage) -> (Chunk, Ref) {
|
fn encode_svg(svg: &SvgImage) -> (Chunk, Ref) {
|
||||||
// TODO: Don't unwrap once we have export diagostics.
|
// TODO: Don't unwrap once we have export diagnostics.
|
||||||
svg2pdf::to_chunk(svg.tree(), svg2pdf::ConversionOptions::default()).unwrap()
|
svg2pdf::to_chunk(svg.tree(), svg2pdf::ConversionOptions::default()).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ struct PdfChunk {
|
|||||||
/// chunk, and should be remapped.
|
/// chunk, and should be remapped.
|
||||||
///
|
///
|
||||||
/// This is a constant (large enough to avoid collisions) and not
|
/// This is a constant (large enough to avoid collisions) and not
|
||||||
/// dependant on self.alloc to allow for better memoization of steps, if
|
/// dependent on self.alloc to allow for better memoization of steps, if
|
||||||
/// needed in the future.
|
/// needed in the future.
|
||||||
const TEMPORARY_REFS_START: i32 = 1_000_000_000;
|
const TEMPORARY_REFS_START: i32 = 1_000_000_000;
|
||||||
|
|
||||||
|
@ -675,7 +675,7 @@ impl<'a> TermItem<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node! {
|
node! {
|
||||||
/// A mathemathical equation: `$x$`, `$ x^2 $`.
|
/// A mathematical equation: `$x$`, `$ x^2 $`.
|
||||||
Equation
|
Equation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1789,7 +1789,7 @@ impl<'s> Parser<'s> {
|
|||||||
fn next_non_trivia(lexer: &mut Lexer<'s>) -> SyntaxKind {
|
fn next_non_trivia(lexer: &mut Lexer<'s>) -> SyntaxKind {
|
||||||
loop {
|
loop {
|
||||||
let next = lexer.next();
|
let next = lexer.next();
|
||||||
// Loop is terminatable, because SyntaxKind::End is not a trivia.
|
// Loop is terminable, because SyntaxKind::End is not a trivia.
|
||||||
if !next.is_trivia() {
|
if !next.is_trivia() {
|
||||||
break next;
|
break next;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ use crate::utils::{fat, singleton, LazyHash, SmallBitSet};
|
|||||||
#[derive(Clone, Hash)]
|
#[derive(Clone, Hash)]
|
||||||
#[allow(clippy::derived_hash_with_manual_eq)]
|
#[allow(clippy::derived_hash_with_manual_eq)]
|
||||||
pub struct Content {
|
pub struct Content {
|
||||||
/// The partially element-dependant inner data.
|
/// The partially element-dependent inner data.
|
||||||
inner: Arc<Inner<dyn Bounds>>,
|
inner: Arc<Inner<dyn Bounds>>,
|
||||||
/// The element's source code location.
|
/// The element's source code location.
|
||||||
span: Span,
|
span: Span,
|
||||||
|
@ -356,7 +356,7 @@ impl Func {
|
|||||||
/// #show heading.where(level: 2): set text(blue)
|
/// #show heading.where(level: 2): set text(blue)
|
||||||
/// = Section
|
/// = Section
|
||||||
/// == Subsection
|
/// == Subsection
|
||||||
/// === Sub-subection
|
/// === Sub-subsection
|
||||||
/// ```
|
/// ```
|
||||||
#[func]
|
#[func]
|
||||||
pub fn where_(
|
pub fn where_(
|
||||||
|
@ -62,7 +62,7 @@ use crate::introspection::{Introspector, Location};
|
|||||||
/// - A very simple way to generate unique IDs would be to just increase a
|
/// - A very simple way to generate unique IDs would be to just increase a
|
||||||
/// counter for each element. In this setup, (1) is somewhat satisfied: In
|
/// counter for each element. In this setup, (1) is somewhat satisfied: In
|
||||||
/// principle, the counter will line up across iterations, but things start to
|
/// principle, the counter will line up across iterations, but things start to
|
||||||
/// break down once we generate content dependant on introspection since the
|
/// break down once we generate content dependent on introspection since the
|
||||||
/// IDs generated for that new content will shift the IDs for all following
|
/// IDs generated for that new content will shift the IDs for all following
|
||||||
/// elements in the document. (2) is not satisfied since an edit in the middle
|
/// elements in the document. (2) is not satisfied since an edit in the middle
|
||||||
/// of the document shifts all later IDs. (3) is obviously not satisfied.
|
/// of the document shifts all later IDs. (3) is obviously not satisfied.
|
||||||
@ -76,7 +76,7 @@ use crate::introspection::{Introspector, Location};
|
|||||||
/// e.g. `#for _ in range(5) { figure(..) }`. To handle this case, we can then
|
/// e.g. `#for _ in range(5) { figure(..) }`. To handle this case, we can then
|
||||||
/// disambiguate elements with the same span with an increasing counter. In
|
/// disambiguate elements with the same span with an increasing counter. In
|
||||||
/// this setup, (1) is mostly satisfied: Unless we do stuff like generating
|
/// this setup, (1) is mostly satisfied: Unless we do stuff like generating
|
||||||
/// colliding counter updates dependant on introspection, things will line up.
|
/// colliding counter updates dependent on introspection, things will line up.
|
||||||
/// (2) is also reasonably well satisfied, as typical edits will only affect
|
/// (2) is also reasonably well satisfied, as typical edits will only affect
|
||||||
/// the single element at the currently edited span. Only if we edit inside of
|
/// the single element at the currently edited span. Only if we edit inside of
|
||||||
/// a function, loop, or similar construct, we will affect multiple elements.
|
/// a function, loop, or similar construct, we will affect multiple elements.
|
||||||
@ -114,7 +114,7 @@ use crate::introspection::{Introspector, Location};
|
|||||||
/// locations assigned during measurement match up exactly with the locations of
|
/// locations assigned during measurement match up exactly with the locations of
|
||||||
/// real document elements. Without this guarantee, many introspection-driven
|
/// real document elements. Without this guarantee, many introspection-driven
|
||||||
/// features (like counters, state, and citations) don't work correctly (since
|
/// features (like counters, state, and citations) don't work correctly (since
|
||||||
/// they perform queries dependant on concrete locations).
|
/// they perform queries dependent on concrete locations).
|
||||||
///
|
///
|
||||||
/// This is all fine and good, but things get really tricky when the _user_
|
/// This is all fine and good, but things get really tricky when the _user_
|
||||||
/// measures such introspecting content since the user isn't kindly managing
|
/// measures such introspecting content since the user isn't kindly managing
|
||||||
@ -168,7 +168,7 @@ impl<'a> Locator<'a> {
|
|||||||
|
|
||||||
/// Creates a new synthetic locator.
|
/// Creates a new synthetic locator.
|
||||||
///
|
///
|
||||||
/// This can be used to create a new dependant layout based on an element.
|
/// This can be used to create a new dependent layout based on an element.
|
||||||
/// This is used for layouting footnote entries based on the location
|
/// This is used for layouting footnote entries based on the location
|
||||||
/// of the associated footnote.
|
/// of the associated footnote.
|
||||||
pub fn synthesize(location: Location) -> Self {
|
pub fn synthesize(location: Location) -> Self {
|
||||||
|
@ -241,7 +241,7 @@ impl<T: Resolve> Resolve for Corners<T> {
|
|||||||
|
|
||||||
impl<T: Fold> Fold for Corners<Option<T>> {
|
impl<T: Fold> Fold for Corners<Option<T>> {
|
||||||
fn fold(self, outer: Self) -> Self {
|
fn fold(self, outer: Self) -> Self {
|
||||||
// Usually, folding an inner `None` with an `outer` preferres the
|
// Usually, folding an inner `None` with an `outer` prefers the
|
||||||
// explicit `None`. However, here `None` means unspecified and thus
|
// explicit `None`. However, here `None` means unspecified and thus
|
||||||
// we want `outer`, so we use `fold_or` to opt into such behavior.
|
// we want `outer`, so we use `fold_or` to opt into such behavior.
|
||||||
self.zip(outer).map(|(inner, outer)| inner.fold_or(outer))
|
self.zip(outer).map(|(inner, outer)| inner.fold_or(outer))
|
||||||
|
@ -225,7 +225,7 @@ fn collect_items<'a>(
|
|||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calls `f` for the the BiDi-reordered ranges of a line.
|
/// Calls `f` for the BiDi-reordered ranges of a line.
|
||||||
fn reorder<F>(p: &Preparation, range: Range, mut f: F)
|
fn reorder<F>(p: &Preparation, range: Range, mut f: F)
|
||||||
where
|
where
|
||||||
F: FnMut(Range, bool),
|
F: FnMut(Range, bool),
|
||||||
|
@ -88,7 +88,7 @@ pub struct ShapedGlyph {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct Adjustability {
|
pub struct Adjustability {
|
||||||
/// The left and right strechability
|
/// The left and right stretchability
|
||||||
pub stretchability: (Em, Em),
|
pub stretchability: (Em, Em),
|
||||||
/// The left and right shrinkability
|
/// The left and right shrinkability
|
||||||
pub shrinkability: (Em, Em),
|
pub shrinkability: (Em, Em),
|
||||||
|
@ -117,7 +117,7 @@ pub fn collect<'a>(
|
|||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Migrates trailing start tags without accompanying end tags tags from before
|
/// Migrates trailing start tags without accompanying end tags from before
|
||||||
/// a pagebreak to after it. Returns the position right after the last
|
/// a pagebreak to after it. Returns the position right after the last
|
||||||
/// non-migrated tag.
|
/// non-migrated tag.
|
||||||
///
|
///
|
||||||
|
@ -254,7 +254,7 @@ impl<T: Resolve> Resolve for Sides<T> {
|
|||||||
|
|
||||||
impl<T: Fold> Fold for Sides<Option<T>> {
|
impl<T: Fold> Fold for Sides<Option<T>> {
|
||||||
fn fold(self, outer: Self) -> Self {
|
fn fold(self, outer: Self) -> Self {
|
||||||
// Usually, folding an inner `None` with an `outer` preferres the
|
// Usually, folding an inner `None` with an `outer` prefers the
|
||||||
// explicit `None`. However, here `None` means unspecified and thus
|
// explicit `None`. However, here `None` means unspecified and thus
|
||||||
// we want `outer`, so we use `fold_or` to opt into such behavior.
|
// we want `outer`, so we use `fold_or` to opt into such behavior.
|
||||||
self.zip(outer).map(|(inner, outer)| inner.fold_or(outer))
|
self.zip(outer).map(|(inner, outer)| inner.fold_or(outer))
|
||||||
|
@ -513,7 +513,7 @@ fn add_equation_number(
|
|||||||
equation
|
equation
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resize the equation's frame accordingly so that it emcompasses the number.
|
/// Resize the equation's frame accordingly so that it encompasses the number.
|
||||||
fn resize_equation(
|
fn resize_equation(
|
||||||
equation: &mut Frame,
|
equation: &mut Frame,
|
||||||
number: &Frame,
|
number: &Frame,
|
||||||
|
@ -683,7 +683,7 @@ impl<T: Numeric + Fold> Fold for Augment<T> {
|
|||||||
(Smart::Custom(inner), Smart::Custom(outer)) => {
|
(Smart::Custom(inner), Smart::Custom(outer)) => {
|
||||||
Smart::Custom(inner.fold(outer))
|
Smart::Custom(inner.fold(outer))
|
||||||
}
|
}
|
||||||
// Usually, folding an inner `auto` with an `outer` preferres
|
// Usually, folding an inner `auto` with an `outer` prefers
|
||||||
// the explicit `auto`. However, here `auto` means unspecified
|
// the explicit `auto`. However, here `auto` means unspecified
|
||||||
// and thus we want `outer`.
|
// and thus we want `outer`.
|
||||||
(inner, outer) => inner.or(outer),
|
(inner, outer) => inner.or(outer),
|
||||||
|
@ -140,7 +140,7 @@ pub struct EnumElem {
|
|||||||
/// #set enum(numbering: "1.a)", full: true)
|
/// #set enum(numbering: "1.a)", full: true)
|
||||||
/// + Cook
|
/// + Cook
|
||||||
/// + Heat water
|
/// + Heat water
|
||||||
/// + Add integredients
|
/// + Add ingredients
|
||||||
/// + Eat
|
/// + Eat
|
||||||
/// ```
|
/// ```
|
||||||
#[default(false)]
|
#[default(false)]
|
||||||
|
@ -257,7 +257,7 @@ fn visit<'a>(
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply show rules rules and preparation.
|
// Apply show rules and preparation.
|
||||||
if visit_show_rules(s, content, styles)? {
|
if visit_show_rules(s, content, styles)? {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
@ -1947,7 +1947,7 @@ fn map() -> Module {
|
|||||||
Module::new("map", scope)
|
Module::new("map", scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines a tradient preset as a series of colors expressed as u32s.
|
/// Defines a gradient preset as a series of colors expressed as u32s.
|
||||||
macro_rules! preset {
|
macro_rules! preset {
|
||||||
($name:ident; $($colors:literal),* $(,)*) => {
|
($name:ident; $($colors:literal),* $(,)*) => {
|
||||||
fn $name() -> Array {
|
fn $name() -> Array {
|
||||||
|
@ -370,7 +370,7 @@ impl Image {
|
|||||||
Ok(Self(Arc::new(LazyHash::new(Repr { kind, alt }))))
|
Ok(Self(Arc::new(LazyHash::new(Repr { kind, alt }))))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a possibly font-dependant image from a buffer and a format.
|
/// Create a possibly font-dependent image from a buffer and a format.
|
||||||
#[comemo::memoize]
|
#[comemo::memoize]
|
||||||
#[typst_macros::time(name = "load image")]
|
#[typst_macros::time(name = "load image")]
|
||||||
pub fn with_fonts(
|
pub fn with_fonts(
|
||||||
|
@ -51,7 +51,7 @@ pub struct RectElem {
|
|||||||
/// - `{auto}` for a stroke of `{1pt + black}` if and if only if no fill is
|
/// - `{auto}` for a stroke of `{1pt + black}` if and if only if no fill is
|
||||||
/// given.
|
/// given.
|
||||||
/// - Any kind of [stroke]
|
/// - Any kind of [stroke]
|
||||||
/// - A dictionary describing the stroke for each side inidvidually. The
|
/// - A dictionary describing the stroke for each side individually. The
|
||||||
/// dictionary can contain the following keys in order of precedence:
|
/// dictionary can contain the following keys in order of precedence:
|
||||||
/// - `top`: The top stroke.
|
/// - `top`: The top stroke.
|
||||||
/// - `right`: The right stroke.
|
/// - `right`: The right stroke.
|
||||||
|
@ -861,7 +861,7 @@ description: |
|
|||||||
- Import autocompletion now only shows the latest package version until a
|
- Import autocompletion now only shows the latest package version until a
|
||||||
colon is typed
|
colon is typed
|
||||||
- Fixed autocompletion for dictionary key containing a space
|
- Fixed autocompletion for dictionary key containing a space
|
||||||
- Fixed autocompletion for for loops
|
- Fixed autocompletion for `for` loops
|
||||||
|
|
||||||
- Command line interface
|
- Command line interface
|
||||||
- Added `typst query` subcommand to execute a
|
- Added `typst query` subcommand to execute a
|
||||||
@ -895,7 +895,7 @@ description: |
|
|||||||
|
|
||||||
- Development
|
- Development
|
||||||
- Extracted parser and syntax tree into `typst-syntax` crate
|
- Extracted parser and syntax tree into `typst-syntax` crate
|
||||||
- The `World::today` implementation of Typst dependants may need fixing if
|
- The `World::today` implementation of Typst dependents may need fixing if
|
||||||
they have the same [bug](https://github.com/typst/typst/issues/1842) that
|
they have the same [bug](https://github.com/typst/typst/issues/1842) that
|
||||||
the CLI world had
|
the CLI world had
|
||||||
|
|
||||||
@ -1009,7 +1009,7 @@ description: |
|
|||||||
path must contain `[{n}]` if the document has multiple pages.
|
path must contain `[{n}]` if the document has multiple pages.
|
||||||
- Added `--diagnostic-format=short` for Unix-style short diagnostics
|
- Added `--diagnostic-format=short` for Unix-style short diagnostics
|
||||||
- Doesn't emit color codes anymore if stderr isn't a TTY
|
- Doesn't emit color codes anymore if stderr isn't a TTY
|
||||||
- Now sets the correct exit when invoked with a non-existent file
|
- Now sets the correct exit when invoked with a nonexistent file
|
||||||
- Now ignores UTF-8 BOM in Typst files
|
- Now ignores UTF-8 BOM in Typst files
|
||||||
|
|
||||||
- Miscellaneous Improvements
|
- Miscellaneous Improvements
|
||||||
|
@ -469,7 +469,7 @@ Aside from the official package repository, you might also want to check out the
|
|||||||
compiles a curated list of resources created for Typst.
|
compiles a curated list of resources created for Typst.
|
||||||
|
|
||||||
If you need to load functions and variables from another file within your
|
If you need to load functions and variables from another file within your
|
||||||
project, for example to use a template, you can use use the same
|
project, for example to use a template, you can use the same
|
||||||
[`{import}`]($scripting/#modules) statement with a file name rather than a
|
[`{import}`]($scripting/#modules) statement with a file name rather than a
|
||||||
package specification. To instead include the textual content of another file,
|
package specification. To instead include the textual content of another file,
|
||||||
you can use an [`{include}`]($scripting/#modules) statement. It will retrieve
|
you can use an [`{include}`]($scripting/#modules) statement. It will retrieve
|
||||||
|
@ -188,7 +188,7 @@ conditionally remove the header on the first page:
|
|||||||
This example may look intimidating, but let's break it down: By using the
|
This example may look intimidating, but let's break it down: By using the
|
||||||
`{context}` keyword, we are telling Typst that the header depends on where we
|
`{context}` keyword, we are telling Typst that the header depends on where we
|
||||||
are in the document. We then ask Typst if the page [counter] is larger than one
|
are in the document. We then ask Typst if the page [counter] is larger than one
|
||||||
at our (context-dependant) current position. The page counter starts at one, so
|
at our (context-dependent) current position. The page counter starts at one, so
|
||||||
we are skipping the header on a single page. Counters may have multiple levels.
|
we are skipping the header on a single page. Counters may have multiple levels.
|
||||||
This feature is used for items like headings, but the page counter will always
|
This feature is used for items like headings, but the page counter will always
|
||||||
have a single level, so we can just look at the first one.
|
have a single level, so we can just look at the first one.
|
||||||
|
@ -714,7 +714,7 @@ very first and last line.
|
|||||||
align: center + horizon,
|
align: center + horizon,
|
||||||
table.header[Technique][Advantage][Drawback],
|
table.header[Technique][Advantage][Drawback],
|
||||||
[Diegetic], [Immersive], [May be contrived],
|
[Diegetic], [Immersive], [May be contrived],
|
||||||
[Extradiegetic], [Breaks immersion], [Obstrusive],
|
[Extradiegetic], [Breaks immersion], [Obtrusive],
|
||||||
[Omitted], [Fosters engagement], [May fracture audience],
|
[Omitted], [Fosters engagement], [May fracture audience],
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
@ -746,7 +746,7 @@ below the first row:
|
|||||||
>>> align: center + horizon,
|
>>> align: center + horizon,
|
||||||
>>> table.header[Technique][Advantage][Drawback],
|
>>> table.header[Technique][Advantage][Drawback],
|
||||||
>>> [Diegetic], [Immersive], [May be contrived],
|
>>> [Diegetic], [Immersive], [May be contrived],
|
||||||
>>> [Extradiegetic], [Breaks immersion], [Obstrusive],
|
>>> [Extradiegetic], [Breaks immersion], [Obtrusive],
|
||||||
>>> [Omitted], [Fosters engagement], [May fracture audience],
|
>>> [Omitted], [Fosters engagement], [May fracture audience],
|
||||||
>>> )
|
>>> )
|
||||||
```
|
```
|
||||||
@ -777,7 +777,7 @@ The next example shows how to draw all but the outer lines:
|
|||||||
>>> align: center + horizon,
|
>>> align: center + horizon,
|
||||||
>>> table.header[Technique][Advantage][Drawback],
|
>>> table.header[Technique][Advantage][Drawback],
|
||||||
>>> [Diegetic], [Immersive], [May be contrived],
|
>>> [Diegetic], [Immersive], [May be contrived],
|
||||||
>>> [Extradiegetic], [Breaks immersion], [Obstrusive],
|
>>> [Extradiegetic], [Breaks immersion], [Obtrusive],
|
||||||
>>> [Omitted], [Fosters engagement], [May fracture audience],
|
>>> [Omitted], [Fosters engagement], [May fracture audience],
|
||||||
>>> )
|
>>> )
|
||||||
```
|
```
|
||||||
@ -812,7 +812,7 @@ calendar.
|
|||||||
>>> align: center + horizon,
|
>>> align: center + horizon,
|
||||||
>>> table.header[Technique][Advantage][Drawback],
|
>>> table.header[Technique][Advantage][Drawback],
|
||||||
>>> [Diegetic], [Immersive], [May be contrived],
|
>>> [Diegetic], [Immersive], [May be contrived],
|
||||||
>>> [Extradiegetic], [Breaks immersion], [Obstrusive],
|
>>> [Extradiegetic], [Breaks immersion], [Obtrusive],
|
||||||
>>> [Omitted], [Fosters engagement], [May fracture audience],
|
>>> [Omitted], [Fosters engagement], [May fracture audience],
|
||||||
>>> )
|
>>> )
|
||||||
```
|
```
|
||||||
|
@ -59,11 +59,11 @@ context is known. The body of a context expression may be evaluated zero, one,
|
|||||||
or multiple times, depending on how many different places it is put into.
|
or multiple times, depending on how many different places it is put into.
|
||||||
|
|
||||||
## Location context
|
## Location context
|
||||||
Context can not only give us access to set rule values. It can also let us know
|
Context cannot only give us access to set rule values. It can also let us know
|
||||||
_where_ in the document we currently are, relative to other elements, and
|
_where_ in the document we currently are, relative to other elements, and
|
||||||
absolutely on the pages. We can use this information to create very flexible
|
absolutely on the pages. We can use this information to create very flexible
|
||||||
interactions between different document parts. This underpins features like
|
interactions between different document parts. This underpins features like
|
||||||
heading numbering, the table of contents, or page headers dependant on section
|
heading numbering, the table of contents, or page headers dependent on section
|
||||||
headings.
|
headings.
|
||||||
|
|
||||||
Some functions like [`counter.get`]($counter.get) implicitly access the current
|
Some functions like [`counter.get`]($counter.get) implicitly access the current
|
||||||
|
@ -90,7 +90,7 @@ struct Args {
|
|||||||
/// This option controls where to spit them out. The HTML generation will
|
/// This option controls where to spit them out. The HTML generation will
|
||||||
/// assume that this output directory is served at `${base_url}/assets/*`.
|
/// assume that this output directory is served at `${base_url}/assets/*`.
|
||||||
/// The default is `assets`. For example, if the base URL is `/docs/` then
|
/// The default is `assets`. For example, if the base URL is `/docs/` then
|
||||||
/// the gemerated HTML might look like `<img src="/docs/assets/foo.png">`
|
/// the generated HTML might look like `<img src="/docs/assets/foo.png">`
|
||||||
/// even though the `--assets-dir` was set to `/tmp/images` or something.
|
/// even though the `--assets-dir` was set to `/tmp/images` or something.
|
||||||
#[arg(long, default_value = "assets")]
|
#[arg(long, default_value = "assets")]
|
||||||
assets_dir: PathBuf,
|
assets_dir: PathBuf,
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
@ -170,7 +170,7 @@
|
|||||||
dict.nonfunc()
|
dict.nonfunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
--- dict-dynamic-uplicate-key ---
|
--- dict-dynamic-duplicate-key ---
|
||||||
#let a = "hello"
|
#let a = "hello"
|
||||||
#let b = "world"
|
#let b = "world"
|
||||||
#let c = "value"
|
#let c = "value"
|
||||||
|
@ -212,7 +212,7 @@
|
|||||||
#test(timesum("2:70"), "3:10")
|
#test(timesum("2:70"), "3:10")
|
||||||
#test(timesum("1:20, 2:10, 0:40"), "4:10")
|
#test(timesum("1:20, 2:10, 0:40"), "4:10")
|
||||||
|
|
||||||
--- stgring-replace ---
|
--- string-replace ---
|
||||||
// Test the `replace` method with `Str` replacements.
|
// Test the `replace` method with `Str` replacements.
|
||||||
#test("ABC".replace("", "-"), "-A-B-C-")
|
#test("ABC".replace("", "-"), "-A-B-C-")
|
||||||
#test("Ok".replace("Ok", "Nope", count: 0), "Ok")
|
#test("Ok".replace("Ok", "Nope", count: 0), "Ok")
|
||||||
|
@ -191,7 +191,7 @@ Hello #box(width: 1em, height: 1em, clip: true)[#rect(width: 3em, height: 3em, f
|
|||||||
world 2
|
world 2
|
||||||
|
|
||||||
--- block-clip-text ---
|
--- block-clip-text ---
|
||||||
// Test cliping text
|
// Test clipping text
|
||||||
#block(width: 5em, height: 2em, clip: false, stroke: 1pt + black)[
|
#block(width: 5em, height: 2em, clip: false, stroke: 1pt + black)[
|
||||||
But, soft! what light through
|
But, soft! what light through
|
||||||
]
|
]
|
||||||
|
@ -102,7 +102,7 @@ Lo que entendemos por nivel léxico-semántico, en cuanto su sentido más
|
|||||||
gramatical: es aquel que estudia el origen y forma de las palabras de
|
gramatical: es aquel que estudia el origen y forma de las palabras de
|
||||||
un idioma.
|
un idioma.
|
||||||
|
|
||||||
--- hyphenate-es-captalized-names ---
|
--- hyphenate-es-capitalized-names ---
|
||||||
// If the hyphen is followed by a capitalized word we shall not repeat
|
// If the hyphen is followed by a capitalized word we shall not repeat
|
||||||
// the hyphen at the next line
|
// the hyphen at the next line
|
||||||
#set page(width: 6.2cm)
|
#set page(width: 6.2cm)
|
||||||
|
@ -23,7 +23,7 @@ $ pi(a,b,) $
|
|||||||
$ pi(a;b) $
|
$ pi(a;b) $
|
||||||
|
|
||||||
--- math-call-2d-semicolon-priority ---
|
--- math-call-2d-semicolon-priority ---
|
||||||
// If the semicolon directlry follows a hash expression, it terminates that
|
// If the semicolon directly follows a hash expression, it terminates that
|
||||||
// instead of indicating 2d arguments.
|
// instead of indicating 2d arguments.
|
||||||
$ mat(#"math" ; "wins") $
|
$ mat(#"math" ; "wins") $
|
||||||
$ mat(#"code"; "wins") $
|
$ mat(#"code"; "wins") $
|
||||||
|
@ -63,7 +63,7 @@ Multiple trailing line breaks.
|
|||||||
#hrule(70pt)$e^(pi i)+1 = 0$
|
#hrule(70pt)$e^(pi i)+1 = 0$
|
||||||
|
|
||||||
--- math-linebreaking-lr ---
|
--- math-linebreaking-lr ---
|
||||||
// LR groups prevent linbreaking.
|
// LR groups prevent linebreaking.
|
||||||
#let hrule(x) = box(line(length: x))
|
#let hrule(x) = box(line(length: x))
|
||||||
#hrule(76pt)$a+b$\
|
#hrule(76pt)$a+b$\
|
||||||
#hrule(74pt)$(a+b)$\
|
#hrule(74pt)$(a+b)$\
|
||||||
|
@ -12,7 +12,7 @@ hello_world Nutzer*innen
|
|||||||
|
|
||||||
日本語では、*太字*や_斜体_を使って強調します。
|
日本語では、*太字*や_斜体_を使って強調します。
|
||||||
|
|
||||||
中文中混有*Strong*和_Empasis_。
|
中文中混有*Strong*和_Emphasis_。
|
||||||
|
|
||||||
// Can contain paragraph in nested content block.
|
// Can contain paragraph in nested content block.
|
||||||
_Still #[
|
_Still #[
|
||||||
|
@ -75,6 +75,6 @@ Not in heading
|
|||||||
--- heading-numbering-hint ---
|
--- heading-numbering-hint ---
|
||||||
= Heading <intro>
|
= Heading <intro>
|
||||||
|
|
||||||
// Error: 1:20-1:26 cannot reference heading without numbering
|
// Error: 1:19-1:25 cannot reference heading without numbering
|
||||||
// Hint: 1:20-1:26 you can enable heading numbering with `#set heading(numbering: "1.")`
|
// Hint: 1:19-1:25 you can enable heading numbering with `#set heading(numbering: "1.")`
|
||||||
Can not be used as @intro
|
Cannot be used as @intro
|
||||||
|
@ -19,7 +19,7 @@ Hello *#x*
|
|||||||
- No more fruit
|
- No more fruit
|
||||||
|
|
||||||
--- set-text-override ---
|
--- set-text-override ---
|
||||||
// Test that that block spacing and text style are respected from
|
// Test that block spacing and text style are respected from
|
||||||
// the outside, but the more specific fill is respected.
|
// the outside, but the more specific fill is respected.
|
||||||
#set par(spacing: 4pt)
|
#set par(spacing: 4pt)
|
||||||
#set text(style: "italic", fill: eastern)
|
#set text(style: "italic", fill: eastern)
|
||||||
|
@ -67,12 +67,12 @@ Emoji: 🐪, 🌋, 🏞
|
|||||||
|
|
||||||
--- text-unknown-font-family-warning ---
|
--- text-unknown-font-family-warning ---
|
||||||
#text(font: "linux libertine", "I exist, ")
|
#text(font: "linux libertine", "I exist, ")
|
||||||
// Warning: 13-27 unknown font family: non-existing
|
// Warning: 13-26 unknown font family: nonexistent
|
||||||
#text(font: "non-existing", "but")
|
#text(font: "nonexistent", "but")
|
||||||
// Warning: 17-36 unknown font family: also-non-existing
|
// Warning: 17-35 unknown font family: also-nonexistent
|
||||||
#set text(font: "also-non-existing")
|
#set text(font: "also-nonexistent")
|
||||||
I
|
I
|
||||||
// Warning: 23-56 unknown font family: list-of
|
// Warning: 23-55 unknown font family: list-of
|
||||||
// Warning: 23-56 unknown font family: non-existing-fonts
|
// Warning: 23-55 unknown font family: nonexistent-fonts
|
||||||
#let var = text(font: ("list-of", "non-existing-fonts"))[don't]
|
#let var = text(font: ("list-of", "nonexistent-fonts"))[don't]
|
||||||
#var
|
#var
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Test sub- and superscipt shifts.
|
// Test sub- and superscript shifts.
|
||||||
|
|
||||||
--- sub-super ---
|
--- sub-super ---
|
||||||
#table(
|
#table(
|
||||||
|
@ -371,7 +371,7 @@ class TestHelper {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confgiures whether the run and save buttons are enabled.
|
// Configures whether the run and save buttons are enabled.
|
||||||
private setRunButtonEnabled(enabled: boolean) {
|
private setRunButtonEnabled(enabled: boolean) {
|
||||||
vscode.commands.executeCommand(
|
vscode.commands.executeCommand(
|
||||||
"setContext",
|
"setContext",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user