Example #1
0
 /**
  * Extracts the text the cursor point to and splits it into lines.
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->text = self::stripText($start->subString($end->position));
     $this->lines = $this->splitIntoLines($this->text);
 }
 /**
  * Trim away the excess whitespace which makes up the block line.
  *       after a block element.
  *
  * The first line of the text block is examined, if it contains whitespace
  * only the line will be emptied and the EOL marker is disabled (set to
  * false).
  *
  * @see ezcTemplateTextTstNode::setTextLines for details of the line format
  *      of text blocks.
  * @param ezcTemplateBlockTstNode $parentBlock
  *        The block which owns the text element.
  * @param ezcTemplateTextTstNode $textElement
  *        Text element to trim.
  * Note: The block line is considered the first line of a text block placed
  */
 public function trimBlockLine(ezcTemplateTstNode $parentBlock, ezcTemplateTextTstNode $textElement)
 {
     $lines = $textElement->lines;
     if (count($lines) == 0) {
         return;
     }
     $line = $lines[0];
     // Find first non-whitespace character, if we find one we cannot trim
     if (preg_match("#[^ \t\v]#", $line[0])) {
         return;
     }
     // Clear line text and EOL marker
     $line[0] = '';
     $line[1] = false;
     $lines[0] = $line;
     $textElement->setTextLines($lines);
 }
 /**
  *
  * @param ezcTemplateSource $source
  * @param ezcTemplateCursor $start
  * @param ezcTemplateCursor $end
  */
 public function __construct(ezcTemplateSourceCode $source, $start, $end)
 {
     parent::__construct($source, $start, $end);
     $this->textStartCursor = null;
     $this->textEndCursor = null;
 }