Code Style and refactorings
Cette révision appartient à :
révisé par
Stéphane Goetz
Parent
f903b0060c
révision
061ea5ea55
@ -49,6 +49,17 @@ class LinkRenderer extends \League\CommonMark\Inline\Renderer\LinkRenderer
|
||||
*/
|
||||
public function render(AbstractInline $inline, HtmlRendererInterface $htmlRenderer)
|
||||
{
|
||||
// This can't be in the method type as
|
||||
// the method is an abstract and should
|
||||
// have the same interface
|
||||
if (!$inline instanceof Link) {
|
||||
throw new \RuntimeException(
|
||||
"Wrong type passed to " . __CLASS__ . "::" . __METHOD__ .
|
||||
" the expected type was 'League\\CommonMark\\Inline\\Element\\Link' but '" .
|
||||
get_class($inline) . "' was provided"
|
||||
);
|
||||
}
|
||||
|
||||
$element = parent::render($inline, $htmlRenderer);
|
||||
|
||||
$url = $inline->getUrl();
|
||||
|
@ -15,6 +15,17 @@ class LinkRenderer extends \Todaymade\Daux\Format\Base\CommonMark\LinkRenderer
|
||||
*/
|
||||
public function render(AbstractInline $inline, HtmlRendererInterface $htmlRenderer)
|
||||
{
|
||||
// This can't be in the method type as
|
||||
// the method is an abstract and should
|
||||
// have the same interface
|
||||
if (!$inline instanceof Link) {
|
||||
throw new \RuntimeException(
|
||||
"Wrong type passed to " . __CLASS__ . "::" . __METHOD__ .
|
||||
" the expected type was 'League\\CommonMark\\Inline\\Element\\Link' but '" .
|
||||
get_class($inline) . "' was provided"
|
||||
);
|
||||
}
|
||||
|
||||
// Default handling
|
||||
$element = parent::render($inline, $htmlRenderer);
|
||||
$url = $inline->getUrl();
|
||||
|
@ -31,6 +31,9 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator
|
||||
$this->converter = new CommonMarkConverter(['daux' => $this->daux->getParams()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function generateAll(InputInterface $input, OutputInterface $output, $width)
|
||||
{
|
||||
$params = $this->daux->getParams();
|
||||
|
@ -25,7 +25,7 @@ class Publisher
|
||||
protected $previous_title;
|
||||
|
||||
/**
|
||||
* @var string terminal width
|
||||
* @var integer terminal width
|
||||
*/
|
||||
public $width;
|
||||
|
||||
|
@ -39,14 +39,14 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator, LiveGenerator
|
||||
|
||||
$params = $this->daux->getParams();
|
||||
if (is_null($destination)) {
|
||||
$destination = $this->daux->local_base . DS . 'static';
|
||||
$destination = $this->daux->local_base . DIRECTORY_SEPARATOR . 'static';
|
||||
}
|
||||
|
||||
$this->runAction(
|
||||
"Copying Static assets ...",
|
||||
$output,
|
||||
$width,
|
||||
function () use ($destination) {
|
||||
function() use ($destination) {
|
||||
Helper::copyAssets($destination, $this->daux->local_base);
|
||||
}
|
||||
);
|
||||
@ -76,7 +76,7 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator, LiveGenerator
|
||||
|
||||
foreach ($tree->getEntries() as $key => $node) {
|
||||
if ($node instanceof Directory) {
|
||||
$new_output_dir = $output_dir . DS . $key;
|
||||
$new_output_dir = $output_dir . DIRECTORY_SEPARATOR . $key;
|
||||
mkdir($new_output_dir);
|
||||
$this->generateRecursive($node, $new_output_dir, $params, $output, $width, '../' . $base_url);
|
||||
|
||||
@ -87,14 +87,14 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator, LiveGenerator
|
||||
"- " . $node->getUrl(),
|
||||
$output,
|
||||
$width,
|
||||
function () use ($node, $output_dir, $key, $params) {
|
||||
function() use ($node, $output_dir, $key, $params) {
|
||||
if (!$node instanceof Content) {
|
||||
copy($node->getPath(), $output_dir . DS . $key);
|
||||
copy($node->getPath(), $output_dir . DIRECTORY_SEPARATOR . $key);
|
||||
return;
|
||||
}
|
||||
|
||||
$generated = $this->generateOne($node, $params);
|
||||
file_put_contents($output_dir . DS . $key, $generated->getContent());
|
||||
file_put_contents($output_dir . DIRECTORY_SEPARATOR . $key, $generated->getContent());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Référencer dans un nouveau ticket
Bloquer un utilisateur