diff --git a/README.md b/README.md index 545e151..27a87d3 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Checkout a [complete training plan for 80K ultra](https://docs.google.com/spread - Java 8 is a prerequisite, make sure you have it installed - Go to the [releases page](https://github.com/mgifos/quick-plan/releases) of this project - Download latest release zip file and unzip it somewhere on your computer -- Enter bin folder and run `quick-plan` command (use `quick-plan.bat` if you are a Windows user) +- Enter bin folder and run `quick-plan` command (use `quick-plan.bat` if you are a Windows user or mark quick-plan script as executable on Linux or Mac systems) ## Command line options @@ -73,6 +73,8 @@ The reserved keywords of the notation are: workout, warmup, cooldown, run, repea **`
`** := `workout: ` +**``** := `[\u0020-\u007F]+` (printable ascii characters) + **``** := `- ` **``** := ` | ` diff --git a/src/main/scala/com.github.mgifos.workouts/model/Workout.scala b/src/main/scala/com.github.mgifos.workouts/model/Workout.scala index 48461ea..50ea901 100644 --- a/src/main/scala/com.github.mgifos.workouts/model/Workout.scala +++ b/src/main/scala/com.github.mgifos.workouts/model/Workout.scala @@ -33,7 +33,7 @@ case class WorkoutNote(note: String) extends Workout { object Workout { - private val WorkoutName = """^workout:\s([\w \-,;:\.@]+)((\n\s*\-\s[a-z]+:.*)*)$""".r + private val WorkoutName = """^workout:\s([\u0020-\u007F]+)((\n\s*\-\s[a-z]+:.*)*)$""".r private val NextStepRx = """^((-\s\w*:\s.*)((\n\s{1,}-\s.*)*))(([\s].*)*)$""".r def parseDef(x: String): Either[String, WorkoutDef] = { diff --git a/src/test/scala/com/github/mgifos/workouts/model/WorkoutSpec.scala b/src/test/scala/com/github/mgifos/workouts/model/WorkoutSpec.scala index d0e6df0..947efc2 100644 --- a/src/test/scala/com/github/mgifos/workouts/model/WorkoutSpec.scala +++ b/src/test/scala/com/github/mgifos/workouts/model/WorkoutSpec.scala @@ -34,6 +34,18 @@ class WorkoutSpec extends FlatSpec with Matchers { CooldownStep(LapButtonPressed))))) } + "Workout" should "parse various printable workout-names correctly" in { + + val testNames = Seq("abcz", "123 xyw", """abc!/+-@,?*;:_!\"#$%&/()=?*""") + + testNames.foreach { testName => + val x = Workout.parseDef(testWO.replace("run-fast", testName)) + println(x) + x.right.get.name should be(testName) + } + } + + "Workout" should "dump json correctly" in { val is = getClass.getClassLoader.getResourceAsStream("run-fast.json") val expectJson = Json.parse(is)