Fixes in TextMate grammar ✅
This commit is contained in:
parent
ceb00a2e77
commit
271b0f953b
@ -40,6 +40,12 @@ pub struct RgbaColor {
|
||||
}
|
||||
|
||||
impl RgbaColor {
|
||||
/// Black color.
|
||||
pub const BLACK: Self = Self { r: 0, g: 0, b: 0, a: 255 };
|
||||
|
||||
/// White color.
|
||||
pub const WHITE: Self = Self { r: 255, g: 255, b: 255, a: 255 };
|
||||
|
||||
/// Constructs a new RGBA color.
|
||||
pub fn new(r: u8, g: u8, b: u8, a: u8) -> Self {
|
||||
Self { r, g, b, a }
|
||||
|
@ -12,8 +12,8 @@
|
||||
//! This produces a [layout tree], a high-level, fully styled representation.
|
||||
//! The nodes of this tree are self-contained and order-independent and thus
|
||||
//! much better suited for layouting than the syntax tree.
|
||||
//! - **Layouting:** Next, the tree is to [layouted] into a portable version of
|
||||
//! the typeset document. The output of this is a vector of [`Frame`]s
|
||||
//! - **Layouting:** Next, the tree is [layouted] into a portable version of the
|
||||
//! typeset document. The output of this is a vector of [`Frame`]s
|
||||
//! (corresponding to pages), ready for exporting.
|
||||
//! - **Exporting:** The finished layout can be exported into a supported
|
||||
//! format. Submodules for these formats are located in the [export] module.
|
||||
|
@ -39,7 +39,7 @@ impl PaperClass {
|
||||
/// The default margins for this page class.
|
||||
pub fn default_margins(self) -> Sides<Linear> {
|
||||
let f = |r| Relative::new(r).into();
|
||||
let s = |l, r, t, b| Sides::new(f(l), f(r), f(t), f(b));
|
||||
let s = |l, t, r, b| Sides::new(f(l), f(t), f(r), f(b));
|
||||
match self {
|
||||
Self::Custom => s(0.1190, 0.0842, 0.1190, 0.0842),
|
||||
Self::Base => s(0.1190, 0.0842, 0.1190, 0.0842),
|
||||
|
@ -114,16 +114,16 @@
|
||||
},
|
||||
{
|
||||
"name": "keyword.control.typst",
|
||||
"match": "(#)(break|continue|return)",
|
||||
"match": "(#)(break|continue|return)\\b",
|
||||
"captures": { "1": { "name": "punctuation.definition.keyword.typst" } }
|
||||
},
|
||||
{
|
||||
"name": "keyword.other.typst",
|
||||
"match": "(#)from",
|
||||
"match": "(#)(from|in)\\b",
|
||||
"captures": { "1": { "name": "punctuation.definition.keyword.typst" } }
|
||||
},
|
||||
{
|
||||
"begin": "(#)pub",
|
||||
"begin": "(#)(pub|let)\\b",
|
||||
"end": "\n|(;)|(?=])|(?<=}|])",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "keyword.other.typst" },
|
||||
@ -133,17 +133,7 @@
|
||||
"patterns": [{ "include": "#code" }]
|
||||
},
|
||||
{
|
||||
"begin": "(#)let",
|
||||
"end": "\n|;|(?=])|(?<=}|])",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "keyword.other.typst" },
|
||||
"1": { "name": "punctuation.definition.keyword.typst" }
|
||||
},
|
||||
"endCaptures": { "1": { "name": "punctuation.terminator.statement.typst" } },
|
||||
"patterns": [{ "include": "#code" }]
|
||||
},
|
||||
{
|
||||
"begin": "(#)if",
|
||||
"begin": "(#)(if|else)\\b",
|
||||
"end": "\n|(?=])|(?<=}|])",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "keyword.control.conditional.typst" },
|
||||
@ -152,16 +142,7 @@
|
||||
"patterns": [{ "include": "#code" }]
|
||||
},
|
||||
{
|
||||
"begin": "(#)else",
|
||||
"end": "\n|(?=])|(?<=}|])",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "keyword.control.conditional.typst" },
|
||||
"1": { "name": "punctuation.definition.keyword.typst" }
|
||||
},
|
||||
"patterns": [{ "include": "#code" }]
|
||||
},
|
||||
{
|
||||
"begin": "(#)for",
|
||||
"begin": "(#)(for|while)\\b",
|
||||
"end": "\n|(?=])|(?<=}|])",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "keyword.control.typst" },
|
||||
@ -170,16 +151,7 @@
|
||||
"patterns": [{ "include": "#code" }]
|
||||
},
|
||||
{
|
||||
"begin": "(#)while",
|
||||
"end": "\n|(?=])|(?<=}|])",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "keyword.control.typst" },
|
||||
"1": { "name": "punctuation.definition.keyword.typst" }
|
||||
},
|
||||
"patterns": [{ "include": "#code" }]
|
||||
},
|
||||
{
|
||||
"begin": "(#)import",
|
||||
"begin": "(#)import\\b",
|
||||
"end": "\n|(?=])",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "keyword.control.import.typst" },
|
||||
@ -190,12 +162,12 @@
|
||||
{
|
||||
"comment": "Function name",
|
||||
"name": "entity.name.function.typst",
|
||||
"match": "((#)[[:alpha:]_][[:alnum:]_-]*)(?=\\[|\\()",
|
||||
"match": "((#)[[:alpha:]_][[:alnum:]_-]*!?)(?=\\[|\\()",
|
||||
"captures": { "2": { "name": "punctuation.definition.function.typst" } }
|
||||
},
|
||||
{
|
||||
"comment": "Function arguments",
|
||||
"begin": "(?<=#[[:alpha:]_][[:alnum:]_-]*)\\(",
|
||||
"begin": "(?<=#[[:alpha:]_][[:alnum:]_-]*!?)\\(",
|
||||
"end": "\\)",
|
||||
"captures": { "0": { "name": "punctuation.definition.group.typst" } },
|
||||
"patterns": [{ "include": "#arguments" }]
|
||||
@ -232,7 +204,7 @@
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.arithmetic.typst",
|
||||
"match": "\\+|\\*|/|(?<![[:alpha:]_][[:alnum:]_-]*)-(?![:alnum:]_-]*[[:alpha:]_])"
|
||||
"match": "\\+|\\*!?|/|(?<![[:alpha:]_][[:alnum:]_-]*)-(?![:alnum:]_-]*[[:alpha:]_])"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.word.typst",
|
||||
@ -250,11 +222,11 @@
|
||||
{
|
||||
"comment": "Function name",
|
||||
"name": "entity.name.function.typst",
|
||||
"match": "\\b[[:alpha:]_][[:alnum:]_-]*(?=\\[|\\()"
|
||||
"match": "\\b[[:alpha:]_][[:alnum:]_-]*!?(?=\\[|\\()"
|
||||
},
|
||||
{
|
||||
"comment": "Function arguments",
|
||||
"begin": "(?<=\\b[[:alpha:]_][[:alnum:]_-]*)\\(",
|
||||
"begin": "(?<=\\b[[:alpha:]_][[:alnum:]_-]*!?)\\(",
|
||||
"end": "\\)",
|
||||
"captures": { "0": { "name": "punctuation.definition.group.typst" } },
|
||||
"patterns": [{ "include": "#arguments" }]
|
||||
|
Loading…
x
Reference in New Issue
Block a user