Add a more advanced processor system
Dieser Commit ist enthalten in:
Ursprung
8dd3c1d6f8
Commit
e7afd9aa28
@ -20,6 +20,9 @@
|
||||
"symfony/finder": "~2.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {"Todaymade\\Daux\\": "libs/"}
|
||||
"psr-4": {
|
||||
"Todaymade\\Daux\\Extension\\": "daux/",
|
||||
"Todaymade\\Daux\\": "libs/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
daux.phar
BIN
daux.phar
Binäre Datei nicht angezeigt.
@ -66,13 +66,7 @@ class Compiler
|
||||
}
|
||||
|
||||
// Composer autoload
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/autoload.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_classmap.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_files.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_namespaces.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_psr4.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_real.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/ClassLoader.php'));
|
||||
$this->addComposer($phar);
|
||||
$this->addBinary($phar);
|
||||
|
||||
// Stubs
|
||||
@ -99,6 +93,20 @@ class Compiler
|
||||
$phar->addFromString($path, $content);
|
||||
}
|
||||
|
||||
private function addComposer($phar)
|
||||
{
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/autoload.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_classmap.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_files.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_namespaces.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/autoload_real.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../vendor/composer/ClassLoader.php'));
|
||||
|
||||
$content = file_get_contents(__DIR__ . '/../vendor/composer/autoload_psr4.php');
|
||||
$content = str_replace('$baseDir . \'/daux\'', 'PHAR_DIR . \'/daux\'', $content);
|
||||
$phar->addFromString('vendor/composer/autoload_psr4.php', $content);
|
||||
}
|
||||
|
||||
private function addBinary($phar)
|
||||
{
|
||||
$content = file_get_contents(__DIR__ . '/../generate.php');
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php namespace Todaymade\Daux;
|
||||
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
use Todaymade\Daux\Tree\Builder;
|
||||
|
||||
class Daux
|
||||
@ -12,6 +13,11 @@ class Daux
|
||||
public $internal_base;
|
||||
private $docs_path;
|
||||
|
||||
/**
|
||||
* @var Processor
|
||||
*/
|
||||
protected $processor;
|
||||
|
||||
/**
|
||||
* @var Tree\Entry
|
||||
*/
|
||||
@ -152,4 +158,24 @@ class Daux
|
||||
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Processor
|
||||
*/
|
||||
public function getProcessor()
|
||||
{
|
||||
if (!$this->processor) {
|
||||
$this->processor = new Processor($this, new NullOutput(), 0);
|
||||
}
|
||||
|
||||
return $this->processor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Processor $processor
|
||||
*/
|
||||
public function setProcessor(Processor $processor)
|
||||
{
|
||||
$this->processor = $processor;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,9 @@ class CommonMarkConverter extends \League\CommonMark\CommonMarkConverter
|
||||
|
||||
$this->extendEnvironment($environment);
|
||||
|
||||
//TODO :: finish
|
||||
//$daux->getProcessor()->extendCommonMarkEnvironment($environment);
|
||||
|
||||
$this->docParser = new DocParser($environment);
|
||||
$this->htmlRenderer = new HtmlRenderer($environment);
|
||||
}
|
||||
|
@ -33,11 +33,17 @@ class Command extends SymfonyCommand
|
||||
|
||||
$processor = $input->getOption('processor');
|
||||
if (!empty($processor) && $processor != 'none') {
|
||||
if (file_exists($processor)) {
|
||||
include $processor;
|
||||
}
|
||||
$class = "\\Todaymade\\Daux\\Extension\\" . $processor;
|
||||
if (class_exists($class)) {
|
||||
$daux->setProcessor(new $class($daux, $output, $width));
|
||||
} else if (file_exists($processor)) {
|
||||
include $processor;
|
||||
}
|
||||
}
|
||||
|
||||
// Improve the tree with a processor
|
||||
$daux->getProcessor()->manipulateTree($daux->tree);
|
||||
|
||||
switch(strtolower($input->getOption('format'))) {
|
||||
case 'confluence':
|
||||
(new ConfluenceGenerator())->generate($daux, $output, $width);
|
||||
|
38
libs/Processor.php
Normale Datei
38
libs/Processor.php
Normale Datei
@ -0,0 +1,38 @@
|
||||
<?php namespace Todaymade\Daux;
|
||||
|
||||
use League\CommonMark\Environment;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Todaymade\Daux\Tree\Directory;
|
||||
|
||||
class Processor
|
||||
{
|
||||
/**
|
||||
* @var Daux
|
||||
*/
|
||||
protected $daux;
|
||||
|
||||
/**
|
||||
* @var OutputInterface
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
public function __construct(Daux $daux, OutputInterface $output, $width)
|
||||
{
|
||||
$this->daux = $daux;
|
||||
$this->output = $output;
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
public function manipulateTree(Directory $root)
|
||||
{
|
||||
}
|
||||
|
||||
public function extendCommonMarkEnvironment(Environment $environment)
|
||||
{
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren