Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PatternLab/PatternData/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function compareProp($name, $propCompare, $exact = false) {
*/
protected function getPatternName($pattern, $clean = true) {
$patternBits = explode("-",$pattern,2);
$patternName = (((int)$patternBits[0] != 0) || ($patternBits[0] == '00')) ? $patternBits[1] : $pattern;
$patternName = (((int)$patternBits[0] != 0) || (preg_match('/^0+$/', $patternBits[0]) === 1)) ? $patternBits[1] : $pattern;
return ($clean) ? (str_replace("-"," ",$patternName)) : $patternName;
}

Expand Down
18 changes: 14 additions & 4 deletions src/PatternLab/PatternData/Rules/PseudoPatternRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,21 @@ public function run($depth, $ext, $path, $pathName, $name) {

// check the original pattern path. if it doesn't exist make a guess
$patternPathOrig = PatternData::getPatternOption($patternBaseOrig,"pathName"); // 04-pages/00-homepage
$patternPathOrigDash = PatternData::getPatternOption($patternBaseOrig,"pathDash"); // 04-pages-00-homepage
$patternPathOrigDash = PatternData::getPatternOption($patternBaseOrig,"pathDash"); // 04-pages-00-homepage
if (!$patternPathOrig) {
$patternPathOrigBits = explode("~",$pathName);
$patternPathOrig = $patternPathOrigBits[0]; // 04-pages/00-homepage
$patternPathOrigDash = str_replace($dirSep,"-",$patternPathOrig); // 04-pages-00-homepage

if (($patternBase . $ext) != $patternFull) {
$patternPathOrig = $path . DIRECTORY_SEPARATOR . $patternBaseDash; // 04-pages/homepage
$patternPathOrigDash = str_replace($dirSep,"-",$patternPathOrig); // 04-pages-homepage

if ( ! file_exists(Config::getOption("patternSourceDir").DIRECTORY_SEPARATOR.$patternPathOrig.'.'.Config::getOption("patternExtension"))) {
$patternPathOrig = $path . DIRECTORY_SEPARATOR . '_' . $patternBaseDash; // 04-pages/_homepage
}
} else {
$patternPathOrigBits = explode("~",$pathName);
$patternPathOrig = $patternPathOrigBits[0]; // 04-pages/00-homepage
$patternPathOrigDash = str_replace($dirSep,"-",$patternPathOrig); // 04-pages-00-homepage
}
}

// create a key for the data store
Expand Down