11<?php
22
33/*!
4- * Pattern Lab Builder Class - v0.7.1
4+ * Pattern Lab Builder Class - v0.7.2
55 *
66 * Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com
77 * Licensed under the MIT license
@@ -77,8 +77,8 @@ public function __construct($config = array()) {
7777 }
7878
7979 // set-up the source & public dirs
80- $ this ->sp = "/../../../source/_patterns/ " ;
81- $ this ->pp = "/../../../public/patterns/ " ;
80+ $ this ->sp = "/../../../source/_patterns " . DIRECTORY_SEPARATOR ;
81+ $ this ->pp = "/../../../public/patterns " . DIRECTORY_SEPARATOR ;
8282 $ this ->sd = __DIR__ ."/../../../source " ;
8383 $ this ->pd = __DIR__ ."/../../../public " ;
8484
@@ -504,6 +504,7 @@ protected function gatherPatternInfo() {
504504 $ patternType = "" ;
505505 $ patternSubtype = "" ;
506506 $ patternSubtypeSet = false ;
507+ $ dirSep = DIRECTORY_SEPARATOR ;
507508
508509 // initialize various arrays
509510 $ this ->navItems = array ();
@@ -521,7 +522,7 @@ protected function gatherPatternInfo() {
521522 foreach ($ patternObjects as $ name => $ object ) {
522523
523524 $ name = str_replace (__DIR__ .$ this ->sp ,"" ,$ name );
524- $ depth = substr_count ($ name ," / " );
525+ $ depth = substr_count ($ name ,$ dirSep );
525526
526527 // track old types and subtypes for increment purposes
527528
@@ -587,15 +588,15 @@ protected function gatherPatternInfo() {
587588 * Mustache patterns
588589 *************************************/
589590
590- $ patternFull = $ object ->getFilename (); // 00-colors.mustache
591- $ pattern = str_replace (".mustache " ,"" ,$ patternFull ); // 00-colors
591+ $ patternFull = $ object ->getFilename (); // 00-colors.mustache
592+ $ pattern = str_replace (".mustache " ,"" ,$ patternFull ); // 00-colors
592593
593594 if ($ patternSubtypeSet ) {
594- $ patternPath = $ patternType ." / " .$ patternSubtype ." / " .$ pattern ; // 00-atoms/01-global/00-colors
595- $ patternPathDash = str_replace (" / " ,"- " ,$ patternPath ); // 00-atoms-01-global-00-colors (file path)
595+ $ patternPath = $ patternType .$ dirSep .$ patternSubtype .$ dirSep .$ pattern ; // 00-atoms/01-global/00-colors
596+ $ patternPathDash = str_replace ($ dirSep ,"- " ,$ patternPath ); // 00-atoms-01-global-00-colors (file path)
596597 } else {
597- $ patternPath = $ patternType ." / " .$ pattern ; // 00-atoms/00-colors
598- $ patternPathDash = str_replace (" / " ,"- " ,$ patternPath ); // 00-atoms-00-colors (file path)
598+ $ patternPath = $ patternType .$ dirSep .$ pattern ; // 00-atoms/00-colors
599+ $ patternPathDash = str_replace ($ dirSep ,"- " ,$ patternPath ); // 00-atoms-00-colors (file path)
599600 }
600601
601602 // track to see if this pattern should get rendered
@@ -605,9 +606,9 @@ protected function gatherPatternInfo() {
605606 if ($ patternFull [0 ] != "_ " ) {
606607
607608 // set-up the names
608- $ patternDash = $ this ->getPatternName ($ pattern ,false ); // colors
609- $ patternClean = str_replace ("- " ," " ,$ patternDash ); // colors (dashes replaced with spaces)
610- $ patternPartial = $ patternTypeDash ."- " .$ patternDash ; // atoms-colors
609+ $ patternDash = $ this ->getPatternName ($ pattern ,false ); // colors
610+ $ patternClean = str_replace ("- " ," " ,$ patternDash ); // colors (dashes replaced with spaces)
611+ $ patternPartial = $ patternTypeDash ."- " .$ patternDash ; // atoms-colors
611612
612613 // set-up the info for the nav
613614 $ patternInfo = array ("patternPath " => $ patternPathDash ."/ " .$ patternPathDash .".html " ,
@@ -667,11 +668,11 @@ protected function gatherPatternInfo() {
667668
668669 // add to patternPaths
669670 if ($ patternSubtypeSet ) {
670- $ patternPath = $ patternType ." / " .$ patternSubtype ." / " .$ pattern ; // 00-atoms/01-global/00-colors
671- $ patternPathDash = str_replace (" / " ,"- " ,$ patternPath ); // 00-atoms-01-global-00-colors (file path)
671+ $ patternPath = $ patternType .$ dirSep .$ patternSubtype .$ dirSep .$ pattern ; // 00-atoms/01-global/00-colors
672+ $ patternPathDash = str_replace ($ dirSep ,"- " ,$ patternPath ); // 00-atoms-01-global-00-colors (file path)
672673 } else {
673- $ patternPath = $ patternType ." / " .$ pattern ; // 00-atoms/00-colors
674- $ patternPathDash = str_replace (" / " ,"- " ,$ patternPath ); // 00-atoms-00-colors (file path)
674+ $ patternPath = $ patternType .$ dirSep .$ pattern ; // 00-atoms/00-colors
675+ $ patternPathDash = str_replace ($ dirSep ,"- " ,$ patternPath ); // 00-atoms-00-colors (file path)
675676 }
676677
677678 // add all patterns to patternPaths
0 commit comments