<?php include '../../autoload.php'; use Gregwar\RST\Builder; use Gregwar\RST\LaTeX\Kernel; try { // Build the 'input' files to the 'output' directory $builder = new Builder(new Kernel()); $builder->copy('css', 'css'); $builder->build('input', 'output'); } catch (\Exception $exception) { echo "\n"; echo "Error: " . $exception->getMessage() . "\n"; }
/** * Runs the slidey builder on the $source directory and put all the output * in the $destination directory * * @param $destination the destination folder * @param $source the source folder, containing all pages */ public function build($destination = 'web', $source = 'pages', $verbose = true) { // Handle cleaning global $argv; if (count($argv) > 1) { if ($argv[1] == 'clean') { echo "Cleaning {$destination}...\n"; `rm -rf {$destination}`; exit(0); } } // Add the main hooks $this->addHook(function ($document) { // Adding CSS $document->addCss('/slidey/bootstrap/dist/css/bootstrap.css'); // Adding JS $jss = array('jquery.js', 'slidey.images.js', 'slidey.permalink.js', 'slidey.menu.js', 'slidey.mobile.js', 'slidey.spoilers.js', 'slidey.steps.js', 'slidey.js', 'main.js'); foreach ($jss as $js) { $document->addJs('/slidey/js/' . $js); } $document->addJs('/slidey/bootstrap/dist/js/bootstrap.min.js'); $document->addJs('/slidey/highlight/highlight.pack.js'); $environment = $document->getEnvironment(); $home = $environment->resolve('doc', '/index'); $home = $home['url']; // Adding header $document->prependNode(new RawNode(str_replace('%home%', $home, file_get_contents(__DIR__ . '/static/top.html')))); // Browser $document->addNode(new Nodes\BrowserNode($document->getEnvironment())); // And bottom $document->addNode(new RawNode(file_get_contents(__DIR__ . '/static/bottom.html'))); $document->addFavicon(); }); // Run the build parent::build($source, $destination, $verbose); // Write the interactive file if ($this->interactive) { $config = '<?php return ' . var_export($this->interactive, true) . ';'; file_put_contents($this->getTargetFile('config.php'), $config); } }
public function setUp() { shell_exec('rm -rf ' . $this->targetFile()); $builder = new Builder(); $builder->copy('file.txt'); $builder->build($this->sourceFile(), $this->targetFile(), false); }