You are here

private function HamlParser::parseContent in Sassy 7

* Parse content *

Parameters

array line to parse: * @param HamlNode parent node * @return HamlNode

3 calls to HamlParser::parseContent()
HamlParser::parseElement in phamlp/haml/HamlParser.php
* Parse an element. *
HamlParser::parseFilter in phamlp/haml/HamlParser.php
* Parse a filter. *
HamlParser::parseLine in phamlp/haml/HamlParser.php
* Parse a line of Haml into a HamlNode for the document tree *

File

phamlp/haml/HamlParser.php, line 1045

Class

HamlParser
HamlParser class. Parses {@link http://haml-lang.com/ Haml} view files. @package PHamlP @subpackage Haml

Code

private function parseContent($line, $parent) {
  switch ($line[self::HAML_TOKEN]) {
    case self::INSERT_CODE:
      $content = $this->suppressEval ? '' : '<?php echo ' . ($this->escapeHtml ? 'htmlentities(' . $line[self::HAML_CONTENT] . ')' : $line[self::HAML_CONTENT]) . "; ?>" . ($this->style == HamlRenderer::STYLE_EXPANDED || $this->style == HamlRenderer::STYLE_NESTED ? "\n" : '');
      break;
    case self::INSERT_CODE_PRESERVE_WHITESPACE:
      $content = $this->suppressEval ? '' : '<?php echo str_replace("\\n", \'&#x000a\', ' . ($this->escapeHtml ? 'htmlentities(' . $line[self::HAML_CONTENT] . ')' : $line[self::HAML_CONTENT]) . "; ?>" . ($this->style == HamlRenderer::STYLE_EXPANDED || $this->style == HamlRenderer::STYLE_NESTED ? "\n" : '');
      break;
    case self::UNESCAPE_XML:
      $content = $this->suppressEval ? '' : '<?php echo ' . $line[self::HAML_CONTENT] . "; ?>" . ($this->style == HamlRenderer::STYLE_EXPANDED || $this->style == HamlRenderer::STYLE_NESTED ? "\n" : '');
      break;
    case self::ESCAPE_XML:
      $content = $this->suppressEval ? '' : '<?php echo ' . ('htmlentities(' . $line[self::HAML_CONTENT] . ')') . "; ?>" . ($this->style == HamlRenderer::STYLE_EXPANDED || $this->style == HamlRenderer::STYLE_NESTED ? "\n" : '');
      break;
    default:
      $content = $line[self::HAML_CONTENT];
      break;
  }

  // switch
  return new HamlNode($this
    ->interpolate($content), $parent);
}