@@ -114,11 +114,16 @@ earlyAccessContentAndDataFiles
114114console . log ( 'Done! Run "git status" in your docs-early-access checkout to see the changes.\n' )
115115
116116function checkVariable ( dataRef ) {
117- // Get the data file path from the data reference
117+ // Get the data filepath from the data reference,
118+ // where the data reference looks like: {% data variables.foo.bar %}
119+ // and the data filepath looks like: data/variables/foo.yml with key of 'bar'.
118120 const variablePathArray = dataRef . match ( / { % d a t a ( .* ?) % } / ) [ 1 ] . split ( '.' )
119121 // If early access is part of the path, remove it (since the path below already includes it)
120122 . filter ( n => n !== 'early-access' )
121123
124+ // Given a string `variables.foo.bar` split into an array, we want the last segment 'bar', which is the variable key.
125+ // Then pop 'bar' off the array because it's not really part of the filepath.
126+ // The filepath we want is `variables/foo.yml`.
122127 const variableKey = last ( variablePathArray ) ; variablePathArray . pop ( )
123128 const variablePath = path . posix . join ( earlyAccessData , `${ variablePathArray . join ( '/' ) } .yml` )
124129
@@ -131,6 +136,9 @@ function checkVariable (dataRef) {
131136}
132137
133138function checkReusable ( dataRef ) {
139+ // Get the data filepath from the data reference,
140+ // where the data reference looks like: {% data reusables.foo.bar %}
141+ // and the data filepath looks like: data/reusables/foo/bar.md.
134142 const reusablePath = dataRef . match ( / { % d a t a ( .* ?) % } / ) [ 1 ] . split ( '.' )
135143 // If early access is part of the path, remove it (since the path below already includes it)
136144 . filter ( n => n !== 'early-access' )
0 commit comments