diff --git a/README.md b/README.md index dca867d..61063eb 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ Write a workout description like: ``` Name: Sample workout Author: John Doe +Tags: Recovery, Intervals, FTP Description: Try changing it, and see what happens below. Warmup: 10:00 30%..75% @@ -114,7 +115,6 @@ console.log(stats(workout)); - Repeats (and nested repeats) - Unsupported params: message duration & y-position - More restricted syntax for text (with quotes) -- Support for tags [zwift]: https://zwift.com/ [zwofactory]: https://zwofactory.com/ diff --git a/src/ast.ts b/src/ast.ts index d3ddf45..a72cdc3 100644 --- a/src/ast.ts +++ b/src/ast.ts @@ -6,6 +6,7 @@ export type Workout = { name: string; author: string; description: string; + tags: string[]; intervals: Interval[]; }; diff --git a/src/parser/parser.test.ts b/src/parser/parser.test.ts index 2a6426f..2adf239 100644 --- a/src/parser/parser.test.ts +++ b/src/parser/parser.test.ts @@ -8,6 +8,7 @@ describe("Parser", () => { "description": "", "intervals": Array [], "name": "Untitled", + "tags": Array [], } `); @@ -17,6 +18,7 @@ describe("Parser", () => { "description": "", "intervals": Array [], "name": "Untitled", + "tags": Array [], } `); }); @@ -28,6 +30,7 @@ describe("Parser", () => { "description": "", "intervals": Array [], "name": "My Workout", + "tags": Array [], } `); }); @@ -52,6 +55,7 @@ Description: it'll cause lots of pain.", "intervals": Array [], "name": "My Workout", + "tags": Array [], } `); }); @@ -175,6 +179,7 @@ Interval: 5:00 50% }, ], "name": "My Workout", + "tags": Array [], } `); }); @@ -477,6 +482,7 @@ Rest: 5:00 50% }, ], "name": "My Workout", + "tags": Array [], } `); }); diff --git a/src/parser/parser.ts b/src/parser/parser.ts index 84b2a69..a6aee0d 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -138,6 +138,7 @@ export const parseTokens = (tokens: Token[]): Workout => { name: header.name || "Untitled", author: header.author || "", description: header.description || "", + tags: [], intervals: parseIntervals(intervalTokens), }; };