brand-intent 0.30.0 → 0.31.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 +1 -1
- package/parser/storyParser.ts +7 -4
package/package.json
CHANGED
package/parser/storyParser.ts
CHANGED
|
@@ -40,8 +40,9 @@ export interface ParsedStoryPage {
|
|
|
40
40
|
composition?: string;
|
|
41
41
|
/** Illustration ids; implementations pick one per story date, the same one every time for that date. */
|
|
42
42
|
illustrations?: string[];
|
|
43
|
-
/** Photo
|
|
44
|
-
|
|
43
|
+
/** Photo ids; override the purpose's `photo:` default for this page. Implementations pick one per
|
|
44
|
+
* story date, the same one every time for that date. */
|
|
45
|
+
photos?: string[];
|
|
45
46
|
/** Page topic: what this page adds to the story. */
|
|
46
47
|
topic?: string;
|
|
47
48
|
/** Fixed slot texts, may contain `{variable}`s. A slot the page doesn't name is open. */
|
|
@@ -198,7 +199,7 @@ export function parseStoryFile(content: string, fileName: string): ParsedStory {
|
|
|
198
199
|
if (read && 'multi' in read) { multiKey = read.multi; multiIndent = 4; }
|
|
199
200
|
else if (read?.key === 'purpose') currentPage.purpose = read.value;
|
|
200
201
|
else if (read?.key === 'illustration') currentPage.illustrations = read.value.split(',').map(id => id.trim()).filter(Boolean);
|
|
201
|
-
else if (read?.key === 'photo') currentPage.
|
|
202
|
+
else if (read?.key === 'photo') currentPage.photos = read.value.split(',').map(id => id.trim()).filter(Boolean);
|
|
202
203
|
else if (read) currentPage.composition = read.value;
|
|
203
204
|
continue;
|
|
204
205
|
}
|
|
@@ -317,7 +318,9 @@ export function checkStory(
|
|
|
317
318
|
for (const id of page.illustrations ?? []) {
|
|
318
319
|
if (brand.illustrations && !brand.illustrations.includes(id)) say(`${where}: illustration "${id}" does not exist`);
|
|
319
320
|
}
|
|
320
|
-
|
|
321
|
+
for (const id of page.photos ?? []) {
|
|
322
|
+
if (brand.photos && !brand.photos.includes(id)) say(`${where}: photo "${id}" does not exist`);
|
|
323
|
+
}
|
|
321
324
|
checkTexts(where, purpose, page.texts);
|
|
322
325
|
});
|
|
323
326
|
story.examples.forEach((ex, i) => {
|