mirror of
https://github.com/typst/typst
synced 2025-08-20 09:49:02 +08:00
Merge c317e5e2219b937d6a65517d78c6ac652fec9bea into 36ecbb2c8dccc1a31c43fee1466f1425844d8607
This commit is contained in:
commit
ce0c8765e2
@ -500,7 +500,11 @@ impl PlainText for Packed<RawElem> {
|
||||
}
|
||||
|
||||
/// The content of the raw text.
|
||||
#[derive(Debug, Clone, Hash, PartialEq)]
|
||||
#[derive(Debug, Clone, Hash)]
|
||||
#[allow(
|
||||
clippy::derived_hash_with_manual_eq,
|
||||
reason = "https://github.com/typst/typst/pull/6560#issuecomment-3045393640"
|
||||
)]
|
||||
pub enum RawContent {
|
||||
/// From a string.
|
||||
Text(EcoString),
|
||||
@ -525,6 +529,22 @@ impl RawContent {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for RawContent {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(RawContent::Text(a), RawContent::Text(b)) => a == b,
|
||||
(lines @ RawContent::Lines(_), RawContent::Text(text))
|
||||
| (RawContent::Text(text), lines @ RawContent::Lines(_)) => {
|
||||
*text == lines.get()
|
||||
}
|
||||
(RawContent::Lines(a), RawContent::Lines(b)) => Iterator::eq(
|
||||
a.iter().map(|(line, _)| line),
|
||||
b.iter().map(|(line, _)| line),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cast! {
|
||||
RawContent,
|
||||
self => self.get().into_value(),
|
||||
|
@ -687,6 +687,11 @@ a b c --------------------
|
||||
#let hi = "你好world"
|
||||
```
|
||||
|
||||
--- issue-6559-equality-between-raws ---
|
||||
|
||||
#test(`foo`, `foo`)
|
||||
#assert.ne(`foo`, `bar`)
|
||||
|
||||
--- raw-theme-set-to-auto ---
|
||||
```typ
|
||||
#let hi = "Hello World"
|
||||
|
Loading…
x
Reference in New Issue
Block a user