diff --git a/examples/ftp-test.txt b/examples/ftp-test.txt
index 9bdc5e8..1d4ec32 100644
--- a/examples/ftp-test.txt
+++ b/examples/ftp-test.txt
@@ -8,6 +8,7 @@ Description:
you will be scored on the final 20 minute segment.
Upon saving your ride, you will be notified if your FTP improved.
+Tags: FTP, Test
Warmup: 5:00 30%..70%
@ 00:20 Welcome to the FTP test
diff --git a/examples/halvfems.txt b/examples/halvfems.txt
index d7723c9..56bd1e9 100644
--- a/examples/halvfems.txt
+++ b/examples/halvfems.txt
@@ -3,6 +3,7 @@ Description:
Named after the number 90 in Danish, this workout is focused sweet spot training, centered around 90% of FTP.
This pairs with Devedeset (90 in Croatian) and Novanta (90 in Italian) to make up the sweet spot trifecta in this plan.
The workouts are alphabetically ordered from easiest to hardest, so enjoy the middle of these three challenging workouts today...
+Tags: Intervals
Warmup: 7:00 25%..75%
Interval: 00:30 95rpm 95%
diff --git a/src/generateZwo.ts b/src/generateZwo.ts
index f1972d9..cbdb357 100644
--- a/src/generateZwo.ts
+++ b/src/generateZwo.ts
@@ -96,13 +96,20 @@ const generateInterval = (interval: Interval | RepeatedInterval): xml.XmlObject
}
};
-export const generateZwo = ({ name, author, description, intervals }: Workout): string => {
+const generateTag = (name: string): xml.XmlObject => {
+ return {
+ tag: [{ _attr: { name } }],
+ };
+};
+
+export const generateZwo = ({ name, author, description, tags, intervals }: Workout): string => {
return xml(
{
workout_file: [
{ name: name },
{ author: author },
{ description: description },
+ { tags: tags.map(generateTag) },
{ sportType: "bike" },
{ workout: detectRepeats(intervals).map(generateInterval) },
],
diff --git a/test/__snapshots__/cli.test.ts.snap b/test/__snapshots__/cli.test.ts.snap
index 6284895..298b782 100644
--- a/test/__snapshots__/cli.test.ts.snap
+++ b/test/__snapshots__/cli.test.ts.snap
@@ -5,6 +5,8 @@ exports[`Generate ZWO examples/comments.txt 1`] = `
Workout with comments
+
+
bike
@@ -70,6 +72,8 @@ exports[`Generate ZWO examples/darth-vader.txt 1`] = `
Darth Vader
HumanPowerPerformance.com
Sign up for coaching with HumanPowerPerformance.com and get custom workouts and training plans
+
+
bike
@@ -93,6 +97,12 @@ Pace yourself and try to go as hard as you can sustain for the entire 20 minutes
you will be scored on the final 20 minute segment.
Upon saving your ride, you will be notified if your FTP improved.
+
+
+
+
+
+
bike
@@ -154,6 +164,10 @@ exports[`Generate ZWO examples/halvfems.txt 1`] = `
Named after the number 90 in Danish, this workout is focused sweet spot training, centered around 90% of FTP.
This pairs with Devedeset (90 in Croatian) and Novanta (90 in Italian) to make up the sweet spot trifecta in this plan.
The workouts are alphabetically ordered from easiest to hardest, so enjoy the middle of these three challenging workouts today...
+
+
+
+
bike
@@ -224,6 +238,8 @@ This session is designed to increase your FTP from below.
Working predominately aerobic metabolism.
In time your body will become more comfortable at these powers
and your FTP will increase.
+
+
bike