Document markup and improve choice tags
This commit is contained in:
@@ -23,6 +23,14 @@ export function parseTag(raw: string): StoryTag | null {
|
||||
return tag;
|
||||
}
|
||||
|
||||
const colonMatch = text.match(/^([A-Za-z][\w-]*)\s*:\s*(.*?)\s*(?:\(([^)]*)\))?$/);
|
||||
if (colonMatch) {
|
||||
const tag: StoryTag = { key: normalizeKey(colonMatch[1]) };
|
||||
tag.value = colonMatch[2].trim();
|
||||
if (typeof colonMatch[3] !== 'undefined') tag.param = colonMatch[3].trim();
|
||||
return tag;
|
||||
}
|
||||
|
||||
const bareMatch = text.match(/^[A-Za-z][\w-]*$/);
|
||||
if (bareMatch) {
|
||||
return { key: normalizeKey(text) };
|
||||
|
||||
Reference in New Issue
Block a user