@@ -114,11 +114,16 @@ earlyAccessContentAndDataFiles
114
114
console . log ( 'Done! Run "git status" in your docs-early-access checkout to see the changes.\n' )
115
115
116
116
function 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'.
118
120
const variablePathArray = dataRef . match ( / { % d a t a ( .* ?) % } / ) [ 1 ] . split ( '.' )
119
121
// If early access is part of the path, remove it (since the path below already includes it)
120
122
. filter ( n => n !== 'early-access' )
121
123
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`.
122
127
const variableKey = last ( variablePathArray ) ; variablePathArray . pop ( )
123
128
const variablePath = path . posix . join ( earlyAccessData , `${ variablePathArray . join ( '/' ) } .yml` )
124
129
@@ -131,6 +136,9 @@ function checkVariable (dataRef) {
131
136
}
132
137
133
138
function 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.
134
142
const reusablePath = dataRef . match ( / { % d a t a ( .* ?) % } / ) [ 1 ] . split ( '.' )
135
143
// If early access is part of the path, remove it (since the path below already includes it)
136
144
. filter ( n => n !== 'early-access' )
0 commit comments