Sha256: 482f820bc3a85c661fe2b6621b198bd079561abd658d9f8f4de80c79f1cc1967

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

<?php
/* SVN FILE: $Id: SassExpandedRenderer.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
/**
 * SassExpandedRenderer class file.
 * @author			Chris Yates <chris.l.yates@gmail.com>
 * @copyright 	Copyright (c) 2010 PBM Web Development
 * @license			http://phamlp.googlecode.com/files/license.txt
 * @package			PHamlP
 * @subpackage	Sass.renderers
 */

require_once('SassCompactRenderer.php');

/**
 * SassExpandedRenderer class.
 * Expanded is the typical human-made CSS style, with each property and rule
 * taking up one line. Properties are indented within the rules, but the rules
 * are not indented in any special way.
 * @package			PHamlP
 * @subpackage	Sass.renderers
 */
class SassExpandedRenderer extends SassCompactRenderer {
	/**
	 * Renders the brace between the selectors and the properties
	 * @return string the brace between the selectors and the properties
	 */
	protected function between() {
	  return " {\n" ;
	}
	
	/**
	 * Renders the brace at the end of the rule
	 * @return string the brace between the rule and its properties
	 */
	protected function end() {
	  return "\n}\n\n";
	}

	/**
	 * Renders a comment.
	 * @param SassNode the node being rendered
	 * @return string the rendered commnt
	 */
	public function renderComment($node) {
		$indent = $this->getIndent($node);
		$lines = explode("\n", $node->value);
		foreach ($lines as &$line) {
			$line = trim($line);
		}
		return "$indent/*\n$indent * ".join("\n$indent * ", $lines)."\n$indent */".(empty($indent)?"\n":'');
	}

	/**
	 * Renders properties.
	 * @param array properties to render
	 * @return string the rendered properties
	 */
	public function renderProperties($node, $properties) {
		$indent = $this->getIndent($node).self::INDENT;
		return $indent.join("\n$indent", $properties);
	}
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
frontsau-0.0.3 lib/Phamlp/sass/renderers/SassExpandedRenderer.php
frontsau-0.0.2 lib/Phamlp/sass/renderers/SassExpandedRenderer.php
frontsau-0.0.1 lib/Phamlp/sass/renderers/SassExpandedRenderer.php