mirror of
https://github.com/typst/typst
synced 2025-08-26 04:34:14 +08:00
Force @ refs to have an immediate label (#5776)
This commit is contained in:
parent
43c3acdc4e
commit
ef84635b09
@ -196,7 +196,7 @@ impl Lexer<'_> {
|
|||||||
'h' if self.s.eat_if("ttp://") => self.link(),
|
'h' if self.s.eat_if("ttp://") => self.link(),
|
||||||
'h' if self.s.eat_if("ttps://") => self.link(),
|
'h' if self.s.eat_if("ttps://") => self.link(),
|
||||||
'<' if self.s.at(is_id_continue) => self.label(),
|
'<' if self.s.at(is_id_continue) => self.label(),
|
||||||
'@' => self.ref_marker(),
|
'@' if self.s.at(is_id_continue) => self.ref_marker(),
|
||||||
|
|
||||||
'.' if self.s.eat_if("..") => SyntaxKind::Shorthand,
|
'.' if self.s.eat_if("..") => SyntaxKind::Shorthand,
|
||||||
'-' if self.s.eat_if("--") => SyntaxKind::Shorthand,
|
'-' if self.s.eat_if("--") => SyntaxKind::Shorthand,
|
||||||
|
@ -85,3 +85,12 @@ Text seen on #ref(<text>, form: "page", supplement: "Page").
|
|||||||
// Test reference with non-whitespace before it.
|
// Test reference with non-whitespace before it.
|
||||||
#figure[] <1>
|
#figure[] <1>
|
||||||
#test([(#ref(<1>))], [(@1)])
|
#test([(#ref(<1>))], [(@1)])
|
||||||
|
|
||||||
|
--- ref-to-empty-label-not-possible ---
|
||||||
|
// @ without any following label should just produce the symbol in the output
|
||||||
|
// and not produce a reference to a label with an empty name.
|
||||||
|
@ \<- this should show up
|
||||||
|
// using ref() should also not be possible
|
||||||
|
// Error: 6-7 unexpected less-than operator
|
||||||
|
// Error: 7-8 unexpected greater-than operator
|
||||||
|
#ref(<>)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user