pkl icon indicating copy to clipboard operation
pkl copied to clipboard

Minor discrepancy in tutorial part 3 (version 0.25.1)

Open Edward-Knight opened this issue 1 year ago • 2 comments

In the Typed objects, properties and amending section, the TutorialPart.pkl has a name: String property, but in the next section (A new template) in the workshop2023.pkl example the agenda (which I assume is to be an agenda: Mapping<String, TutorialPart> from Workshop.pkl) uses title instead of name:

https://github.com/apple/pkl/blob/15439095667dfe102934811e58ed677601b17deb/docs/modules/language-tutorial/pages/03_writing_a_template.adoc?plain=1#L189-L203

https://github.com/apple/pkl/blob/15439095667dfe102934811e58ed677601b17deb/docs/modules/language-tutorial/pages/03_writing_a_template.adoc?plain=1#L305-L310

After following along with the tutorial, adding amends "Workshop.pkl" to the top of workshop2023.pkl resulted in the error:

–– Pkl Error ––
Cannot find property `title` in module `TutorialPart`.

43 | title = "Basic Configuration"
     ^^^^^
at workshop2023#agenda["beginners"] (file://.../workshop2023.pkl, line 43)

Available properties in module `TutorialPart`:
amountLearned
bandwidthRequirementPerSecond
duration
hasExercises
name
output
part

41 | agenda {
     ^^^^^^^^
at workshop2023#agenda (file://.../workshop2023.pkl, line 41)

106 | text = renderer.renderDocument(value)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at pkl.base#Module.output.text (https://github.com/apple/pkl/blob/0.25.1/stdlib/base.pkl#L106)

Edward-Knight avatar Feb 03 '24 15:02 Edward-Knight

I belive this patch should fix:

diff --git a/docs/modules/language-tutorial/pages/03_writing_a_template.adoc b/docs/modules/language-tutorial/pages/03_writing_a_template.adoc
index cf7024c..2bce6c7 100644
--- a/docs/modules/language-tutorial/pages/03_writing_a_template.adoc
+++ b/docs/modules/language-tutorial/pages/03_writing_a_template.adoc
@@ -304,17 +304,17 @@ assistants {
 
 agenda {
   ["beginners"] {
-    title = "Basic Configuration"
+    name = "Basic Configuration"
     part = 1
     duration = 45.min
   }
   ["intermediates"] {
-    title = "Filling out a Template"
+    name = "Filling out a Template"
     part = 2
     duration = 45.min
   }
   ["experts"] {
-    title = "Writing a Template"
+    name = "Writing a Template"
     part = 3
     duration = 45.min
   }

Edward-Knight avatar Feb 03 '24 15:02 Edward-Knight

Happy to take this as-is, but also happy for you to do this by PR and get proper contributor attribution.

holzensp avatar Feb 05 '24 10:02 holzensp