<commit_before><?php

/*!
 * Pattern Data Pattern Partials Exporter Class
 *
 * Copyright (c) 2014 <NAME>, http://dmolsen.com
 * Licensed under the MIT license
 *
 * Generates the partials to be used in the viewall & styleguide
 *
 */

namespace PatternLab\PatternData\Exporters;

use \PatternLab\Config;
use \PatternLab\Data;
use \PatternLab\PatternData;

class PatternPartialsExporter extends \PatternLab\PatternData\Exporter {
	
	public function __construct($options = array()) {
		
		parent::__construct($options);
		
	}
	
	/**
	* 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 = "") {
		
		$patternPartials = array();
		
		foreach (PatternData::$store as $patternStoreKey => $patternStoreData) {
			
			if (($patternStoreData["category"] == "pattern") && (!$patternStoreData["hidden"]) && ($patternStoreData["depth"] == 2) && (!in_array($patternStoreData["type"],Config::$options["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["patternModifiersExist"]  = isset($patternStoreData["modifiers"]);
					$patternPartialData["patternModifiers"]       = isset($patternStoreData["modifiers"]) ? $patternStoreData["modifiers"] : array();
					
					$patternPartialData["patternCSSExists"]       = Config::$options["enableCSS"];
					
					$patternPartials[]                            = $patternPartialData;
				
				}
				
			}
			
		}
		
		return array("partials" => $patternPartials);
		
	}
	
}


<commit_msg>adding pattern desc and example additions<commit_after><?php

/*!
 * Pattern Data Pattern Partials Exporter Class
 *
 * Copyright (c) 2014 <NAME>, http://dmolsen.com
 * Licensed under the MIT license
 *
 * Generates the partials to be used in the viewall & styleguide
 *
 */

namespace PatternLab\PatternData\Exporters;

use \PatternLab\Config;
use \PatternLab\Data;
use \PatternLab\PatternData;

class PatternPartialsExporter extends \PatternLab\PatternData\Exporter {
	
	public function __construct($options = array()) {
		
		parent::__construct($options);
		
	}
	
	/**
	* 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 = "") {
		
		$patternPartials = array();
		
		foreach (PatternData::$store as $patternStoreKey => $patternStoreData) {
			
			if (($patternStoreData["category"] == "pattern") && (!$patternStoreData["hidden"]) && ($patternStoreData["depth"] == 2) && (!in_array($patternStoreData["type"],Config::$options["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"]    = $patternStoreData["descAdditions"];
					$patternPartialData["patternExampleAdditions"] = $patternStoreData["exampleAdditions"];
					
					$patternPartialData["patternCSSExists"]        = Config::$options["enableCSS"];
					
					$patternPartials[]                             = $patternPartialData;
				
				}
				
			}
			
		}
		
		return array("partials" => $patternPartials);
		
	}
	
}



{'fraction_non_alphanumeric': 0.15419679346117574, 'fraction_numerical': 0.0015718327569946558, 'mean_word_length': 3.9633385335413416, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3435634', 'n_tokens_mistral': 2055, 'n_tokens_neox': 1748, 'n_words': 333}