public function __construct($options = array())
 {
     parent::__construct($options);
     $this->store = PatternData::get();
     $this->cacheBuster = Data::getOption("cacheBuster");
     $this->styleGuideExcludes = Config::getOption("styleGuideExcludes");
 }
 /**
  * Compare the search and ignore props against the name.
  * Can use && or || in the comparison
  * @param  {String}       the type of the pattern that should be used in the view all
  * @param  {String}       the subtype of the pattern that be used in the view all
  *
  * @return {Array}        the list of partials
  */
 public function run($type = "", $subtype = "")
 {
     // default vars
     $patternPartials = array();
     $styleGuideExcludes = Config::getOption("styleGuideExcludes");
     $store = PatternData::get();
     foreach ($store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "pattern" && !$patternStoreData["hidden"] && !$patternStoreData["noviewall"] && $patternStoreData["depth"] == 2 && !in_array($patternStoreData["type"], $styleGuideExcludes)) {
             if ($patternStoreData["type"] == $type && empty($subtype) || empty($type) && empty($subtype) || $patternStoreData["type"] == $type && $patternStoreData["subtype"] == $subtype) {
                 $patternPartialData = array();
                 $patternPartialData["patternName"] = ucwords($patternStoreData["nameClean"]);
                 $patternPartialData["patternLink"] = $patternStoreData["pathDash"] . "/" . $patternStoreData["pathDash"] . ".html";
                 $patternPartialData["patternPartial"] = $patternStoreData["partial"];
                 $patternPartialData["patternPartialCode"] = $patternStoreData["code"];
                 $patternPartialData["patternLineageExists"] = isset($patternStoreData["lineages"]);
                 $patternPartialData["patternLineages"] = isset($patternStoreData["lineages"]) ? $patternStoreData["lineages"] : array();
                 $patternPartialData["patternLineageRExists"] = isset($patternStoreData["lineagesR"]);
                 $patternPartialData["patternLineagesR"] = isset($patternStoreData["lineagesR"]) ? $patternStoreData["lineagesR"] : array();
                 $patternPartialData["patternLineageEExists"] = isset($patternStoreData["lineages"]) || isset($patternStoreData["lineagesR"]);
                 $patternPartialData["patternDescExists"] = isset($patternStoreData["desc"]);
                 $patternPartialData["patternDesc"] = isset($patternStoreData["desc"]) ? $patternStoreData["desc"] : "";
                 $patternPartialData["patternDescAdditions"] = isset($patternStoreData["partialViewDescAdditions"]) ? $patternStoreData["partialViewDescAdditions"] : array();
                 $patternPartialData["patternExampleAdditions"] = isset($patternStoreData["partialViewExampleAdditions"]) ? $patternStoreData["partialViewExampleAdditions"] : array();
                 //$patternPartialData["patternCSSExists"]        = Config::$options["enableCSS"];
                 $patternPartialData["patternCSSExists"] = false;
                 $patternPartials[] = $patternPartialData;
             }
         }
     }
     return array("partials" => $patternPartials, "cacheBuster" => Data::getOption("cacheBuster"));
 }
 public function run()
 {
     // default vars
     $options = array();
     $options["patternPaths"] = $this->patternPaths;
     $patternExtension = Config::getOption("patternExtension");
     $patternSourceDir = Config::getOption("patternSourceDir");
     $htmlHead = Template::getHTMLHead();
     $htmlFoot = Template::getHTMLFoot();
     $patternHead = Template::getPatternHead();
     $patternFoot = Template::getPatternFoot();
     $stringLoader = Template::getStringLoader();
     // re-load the pattern data since we modified it
     $store = PatternData::get();
     // load the pattern loader
     $patternEngineBasePath = PatternEngine::getInstance()->getBasePath();
     $patternLoaderClass = $patternEngineBasePath . "\\Loaders\\PatternLoader";
     $patternLoader = new $patternLoaderClass($options);
     // iterate to process each pattern
     FileChangeList::touchParentPatterns($store);
     foreach ($store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "pattern" && !$patternStoreData["hidden"]) {
             $fileName = FileChangeList::getFileNameByPatternData($patternStoreData);
             if (!Config::getOption("update") || FileChangeList::hasChanged($fileName)) {
                 $data = Data::getPatternSpecificData($patternStoreKey);
                 // add the pattern data so it can be exported
                 $patternData = array();
                 //$patternFooterData["patternFooterData"]["cssEnabled"]      = (Config::$options["enableCSS"] && isset($this->patternCSS[$p])) ? "true" : "false";
                 $patternData["cssEnabled"] = false;
                 $patternData["lineage"] = isset($patternStoreData["lineages"]) ? $patternStoreData["lineages"] : array();
                 $patternData["lineageR"] = isset($patternStoreData["lineagesR"]) ? $patternStoreData["lineagesR"] : array();
                 $patternData["patternBreadcrumb"] = $patternStoreData["breadcrumb"];
                 $patternData["patternDesc"] = isset($patternStoreData["desc"]) ? $patternStoreData["desc"] : "";
                 $patternData["patternExtension"] = $patternExtension;
                 $patternData["patternName"] = $patternStoreData["nameClean"];
                 $patternData["patternPartial"] = $patternStoreData["partial"];
                 $patternData["patternState"] = $patternStoreData["state"];
                 // extra copy for the code view
                 $patternData["extraOutput"] = isset($patternStoreData["extraOutput"]) ? $patternStoreData["extraOutput"] : array();
                 // add the pattern lab specific mark-up
                 // set a default var
                 $exportClean = isset($options["exportClean"]) ? $options["exportClean"] : false;
                 $data["patternLabHead"] = !$this->exportFiles ? $stringLoader->render(array("string" => $htmlHead, "data" => array("cacheBuster" => $data["cacheBuster"]))) : "";
                 $data["patternLabFoot"] = !$this->exportFiles ? $stringLoader->render(array("string" => $htmlFoot, "data" => array("cacheBuster" => $data["cacheBuster"], "patternData" => json_encode($patternData)))) : "";
                 if (isset($patternStoreData["patternRaw"])) {
                     $header = !$this->exportClean ? $stringLoader->render(array("string" => $patternHead, "data" => $data)) : "";
                     $code = $patternLoader->render(array("pattern" => $patternStoreData["patternRaw"], "data" => $data));
                     $footer = !$this->exportClean ? $stringLoader->render(array("string" => $patternFoot, "data" => $data)) : "";
                     PatternData::setPatternOption($patternStoreKey, "header", $header);
                     PatternData::setPatternOption($patternStoreKey, "code", $code);
                     PatternData::setPatternOption($patternStoreKey, "footer", $footer);
                 }
             }
         }
     }
 }
 /**
  * Pulls together a bunch of functions from builder.lib.php in an order that makes sense
  * @param  {Boolean}       decide if CSS should be parsed and saved. performance hog.
  * @param  {Boolean}       decide if static files like CSS and JS should be moved
  */
 public function generate($options = array())
 {
     // double-checks options was properly set
     if (empty($options)) {
         Console::writeError("need to pass options to generate...");
     }
     // set the default vars
     $moveStatic = isset($options["moveStatic"]) ? $options["moveStatic"] : true;
     $noCacheBuster = isset($options["noCacheBuster"]) ? $options["noCacheBuster"] : false;
     $exportFiles = isset($options["exportFiles"]) ? $options["exportFiles"] : false;
     $exportClean = isset($options["exportClean"]) ? $options["exportClean"] : false;
     $watchMessage = isset($options["watchMessage"]) ? $options["watchMessage"] : false;
     $watchVerbose = isset($options["watchVerbose"]) ? $options["watchVerbose"] : false;
     $update = isset($options["update"]) ? $options["update"] : false;
     Config::setOption("update", $update);
     if ($noCacheBuster) {
         Config::updateOption("cacheBuster", 0);
     }
     FileChangeList::init(Config::getOption("publicDir") . DIRECTORY_SEPARATOR . "fileChangeList.csv");
     // gather up all of the data to be used in patterns
     Data::gather();
     // gather all of the various pattern info
     $options = array();
     $options["exportClean"] = $exportClean;
     $options["exportFiles"] = $exportFiles;
     PatternData::gather($options);
     // gather the annotations
     Annotations::gather();
     // clean the public directory to remove old files
     if (Config::getOption("cleanPublic") == "true" && $moveStatic) {
         FileUtil::cleanPublic();
     }
     // render out the index and style guide
     $this->generateIndex();
     $this->generateStyleguide();
     $this->generateViewAllPages();
     // render out the patterns and move them to public/patterns
     $options = array();
     $options["exportFiles"] = $exportFiles;
     $this->generatePatterns($options);
     // render the annotations as a js file
     $this->generateAnnotations();
     // move all of the files unless pattern only is set
     if ($moveStatic) {
         $this->moveStatic();
     }
     // update the change time so the auto-reload will fire (doesn't work for the index and style guide)
     Util::updateChangeTime();
     FileChangeList::write();
     if ($watchVerbose && $watchMessage) {
         Console::writeLine($watchMessage);
     } else {
         Console::writeLine("your site has been generated...");
         Timer::stop();
     }
 }
 public function run()
 {
     $store = PatternData::get();
     foreach ($store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "pattern") {
             $value = "../../" . $patternStoreData["pathDash"] . "/" . $patternStoreData["pathDash"] . ".html";
             Data::setOptionLink($patternStoreKey, $value);
         }
     }
 }
 /**
  * Go through data and replace any values that match items from the link.array
  * @param  {String}       an entry from one of the list-based config entries
  *
  * @return {String}       trimmed version of the given $v var
  */
 public static function compareReplace(&$value)
 {
     if (is_string($value)) {
         $valueCheck = strtolower($value);
         $valueThin = str_replace("link.", "", $valueCheck);
         $linkStore = Data::getOption("link");
         if (strpos($valueCheck, 'link.') !== false && array_key_exists($valueThin, $linkStore)) {
             $value = $linkStore[$valueThin];
         }
     }
 }
 public function run()
 {
     foreach ($this->store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "pattern") {
             if (isset($patternStoreData["pathDash"])) {
                 $value = "../../patterns/" . $patternStoreData["pathDash"] . "/" . $patternStoreData["pathDash"] . ".html";
                 Data::setOptionLink($patternStoreKey, $value);
             }
         }
     }
 }
 protected function doLeaveNode(\Twig_Node $node, \Twig_Environment $env)
 {
     if ($node instanceof \Twig_Node_Include) {
         if ($node->hasNode('expr') && $node->getNode('expr')->hasAttribute('value')) {
             $patternStoreKey = $node->getNode('expr')->getAttribute('value');
             $data = Data::getPatternSpecificData($patternStoreKey);
             $dataNode = new PatternDataIncludeNode($node, $data);
             return $dataNode;
         }
     }
     return $node;
 }
 /**
  * Compare the search and ignore props against the name.
  * Can use && or || in the comparison
  * @param  {String}       the type of the pattern that should be used in the view all
  * @param  {String}       the subtype of the pattern that be used in the view all
  *
  * @return {Array}        the list of partials
  */
 public function run($type = "", $subtype = "")
 {
     // default vars
     $patternPartials = array();
     $styleGuideExcludes = Config::getOption("styleGuideExcludes");
     $store = PatternData::get();
     foreach ($store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "pattern" && !$patternStoreData["hidden"] && !$patternStoreData["noviewall"] && $patternStoreData["depth"] == 2 && !in_array($patternStoreData["type"], $styleGuideExcludes)) {
             if ($patternStoreData["type"] == $type && empty($subtype) || empty($type) && empty($subtype) || $patternStoreData["type"] == $type && $patternStoreData["subtype"] == $subtype) {
                 $patternPartialData = array();
                 $patternPartialData["patternName"] = ucwords($patternStoreData["nameClean"]);
                 $patternPartialData["patternLink"] = $patternStoreData["pathDash"] . "/" . $patternStoreData["pathDash"] . ".html";
                 $patternPartialData["patternPartial"] = $patternStoreData["partial"];
                 $patternPartialData["patternPartialCode"] = $patternStoreData["code"];
                 $patternPartialData["patternLineageExists"] = isset($patternStoreData["lineages"]);
                 $patternPartialData["patternLineages"] = isset($patternStoreData["lineages"]) ? $patternStoreData["lineages"] : array();
                 $patternPartialData["patternLineageRExists"] = isset($patternStoreData["lineagesR"]);
                 $patternPartialData["patternLineagesR"] = isset($patternStoreData["lineagesR"]) ? $patternStoreData["lineagesR"] : array();
                 $patternPartialData["patternLineageEExists"] = isset($patternStoreData["lineages"]) || isset($patternStoreData["lineagesR"]);
                 $patternPartialData["patternDescExists"] = isset($patternStoreData["desc"]);
                 $patternPartialData["patternDesc"] = isset($patternStoreData["desc"]) ? $patternStoreData["desc"] : "";
                 $patternPartialData["patternDescAdditions"] = isset($patternStoreData["partialViewDescAdditions"]) ? $patternStoreData["partialViewDescAdditions"] : array();
                 $patternPartialData["patternExampleAdditions"] = isset($patternStoreData["partialViewExampleAdditions"]) ? $patternStoreData["partialViewExampleAdditions"] : array();
                 //$patternPartialData["patternCSSExists"]        = Config::$options["enableCSS"];
                 $patternPartialData["patternCSSExists"] = false;
                 // add the pattern data so it can be exported
                 $patternData = array();
                 //$patternFooterData["patternFooterData"]["cssEnabled"]      = (Config::$options["enableCSS"] && isset($this->patternCSS[$p])) ? "true" : "false";
                 $patternData["cssEnabled"] = false;
                 $patternData["lineage"] = isset($patternStoreData["lineages"]) ? $patternStoreData["lineages"] : array();
                 $patternData["lineageR"] = isset($patternStoreData["lineagesR"]) ? $patternStoreData["lineagesR"] : array();
                 $patternData["patternBreadcrumb"] = $patternStoreData["breadcrumb"];
                 $patternData["patternDesc"] = isset($patternStoreData["desc"]) ? $patternStoreData["desc"] : "";
                 $patternData["patternExtension"] = ".mustache";
                 $patternData["patternName"] = $patternStoreData["nameClean"];
                 $patternData["patternPartial"] = $patternStoreData["partial"];
                 $patternData["patternState"] = $patternStoreData["state"];
                 $patternPartialData["patternData"] = json_encode($patternData);
                 $patternPartials[] = $patternPartialData;
             }
         }
     }
     return array("partials" => $patternPartials, "cacheBuster" => Data::getOption("cacheBuster"));
 }
 public function run()
 {
     $store = PatternData::get();
     foreach ($store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "pattern") {
             if (isset($patternStoreData["data"]) || isset($patternStoreData["listItems"])) {
                 Data::initPattern($patternStoreKey);
             }
             if (isset($patternStoreData["data"])) {
                 Data::setPatternData($patternStoreKey, $patternStoreData["data"]);
             }
             if (isset($patternStoreData["listItems"])) {
                 Data::setPatternListItems($patternStoreKey, $patternStoreData["listItems"]);
             }
         }
     }
     // walk across the data and change link.pattern-partial to real source
     Data::compareReplaceListVarsInit();
 }
 public function run()
 {
     $store = PatternData::get();
     foreach ($store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "pattern") {
             if (isset($patternStoreData["data"]) || isset($patternStoreData["listItems"])) {
                 Data::initPattern($patternStoreKey);
             }
             if (isset($patternStoreData["data"])) {
                 Data::setPatternData($patternStoreKey, $patternStoreData["data"]);
             }
             if (isset($patternStoreData["listItems"])) {
                 Data::setPatternListItems($patternStoreKey, $patternStoreData["listItems"]);
             }
         }
     }
     // walk across the data and change link.pattern-partial to real source
     $data = Data::get();
     array_walk_recursive($data, '\\PatternLab\\Util::compareReplace');
 }
 public function run($depth, $ext, $path, $pathName, $name)
 {
     // load default vars
     $patternTypeDash = PatternData::getPatternTypeDash();
     // set-up the names, $name == foo.listitems.json
     $pattern = str_replace(".listitems." . $ext, "", $name);
     // foo
     $patternDash = $this->getPatternName($pattern, false);
     // foo
     $patternPartial = $patternTypeDash . "-" . $patternDash;
     // atoms-foo
     $patternStoreData = array("category" => "pattern");
     $data = Data::getListItems("_patterns/" . $pathName, $ext);
     $patternStoreData["listItems"] = $data;
     // create a key for the data store
     $patternStoreKey = $patternPartial;
     // if the pattern data store already exists make sure it is merged and overwrites this data
     $patternStoreData = PatternData::checkOption($patternStoreKey) ? array_replace_recursive(PatternData::getOption($patternStoreKey), $patternStoreData) : $patternStoreData;
     PatternData::setOption($patternStoreKey, $patternStoreData);
 }
 /**
  * Updates the Pattern Lab Website and prints the appropriate message
  * @param  {String}       file name to included in the message
  * @param  {String}       a switch for decided which message isn't printed
  *
  * @return {String}       the final message
  */
 private function updateSite($fileName, $message, $verbose = true)
 {
     $watchMessage = "";
     if ($verbose) {
         if ($message == "added") {
             $watchMessage = "<warning>" . $fileName . " was added to Pattern Lab. reload the website to see this change in the navigation...</warning>";
         } elseif ($message == "removed") {
             $watchMessage = "<warning>" . $fileName . " was removed from Pattern Lab. reload the website to see this change reflected in the navigation...</warning>";
         } elseif ($message == "hidden") {
             $watchMessage = "<warning>" . $fileName . " was hidden from Pattern Lab. reload the website to see this change reflected in the navigation...</warning>";
         } else {
             $watchMessage = "<info>" . $fileName . " changed...</info>";
         }
     }
     $options = $this->options;
     $options["watchVerbose"] = $verbose;
     $options["watchMessage"] = $watchMessage;
     $options["moveStatic"] = false;
     // clear the various data stores for re-population
     Data::clear();
     PatternData::clear();
     Annotations::clear();
     $g = new Generator();
     $g->generate($options);
 }
 public function getProcessedPatternSpecificData($pattern, $extraData = array())
 {
     $this->processPattern($pattern);
     return Data::getPatternSpecificData($pattern, $extraData);
 }
 /**
  * Generates the view all pages
  */
 protected function generateViewAllPages()
 {
     // set-up the dispatcher
     $dispatcherInstance = Dispatcher::getInstance();
     // note the beginning of the operation
     $dispatcherInstance->dispatch("builder.generateViewAllPagesStart");
     // default vars
     $patternPublicDir = Config::getOption("patternPublicDir");
     $htmlHead = Template::getHTMLHead();
     $htmlFoot = Template::getHTMLFoot();
     $patternHead = Template::getPatternHead();
     $patternFoot = Template::getPatternFoot();
     $filesystemLoader = Template::getFilesystemLoader();
     $stringLoader = Template::getStringLoader();
     $globalData = Data::get();
     // load the pattern loader
     $ppdExporter = new PatternPathSrcExporter();
     $patternPathSrc = $ppdExporter->run();
     $options = array();
     $options["patternPaths"] = $patternPathSrc;
     $patternEngineBasePath = PatternEngine::getInstance()->getBasePath();
     $patternLoaderClass = $patternEngineBasePath . "\\Loaders\\PatternLoader";
     $patternLoader = new $patternLoaderClass($options);
     // make sure view all is set
     $globalData["viewall"] = true;
     // make sure the pattern dir exists
     if (!is_dir($patternPublicDir)) {
         mkdir($patternPublicDir);
     }
     // add view all to each list
     $store = PatternData::get();
     foreach ($store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "patternSubtype") {
             // grab the partials into a data object for the style guide
             $ppExporter = new PatternPartialsExporter();
             $partials = $ppExporter->run($patternStoreData["type"], $patternStoreData["name"]);
             if (!empty($partials["partials"])) {
                 // add the pattern data so it can be exported
                 $patternData = array();
                 $patternData["patternPartial"] = "viewall-" . $patternStoreData["typeDash"] . "-" . $patternStoreData["nameDash"];
                 $globalData["patternLabHead"] = $stringLoader->render(array("string" => Template::getHTMLHead(), "data" => array("cacheBuster" => $partials["cacheBuster"])));
                 $globalData["patternLabFoot"] = $stringLoader->render(array("string" => Template::getHTMLFoot(), "data" => array("cacheBuster" => $partials["cacheBuster"], "patternData" => json_encode($patternData))));
                 // render the parts and join them
                 $header = $patternLoader->render(array("pattern" => $patternHead, "data" => $globalData));
                 $code = $filesystemLoader->render(array("template" => "viewall", "data" => $partials));
                 $footer = $patternLoader->render(array("pattern" => $patternFoot, "data" => $globalData));
                 $viewAllPage = $header . $code . $footer;
                 // if the pattern directory doesn't exist create it
                 $patternPath = $patternStoreData["pathDash"];
                 if (!is_dir($patternPublicDir . "/" . $patternPath)) {
                     mkdir($patternPublicDir . "/" . $patternPath);
                     file_put_contents($patternPublicDir . "/" . $patternPath . "/index.html", $viewAllPage);
                 } else {
                     file_put_contents($patternPublicDir . "/" . $patternPath . "/index.html", $viewAllPage);
                 }
             }
         } else {
             if ($patternStoreData["category"] == "patternType" && PatternData::hasPatternSubtype($patternStoreData["nameDash"])) {
                 // grab the partials into a data object for the style guide
                 $ppExporter = new PatternPartialsExporter();
                 $partials = $ppExporter->run($patternStoreData["name"]);
                 if (!empty($partials["partials"])) {
                     // add the pattern data so it can be exported
                     $patternData = array();
                     $patternData["patternPartial"] = "viewall-" . $patternStoreData["nameDash"] . "-all";
                     // add the pattern lab specific mark-up
                     $partials["patternLabHead"] = $stringLoader->render(array("string" => $htmlHead, "data" => array("cacheBuster" => $partials["cacheBuster"])));
                     $partials["patternLabFoot"] = $stringLoader->render(array("string" => $htmlFoot, "data" => array("cacheBuster" => $partials["cacheBuster"], "patternData" => json_encode($patternData))));
                     // render the parts and join them
                     $header = $patternLoader->render(array("pattern" => $patternHead, "data" => $globalData));
                     $code = $filesystemLoader->render(array("template" => "viewall", "data" => $partials));
                     $footer = $patternLoader->render(array("pattern" => $patternFoot, "data" => $globalData));
                     $viewAllPage = $header . $code . $footer;
                     // if the pattern directory doesn't exist create it
                     $patternPath = $patternStoreData["pathDash"];
                     if (!is_dir($patternPublicDir . "/" . $patternPath)) {
                         mkdir($patternPublicDir . "/" . $patternPath);
                         file_put_contents($patternPublicDir . "/" . $patternPath . "/index.html", $viewAllPage);
                     } else {
                         file_put_contents($patternPublicDir . "/" . $patternPath . "/index.html", $viewAllPage);
                     }
                 }
             }
         }
     }
     // note the end of the operation
     $dispatcherInstance->dispatch("builder.generateViewAllPagesEnd");
 }
 public function run()
 {
     // default vars
     $options = array();
     $options["patternPaths"] = $this->patternPaths;
     $patternExtension = Config::getOption("patternExtension");
     $patternSourceDir = Config::getOption("patternSourceDir");
     $htmlHead = Template::getHTMLHead();
     $htmlFoot = Template::getHTMLFoot();
     $patternHead = Template::getPatternHead();
     $patternFoot = Template::getPatternFoot();
     $stringLoader = Template::getStringLoader();
     // re-load the pattern data since we modified it
     $store = PatternData::get();
     /* rtl support start */
     foreach (array_keys($store) as $patternStoreKey) {
         if ($store[$patternStoreKey]['isFile']) {
             $store[$patternStoreKey]['patternTextDirection'] = 'ltr';
             $store[$patternStoreKey . '-rtl'] = $store[$patternStoreKey];
             $store[$patternStoreKey . '-rtl']['name'] .= '-rtl';
             $store[$patternStoreKey . '-rtl']['pathDash'] .= '-rtl';
             $store[$patternStoreKey . '-rtl']['patternTextDirection'] = 'rtl';
             $store[$patternStoreKey . '-rtl']['nameDash'] .= '-rtl';
             $store[$patternStoreKey . '-rtl']['nameClean'] .= ' (RTL)';
             $store[$patternStoreKey . '-rtl']['partial'] .= '-rtl';
         }
     }
     foreach ($store as $patternStoreKey => $patternStoreData) {
         PatternData::setOption($patternStoreKey, $patternStoreData);
     }
     /* rtl support end */
     // load the pattern loader
     $patternEngineBasePath = PatternEngine::getInstance()->getBasePath();
     $patternLoaderClass = $patternEngineBasePath . "\\Loaders\\PatternLoader";
     $patternLoader = new $patternLoaderClass($options);
     // iterate to process each pattern
     foreach ($store as $patternStoreKey => $patternStoreData) {
         if ($patternStoreData["category"] == "pattern" && !$patternStoreData["hidden"]) {
             $data = Data::getPatternSpecificData($patternStoreKey);
             // add the pattern data so it can be exported
             $patternData = array();
             //$patternFooterData["patternFooterData"]["cssEnabled"]      = (Config::$options["enableCSS"] && isset($this->patternCSS[$p])) ? "true" : "false";
             $patternData["cssEnabled"] = false;
             $patternData["lineage"] = isset($patternStoreData["lineages"]) ? $patternStoreData["lineages"] : array();
             $patternData["lineageR"] = isset($patternStoreData["lineagesR"]) ? $patternStoreData["lineagesR"] : array();
             $patternData["patternBreadcrumb"] = $patternStoreData["breadcrumb"];
             $patternData["patternDesc"] = isset($patternStoreData["desc"]) ? $patternStoreData["desc"] : "";
             $patternData["patternExtension"] = $patternExtension;
             $patternData["patternName"] = $patternStoreData["nameClean"];
             $patternData["patternPartial"] = $patternStoreData["partial"];
             $patternData["patternState"] = $patternStoreData["state"];
             // extra copy for the code view
             $patternData["extraOutput"] = isset($patternStoreData["extraOutput"]) ? $patternStoreData["extraOutput"] : array();
             // add the pattern lab specific mark-up
             // set a default var
             $exportClean = isset($options["exportClean"]) ? $options["exportClean"] : false;
             $data["patternLabHead"] = !$this->exportFiles ? $stringLoader->render(array("string" => $htmlHead, "data" => array("cacheBuster" => $data["cacheBuster"]))) : "";
             $data["patternLabFoot"] = !$this->exportFiles ? $stringLoader->render(array("string" => $htmlFoot, "data" => array("cacheBuster" => $data["cacheBuster"], "patternData" => json_encode($patternData)))) : "";
             /* add text-direction */
             $data['patternTextDirection'] = $store[$patternStoreKey]['patternTextDirection'];
             /* add text-direction end */
             if (isset($patternStoreData["patternRaw"])) {
                 $header = !$this->exportClean ? $stringLoader->render(array("string" => $patternHead, "data" => $data)) : "";
                 $code = $patternLoader->render(array("pattern" => $patternStoreData["patternRaw"], "data" => $data));
                 $footer = !$this->exportClean ? $stringLoader->render(array("string" => $patternFoot, "data" => $data)) : "";
                 PatternData::setPatternOption($patternStoreKey, "header", $header);
                 PatternData::setPatternOption($patternStoreKey, "code", $code);
                 PatternData::setPatternOption($patternStoreKey, "footer", $footer);
             }
         }
     }
 }