brand-intent 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/parser/formatParser.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface ParsedFormat {
|
|
|
20
20
|
label: string;
|
|
21
21
|
sublabel: string;
|
|
22
22
|
category: 'instagram' | 'facebook' | 'linkedin' | 'print' | 'signage';
|
|
23
|
+
/** How the page is posted (from `post:`). Absent = the format is not posted. */
|
|
24
|
+
post?: 'feed' | 'story';
|
|
23
25
|
// Pixel dimensions (always present — computed from mm+dpi for print/signage)
|
|
24
26
|
widthPx: number;
|
|
25
27
|
heightPx: number;
|
|
@@ -97,6 +99,7 @@ export function parseFormatFile(content: string, fileName: string): ParsedFormat
|
|
|
97
99
|
let label: string | undefined;
|
|
98
100
|
let sublabel: string | undefined;
|
|
99
101
|
let category: ParsedFormat['category'] | undefined;
|
|
102
|
+
let post: ParsedFormat['post'];
|
|
100
103
|
let widthPx: number | undefined;
|
|
101
104
|
let heightPx: number | undefined;
|
|
102
105
|
let widthMm: number | undefined;
|
|
@@ -146,6 +149,12 @@ export function parseFormatFile(content: string, fileName: string): ParsedFormat
|
|
|
146
149
|
category = value;
|
|
147
150
|
break;
|
|
148
151
|
|
|
152
|
+
case 'post':
|
|
153
|
+
if (value !== 'feed' && value !== 'story')
|
|
154
|
+
throw new Error(`${fileName}:${lineNum}: post must be feed or story, got "${value}"`);
|
|
155
|
+
post = value;
|
|
156
|
+
break;
|
|
157
|
+
|
|
149
158
|
case 'size': {
|
|
150
159
|
// "1080 1350" (px) or "594mm 297mm" (mm)
|
|
151
160
|
const parts = value.split(/\s+/);
|
|
@@ -261,7 +270,7 @@ export function parseFormatFile(content: string, fileName: string): ParsedFormat
|
|
|
261
270
|
}
|
|
262
271
|
|
|
263
272
|
return {
|
|
264
|
-
id, name, label, sublabel, category,
|
|
273
|
+
id, name, label, sublabel, category, post,
|
|
265
274
|
widthPx, heightPx,
|
|
266
275
|
widthMm, heightMm,
|
|
267
276
|
dpi: dpi ?? (category === 'print' || category === 'signage' ? effectiveDpi : undefined),
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
{ "include": "#id-field" },
|
|
7
7
|
{ "include": "#name-field" },
|
|
8
8
|
{ "include": "#category" },
|
|
9
|
+
{ "include": "#post" },
|
|
9
10
|
{ "include": "#purposes" },
|
|
10
11
|
{ "include": "#size" },
|
|
11
12
|
{ "include": "#grid" },
|
|
@@ -40,6 +41,13 @@
|
|
|
40
41
|
"2": { "name": "entity.name.tag.brand-intent-format" }
|
|
41
42
|
}
|
|
42
43
|
},
|
|
44
|
+
"post": {
|
|
45
|
+
"match": "^(post:)\\s+(feed|story)",
|
|
46
|
+
"captures": {
|
|
47
|
+
"1": { "name": "keyword.control.brand-intent-format" },
|
|
48
|
+
"2": { "name": "entity.name.tag.brand-intent-format" }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
43
51
|
"purposes": {
|
|
44
52
|
"match": "^(purposes:)\\s+(.*)",
|
|
45
53
|
"captures": {
|
|
@@ -86,7 +94,7 @@
|
|
|
86
94
|
},
|
|
87
95
|
"keyword-partial": {
|
|
88
96
|
"comment": "Fallback: color the keyword token on incomplete lines (while typing)",
|
|
89
|
-
"match": "^(id:|name:|category:|purposes:|size:|grid:|dpi:|bleed:|comfort:|danger:|crop:|label:|sublabel:)(?=\\s|$)",
|
|
97
|
+
"match": "^(id:|name:|category:|post:|purposes:|size:|grid:|dpi:|bleed:|comfort:|danger:|crop:|label:|sublabel:)(?=\\s|$)",
|
|
90
98
|
"captures": {
|
|
91
99
|
"1": { "name": "keyword.control.brand-intent-format" }
|
|
92
100
|
}
|