Example #1
0
 /**
  * Render to HTML
  * 
  * @param Element   $element
  * @param string $html  Original rendered html
  * @return string
  */
 public function render($element, $html)
 {
     $parser = new \Gajus\Dindent\Parser($this->options);
     return $parser->indent($html);
 }
Example #2
0
File: index.php Project: gajus/dora
<?php

require __DIR__ . '/../vendor/autoload.php';
session_start();
ob_start();
$index = [];
$example = function ($name, $example_label, $display = ['code', 'demo', 'markup']) use(&$index) {
    $index[str_replace('/', '__', $name)] = $example_label;
    ob_start();
    require __DIR__ . '/examples/' . $name . '.php';
    $output = ob_get_clean();
    if (class_exists('Gajus\\Dindent\\Parser')) {
        $parser = new \Gajus\Dindent\Parser();
        $output = $parser->indent($output);
    }
    ?>
    <div class="example" id="example-<?php 
    echo str_replace('/', '__', $name);
    ?>
">
        <?php 
    if (in_array('code', $display)) {
        ?>
        <div class="tab code">
            <div class="description">
                <h3><a href="#example-<?php 
        echo str_replace('/', '__', $name);
        ?>
"><?php 
        echo $example_label;
        ?>