File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
src/PatternLab/PatternData/Helpers Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1919
2020class LineageHelper extends \PatternLab \PatternData \Helper {
2121
22+ protected $ lineageMatch ;
23+ protected $ lineageMatchKey ;
24+
2225 public function __construct ($ options = array ()) {
2326
2427 parent ::__construct ($ options );
2528
29+ $ this ->lineageMatch = Config::getOption ("lineageMatch " );
30+ $ this ->lineageMatchKey = Config::getOption ("lineageMatchKey " );
31+
2632 }
2733
2834 public function run () {
@@ -160,14 +166,13 @@ public function run() {
160166
161167 /**
162168 * Get the lineage for a given pattern by parsing it and matching mustache partials
163- * @param {String} the filename for the pattern to be parsed
169+ * @param {String} the data from the raw pattern
164170 *
165171 * @return {Array} a list of patterns
166172 */
167- protected function findLineages ($ filename ) {
168- $ data = file_get_contents ($ filename );
169- if (preg_match_all ('/{{>([ ]+)?([A-Za-z0-9-_]+)(?:\:[A-Za-z0-9-]+)?(?:(| )\(.*)?([ ]+)?}}/ ' ,$ data ,$ matches )) {
170- return array_unique ($ matches [2 ]);
173+ protected function findLineages ($ data ) {
174+ if (preg_match_all ("/ " .$ this ->lineageMatch ."/ " ,$ data ,$ matches )) {
175+ return array_unique ($ matches [$ this ->lineageMatchKey ]);
171176 }
172177 return array ();
173178 }
You can’t perform that action at this time.
0 commit comments