Output lines inside a block

@param \Leafo\ScssPhp\Formatter\OutputBlock $block
10242
protected function blockLines(OutputBlock $block)
    {
        $inner = $this->indentStr();

        $glue = $this->break . $inner;

        $this->write($inner . implode($glue, $block->lines));

        if (! empty($block->children)) {
            $this->write($this->break);
        }
    }
1118734
public function renderBlock(AbstractBlock $block)
    {
        $renderer = $this->getBlockRendererForClass(get_class($block));
        if (!$renderer) {
            throw new RuntimeException(
                sprintf('Unable to find corresponding renderer for block type: "%s"', get_class($block))
            );
        }

        return $renderer->render($block, $this);
    }
829285
protected function renderContent(ContentBlock $block)
    {
        $content = $block->getContent();

        switch ($block->getType())
        {
            case 'line':
                $content = htmlspecialchars($content);
                break;

            case 'text':
                $content = htmlspecialchars($content);
                $content = str_replace("\n", '<br>', $content);
                break;

            case 'markdown':
                $content = $this->markdownHelper->transform($content);
                break;

            case 'html':
                break;

            default:
                throw new \InvalidArgumentException('Unknown content block type: ' . $block->getType());
        }

        return $content;
    }
1334678
public function render(AbstractBlock $block, CliRenderer $renderer)
    {
        if (!($block instanceof FencedCode)) {
            throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
        }

        $infoWords = $block->getInfoWords();
        $codeType = null;
        if (count($infoWords) !== 0 && strlen($infoWords[0]) !== 0) {
            $codeType = $infoWords[0];
        }

        if (null === $codeType || !isset($this->highlighters[$codeType])) {
            return $this->indent($renderer->style($block->getStringContent(), 'yellow'));
        }

        return $this->indent(
            sprintf("%s\n", $this->highlighters[$codeType]->highlight($block->getStringContent()))
        );
    }
451573
protected function compileNestedBlock(Block $block, $selectors)
    {
        $this->pushEnv($block);

        $this->scope = $this->makeOutputBlock($block->type, $selectors);
        $this->scope->parent->children[] = $this->scope;

        // wrap assign children in a block
        foreach ($block->children as $k => $child) {
            if ($child[0] === Type::T_ASSIGN) {
                $wrapped = new Block;
                $wrapped->sourceName   = $block->sourceName;
                $wrapped->sourceIndex  = $block->sourceIndex;
                $wrapped->sourceLine   = $block->sourceLine;
                $wrapped->sourceColumn = $block->sourceColumn;
                $wrapped->selectors    = [];
                $wrapped->comments     = [];
                $wrapped->parent       = $block;
                $wrapped->children     = [$child];
                $wrapped->selfParent   = $block->selfParent;

                $block->children[$k] = [Type::T_BLOCK, $wrapped];
            }
        }

        $this->compileChildrenNoReturn($block->children, $this->scope);

        $this->scope = $this->scope->parent;

        $this->popEnv();
    }
575785
public function render(AbstractBlock $block, CliRenderer $renderer)
    {
        if (!($block instanceof ThematicBreak)) {
            throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
        }

        return $renderer->style(str_repeat('-', $this->width), 'dark_gray');
    }
137699
def write_indented_block(self, block):
        """"""
        self.in_indent_lines = False
        for l in re.split(r'\r?\n', block):
            self.line_buffer.append(l)
            self._update_lineno(1)
1365606
public function renderEsi(BlockInterface $block)
    {
        $reference = new ControllerReference(
            'OpiferContentBundle:Frontend/Block:view',
            ['id' => $block->getId()],
            $this->getRequest()->query->all()
        );

        return $this->fragmentHandler->render($reference, 'esi');
    }
195389
protected function renderTable($block)
	{
		$content = "";
		$first = true;
		foreach($block['rows'] as $row) {
            if ($first) {
                if ($row['header']) {
                    $content .= "<thead>\n";
                } else {
                    $content .= "<tbody>\n";
                }
            }
            $content .= "<tr>\n";
            foreach ($row['cells'] as $cell) {
                $tag = $cell['tag'];
                $cellText = $this->renderAbsy($cell['text']);
                if (empty($cellText)) {
                    $cellText = '&nbsp;';
                }
                $content .= "<$tag>$cellText</$tag>\n";
            }
            $content .= "</tr>\n";
            if ($first) {
                if ($row['header']) {
                    $content .= "</thead>\n<tbody>\n";
                }
                $first = false;
            }
		}
		return "<table>\n$content</tbody>\n</table>\n";
	}
61335
public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
    {
        if (!($block instanceof IndentedCode)) {
            throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
        }

        return $this->getHTMLElement($block->getStringContent(), "");
    }
654449
public function removeBlock(Block $block)
	{
		if (! $this->equals($block->getPlaceHolder())
				|| ! $this->blocks->contains($block)) {
			throw new \InvalidArgumentException('Block does not belongs to this placeholder.');
		}

		$position = $block->getPosition();
	
		$this->blocks->removeElement($block);

		foreach ($this->blocks as $existingBlock) {
			if ($existingBlock->getPosition() > $position) {
				$existingBlock->setPosition($existingBlock->getPosition() - 1);
			}
		}
	}
1094603
public function render(AbstractBlock $block, CliRenderer $renderer)
    {
        if (!($block instanceof Heading)) {
            throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
        }

        $level  = $block->getLevel();
        $text   = $renderer->renderInlines($block->children());

        return sprintf(
            "\n%s %s\n",
            $renderer->style(str_repeat('#', $level), 'dark_gray'),
            $renderer->style($text, ['bold', 'cyan'])
        );
    }
244750
private function summarizeBlock($block)
	{
		$block = array(
			'rules' => is_array($block) ? $block : $this->splitIntoRules(trim($block)),
			'count' => 0
		);
		foreach ($block['rules'] as $key => $rule) {
			$block['rules'][$key] = array(
				'rule'  => $rule,
				'count' => $this->countSelectorsInRule($rule),
			);
			$block['count'] += $block['rules'][$key]['count'];
		}

		return $block;
	}
359208
public function renderBlock(OutputBuffer $out, $name)
	{
		$method = 'block_' . $name;
		
		if(method_exists($this, $method))
		{
			$this->$method($out);
		}
		elseif($this->getParent() !== NULL)
		{
			$this->parent->renderBlock($out, $name);
		}
		else
		{
			throw new \RuntimeException(sprintf('Block not found: "%s"', $name));
		}
	}
33001
public function render(AbstractBlock $block, CliRenderer $renderer)
    {
        if (!($block instanceof ListItem)) {
            throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
        }

        return $renderer->style(' * ', 'yellow') . $renderer->renderBlocks($block->children());
    }
161412
protected function blockTable($line, array $block = null)
    {
        if (! isset($block) or isset($block[ 'type' ]) or isset($block[ 'interrupted' ])) {
            return;
        }

        if (strpos($block[ 'element' ][ 'text' ], '|') !== false and chop($line[ 'text' ], ' -:|') === '') {
            $alignments = array();

            $divider = $line[ 'text' ];
            $divider = trim($divider);
            $divider = trim($divider, '|');

            $dividerCells = explode('|', $divider);

            foreach ($dividerCells as $dividerCell) {
                $dividerCell = trim($dividerCell);

                if ($dividerCell === '') {
                    continue;
                }

                $alignment = null;

                if ($dividerCell[ 0 ] === ':') {
                    $alignment = 'left';
                }

                if (substr($dividerCell, -1) === ':') {
                    $alignment = $alignment === 'left' ? 'center' : 'right';
                }

                $alignments[] = $alignment;
            }

            $headerElements = array();

            $header = $block[ 'element' ][ 'text' ];

            $header = trim($header);
            $header = trim($header, '|');

            $headerCells = explode('|', $header);

            foreach ($headerCells as $index => $headerCell) {
                $headerCell = trim($headerCell);

                $headerElement = [
                    'name'    => 'th',
                    'text'    => $headerCell,
                    'handler' => 'line',
                ];

                if (isset($alignments[ $index ])) {
                    $alignment = $alignments[ $index ];

                    $headerElement[ 'attributes' ] = [
                        'style' => 'text-align: ' . $alignment . ';',
                    ];
                }

                $headerElements[] = $headerElement;
            }

            $block = [
                'alignments' => $alignments,
                'identified' => true,
                'element'    => [
                    'name'       => 'table',
                    'handler'    => 'elements',
                    'attributes' => [
                        'class' => 'table table-striped table-bordered'
                    ],
                ],
            ];

            $block[ 'element' ][ 'text' ][] = [
                'name'    => 'thead',
                'handler' => 'elements',
            ];

            $block[ 'element' ][ 'text' ][] = [
                'name'    => 'tbody',
                'handler' => 'elements',
                'text'    => array(),
            ];

            $block[ 'element' ][ 'text' ][ 0 ][ 'text' ][] = [
                'name'    => 'tr',
                'handler' => 'elements',
                'text'    => $headerElements,
            ];

            return $block;
        }
    }
842750
public function stop($block)
    {
        if ($this->enabled) {
            if (!isset($this->blocks[$block])) {
                throw new \Exception('Block '.$block.' has not been started!');
            }

            $this->blocks[$block]['stop'] = microtime(true);
            $this->blocks[$block]['stop-line'] = $this->getLineNumber();
        }
    }