mirror of
https://github.com/typst/typst
synced 2025-08-06 03:07:54 +08:00
Merge branch 'main' into html-tables-v2
This commit is contained in:
commit
1c10342a37
@ -228,6 +228,8 @@ static EXCEPTION_MAP: phf::Map<&'static str, Exception> = phf::phf_map! {
|
||||
.style(FontStyle::Oblique),
|
||||
"NewCMSans10-Regular" => Exception::new()
|
||||
.family("New Computer Modern Sans"),
|
||||
"NewCMSansMath-Regular" => Exception::new()
|
||||
.family("New Computer Modern Sans Math"),
|
||||
"NewCMUncial08-Bold" => Exception::new()
|
||||
.family("New Computer Modern Uncial 08"),
|
||||
"NewCMUncial08-Book" => Exception::new()
|
||||
|
@ -1605,10 +1605,12 @@ impl AtNewline {
|
||||
_ => true,
|
||||
},
|
||||
AtNewline::StopParBreak => parbreak,
|
||||
AtNewline::RequireColumn(min_col) => match column {
|
||||
Some(column) => column <= min_col,
|
||||
None => false, // Don't stop if we had no column.
|
||||
},
|
||||
AtNewline::RequireColumn(min_col) => {
|
||||
// Don't stop if this newline doesn't start a column (this may
|
||||
// be checked on the boundary of lexer modes, since we only
|
||||
// report a column in Markup).
|
||||
column.is_some_and(|column| column <= min_col)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1703,10 +1705,13 @@ impl<'s> Parser<'s> {
|
||||
self.token.newline.is_some()
|
||||
}
|
||||
|
||||
/// The number of characters until the most recent newline from the current
|
||||
/// token, or 0 if it did not follow a newline.
|
||||
/// The number of characters until the most recent newline from the start of
|
||||
/// the current token. Uses a cached value from the newline mode if present.
|
||||
fn current_column(&self) -> usize {
|
||||
self.token.newline.and_then(|newline| newline.column).unwrap_or(0)
|
||||
self.token
|
||||
.newline
|
||||
.and_then(|newline| newline.column)
|
||||
.unwrap_or_else(|| self.lexer.column(self.token.start))
|
||||
}
|
||||
|
||||
/// The current token's text.
|
||||
|
@ -77,6 +77,49 @@ _Shopping list_
|
||||
|
||||
#test(indented, manual)
|
||||
|
||||
--- list-indent-bracket-nesting ---
|
||||
// Test list indent nesting behavior when directly at a starting bracket.
|
||||
|
||||
#let indented = {
|
||||
[- indented
|
||||
- less
|
||||
]
|
||||
[- indented
|
||||
- same
|
||||
- then less
|
||||
- then same
|
||||
]
|
||||
[- indented
|
||||
- more
|
||||
- then same
|
||||
- then less
|
||||
]
|
||||
}
|
||||
|
||||
#let item = list.item
|
||||
#let manual = {
|
||||
{
|
||||
item[indented]; [ ]
|
||||
item[less]; [ ]
|
||||
}
|
||||
{
|
||||
item[indented]; [ ]
|
||||
item[same]; [ ]
|
||||
item[then less #{
|
||||
item[then same]
|
||||
}]; [ ]
|
||||
}
|
||||
{
|
||||
item[indented #{
|
||||
item[more]
|
||||
}]; [ ]
|
||||
item[then same]; [ ]
|
||||
item[then less]; [ ]
|
||||
}
|
||||
}
|
||||
|
||||
#test(indented, manual)
|
||||
|
||||
--- list-tabs ---
|
||||
// This works because tabs are used consistently.
|
||||
- A with 1 tab
|
||||
|
Loading…
x
Reference in New Issue
Block a user