mirror of
https://github.com/typst/typst
synced 2025-08-12 14:17:55 +08:00
Compare commits
No commits in common. "56f4fa2b4d4d772c5b19c9842419dcc4e078744b" and "d199546f9fe92b2d380dc337298fdca3e6fca8c8" have entirely different histories.
56f4fa2b4d
...
d199546f9f
@ -21,7 +21,6 @@ use crate::foundations::{
|
|||||||
/// be accessed using [field access notation]($scripting/#fields):
|
/// be accessed using [field access notation]($scripting/#fields):
|
||||||
///
|
///
|
||||||
/// - General symbols are defined in the [`sym` module]($category/symbols/sym)
|
/// - General symbols are defined in the [`sym` module]($category/symbols/sym)
|
||||||
/// and are accessible without the `sym.` prefix in math mode.
|
|
||||||
/// - Emoji are defined in the [`emoji` module]($category/symbols/emoji)
|
/// - Emoji are defined in the [`emoji` module]($category/symbols/emoji)
|
||||||
///
|
///
|
||||||
/// Moreover, you can define custom symbols with this type's constructor
|
/// Moreover, you can define custom symbols with this type's constructor
|
||||||
|
@ -1526,7 +1526,11 @@ impl<'a> CellGrid<'a> {
|
|||||||
self.entry(x, y).map(|entry| match entry {
|
self.entry(x, y).map(|entry| match entry {
|
||||||
Entry::Cell(_) => Axes::new(x, y),
|
Entry::Cell(_) => Axes::new(x, y),
|
||||||
Entry::Merged { parent } => {
|
Entry::Merged { parent } => {
|
||||||
let c = self.non_gutter_column_count();
|
let c = if self.has_gutter {
|
||||||
|
1 + self.cols.len() / 2
|
||||||
|
} else {
|
||||||
|
self.cols.len()
|
||||||
|
};
|
||||||
let factor = if self.has_gutter { 2 } else { 1 };
|
let factor = if self.has_gutter { 2 } else { 1 };
|
||||||
Axes::new(factor * (*parent % c), factor * (*parent / c))
|
Axes::new(factor * (*parent % c), factor * (*parent / c))
|
||||||
}
|
}
|
||||||
@ -1598,21 +1602,6 @@ impl<'a> CellGrid<'a> {
|
|||||||
cell.rowspan.get()
|
cell.rowspan.get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn non_gutter_column_count(&self) -> usize {
|
|
||||||
if self.has_gutter {
|
|
||||||
// Calculation: With gutters, we have
|
|
||||||
// 'cols = 2 * (non-gutter cols) - 1', since there is a gutter
|
|
||||||
// column between each regular column. Therefore,
|
|
||||||
// 'floor(cols / 2)' will be equal to
|
|
||||||
// 'floor(non-gutter cols - 1/2) = non-gutter-cols - 1',
|
|
||||||
// so 'non-gutter cols = 1 + floor(cols / 2)'.
|
|
||||||
1 + self.cols.len() / 2
|
|
||||||
} else {
|
|
||||||
self.cols.len()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given a cell's requested x and y, the vector with the resolved cell
|
/// Given a cell's requested x and y, the vector with the resolved cell
|
||||||
|
@ -282,7 +282,7 @@ fn show_cell_html(tag: HtmlTag, cell: &Cell, styles: StyleChain) -> Content {
|
|||||||
|
|
||||||
fn show_cellgrid_html(grid: CellGrid, styles: StyleChain) -> Content {
|
fn show_cellgrid_html(grid: CellGrid, styles: StyleChain) -> Content {
|
||||||
let elem = |tag, body| HtmlElem::new(tag).with_body(Some(body)).pack();
|
let elem = |tag, body| HtmlElem::new(tag).with_body(Some(body)).pack();
|
||||||
let mut rows: Vec<_> = grid.entries.chunks(grid.non_gutter_column_count()).collect();
|
let mut rows: Vec<_> = grid.entries.chunks(grid.cols.len()).collect();
|
||||||
|
|
||||||
let tr = |tag, row: &[Entry]| {
|
let tr = |tag, row: &[Entry]| {
|
||||||
let row = row
|
let row = row
|
||||||
|
@ -130,7 +130,7 @@ static TO_SRGB: LazyLock<qcms::Transform> = LazyLock::new(|| {
|
|||||||
///
|
///
|
||||||
/// # Predefined color maps
|
/// # Predefined color maps
|
||||||
/// Typst also includes a number of preset color maps that can be used for
|
/// Typst also includes a number of preset color maps that can be used for
|
||||||
/// [gradients]($gradient/#stops). These are simply arrays of colors defined in
|
/// [gradients]($gradient.linear). These are simply arrays of colors defined in
|
||||||
/// the module `color.map`.
|
/// the module `color.map`.
|
||||||
///
|
///
|
||||||
/// ```example
|
/// ```example
|
||||||
|
@ -70,9 +70,6 @@ use crate::visualize::{Color, ColorSpace, WeightedColor};
|
|||||||
/// the offsets when defining a gradient. In this case, Typst will space all
|
/// the offsets when defining a gradient. In this case, Typst will space all
|
||||||
/// stops evenly.
|
/// stops evenly.
|
||||||
///
|
///
|
||||||
/// Typst predefines color maps that you can use as stops. See the
|
|
||||||
/// [`color`]($color/#predefined-color-maps) documentation for more details.
|
|
||||||
///
|
|
||||||
/// # Relativeness
|
/// # Relativeness
|
||||||
/// The location of the `{0%}` and `{100%}` stops depends on the dimensions
|
/// The location of the `{0%}` and `{100%}` stops depends on the dimensions
|
||||||
/// of a container. This container can either be the shape that it is being
|
/// of a container. This container can either be the shape that it is being
|
||||||
@ -160,6 +157,10 @@ use crate::visualize::{Color, ColorSpace, WeightedColor};
|
|||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// # Presets
|
||||||
|
/// Typst predefines color maps that you can use with your gradients. See the
|
||||||
|
/// [`color`]($color/#predefined-color-maps) documentation for more details.
|
||||||
|
///
|
||||||
/// # Note on file sizes
|
/// # Note on file sizes
|
||||||
///
|
///
|
||||||
/// Gradients can be quite large, especially if they have many stops. This is
|
/// Gradients can be quite large, especially if they have many stops. This is
|
||||||
@ -287,7 +288,7 @@ impl Gradient {
|
|||||||
/// )),
|
/// )),
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
#[func(title = "Radial Gradient")]
|
#[func]
|
||||||
fn radial(
|
fn radial(
|
||||||
span: Span,
|
span: Span,
|
||||||
/// The color [stops](#stops) of the gradient.
|
/// The color [stops](#stops) of the gradient.
|
||||||
@ -401,7 +402,7 @@ impl Gradient {
|
|||||||
/// )),
|
/// )),
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
#[func(title = "Conic Gradient")]
|
#[func]
|
||||||
pub fn conic(
|
pub fn conic(
|
||||||
span: Span,
|
span: Span,
|
||||||
/// The color [stops](#stops) of the gradient.
|
/// The color [stops](#stops) of the gradient.
|
||||||
|
@ -271,11 +271,10 @@ fn math_expr_prec(p: &mut Parser, min_prec: usize, stop: SyntaxKind) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SyntaxKind::Text | SyntaxKind::MathText | SyntaxKind::MathShorthand => {
|
SyntaxKind::Text | SyntaxKind::MathText | SyntaxKind::MathShorthand => {
|
||||||
continuable = !p.at(SyntaxKind::MathShorthand)
|
continuable = matches!(
|
||||||
&& matches!(
|
math_class(p.current_text()),
|
||||||
math_class(p.current_text()),
|
None | Some(MathClass::Alphabetic)
|
||||||
None | Some(MathClass::Alphabetic)
|
);
|
||||||
);
|
|
||||||
if !maybe_delimited(p) {
|
if !maybe_delimited(p) {
|
||||||
p.eat();
|
p.eat();
|
||||||
}
|
}
|
||||||
|
@ -170,8 +170,8 @@
|
|||||||
category: symbols
|
category: symbols
|
||||||
path: ["emoji"]
|
path: ["emoji"]
|
||||||
details: |
|
details: |
|
||||||
Named emojis.
|
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.
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>a</td>
|
|
||||||
<td>b</td>
|
|
||||||
<td>c</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>d</td>
|
|
||||||
<td>e</td>
|
|
||||||
<td>f</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>g</td>
|
|
||||||
<td>h</td>
|
|
||||||
<td>i</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>a</td>
|
|
||||||
<td>b</td>
|
|
||||||
<td>c</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>d</td>
|
|
||||||
<td>e</td>
|
|
||||||
<td>f</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>g</td>
|
|
||||||
<td>h</td>
|
|
||||||
<td>i</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>a</td>
|
|
||||||
<td>b</td>
|
|
||||||
<td>c</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>d</td>
|
|
||||||
<td>e</td>
|
|
||||||
<td>f</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>g</td>
|
|
||||||
<td>h</td>
|
|
||||||
<td>i</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Before Width: | Height: | Size: 475 B |
@ -30,30 +30,3 @@
|
|||||||
[row],
|
[row],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
--- col-gutter-table html ---
|
|
||||||
#table(
|
|
||||||
columns: 3,
|
|
||||||
column-gutter: 3pt,
|
|
||||||
[a], [b], [c],
|
|
||||||
[d], [e], [f],
|
|
||||||
[g], [h], [i]
|
|
||||||
)
|
|
||||||
|
|
||||||
--- row-gutter-table html ---
|
|
||||||
#table(
|
|
||||||
columns: 3,
|
|
||||||
row-gutter: 3pt,
|
|
||||||
[a], [b], [c],
|
|
||||||
[d], [e], [f],
|
|
||||||
[g], [h], [i]
|
|
||||||
)
|
|
||||||
|
|
||||||
--- col-row-gutter-table html ---
|
|
||||||
#table(
|
|
||||||
columns: 3,
|
|
||||||
gutter: 3pt,
|
|
||||||
[a], [b], [c],
|
|
||||||
[d], [e], [f],
|
|
||||||
[g], [h], [i]
|
|
||||||
)
|
|
||||||
|
@ -13,11 +13,6 @@ $ underline(f' : NN -> RR) \
|
|||||||
1 - 0 thick &...,
|
1 - 0 thick &...,
|
||||||
) $
|
) $
|
||||||
|
|
||||||
--- math-shorthands-noncontinuable ---
|
|
||||||
// Test that shorthands are not continuable.
|
|
||||||
$ x >=(y) / z \
|
|
||||||
x >= (y) / z $
|
|
||||||
|
|
||||||
--- math-common-symbols ---
|
--- math-common-symbols ---
|
||||||
// Test common symbols.
|
// Test common symbols.
|
||||||
$ dot \ dots \ ast \ tilde \ star $
|
$ dot \ dots \ ast \ tilde \ star $
|
||||||
|
Loading…
x
Reference in New Issue
Block a user