Fix bugs reported by scrutinizer
This commit is contained in:
bovenliggende
fb5fb41e96
commit
948f2aaa39
@ -77,8 +77,10 @@ function createLinter() {
|
||||
|
||||
var style_tasks = [];
|
||||
for (var style in resources) {
|
||||
gulp.task('style_' + style, createTask(resources[style].source, resources[style].dest));
|
||||
style_tasks.push('style_' + style);
|
||||
if (resources.hasOwnProperty(style)) {
|
||||
gulp.task('style_' + style, createTask(resources[style].source, resources[style].dest));
|
||||
style_tasks.push('style_' + style);
|
||||
}
|
||||
}
|
||||
|
||||
gulp.task('lint-css', createLinter);
|
||||
|
@ -357,7 +357,7 @@ class Daux
|
||||
*/
|
||||
public function getContentExtensions()
|
||||
{
|
||||
if ($this->validExtensions) {
|
||||
if (!empty($this->validExtensions)) {
|
||||
return $this->validExtensions;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\BadResponseException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
|
||||
class Api
|
||||
{
|
||||
@ -42,7 +43,7 @@ class Api
|
||||
* this will give little bit more sense to it and return it
|
||||
*
|
||||
* @param BadResponseException $e
|
||||
* @return BadResponseException
|
||||
* @return RequestException
|
||||
*/
|
||||
protected function handleError(BadResponseException $e)
|
||||
{
|
||||
|
@ -15,6 +15,10 @@ class ImageRenderer extends \League\CommonMark\Inline\Renderer\ImageRenderer
|
||||
*/
|
||||
public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
|
||||
{
|
||||
if (!($inline instanceof Image)) {
|
||||
throw new \InvalidArgumentException('Incompatible inline type: ' . get_class($inline));
|
||||
}
|
||||
|
||||
// External Images need special handling
|
||||
if (strpos($inline->getUrl(), 'http') === 0) {
|
||||
return new HtmlElement(
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php namespace Todaymade\Daux\Format\Confluence;
|
||||
|
||||
class DuplicateTitleException extends \RuntimeException
|
||||
class DuplicateTitleException extends \GuzzleHttp\Exception\RequestException
|
||||
{
|
||||
}
|
||||
|
@ -164,8 +164,11 @@ class Processor implements DocumentProcessorInterface
|
||||
|
||||
$a = new Link('#' . $entry->getId());
|
||||
|
||||
foreach ($this->cloneChildren($entry->getContent()) as $node) {
|
||||
$a->appendChild($node);
|
||||
$children = $entry->getChildren();
|
||||
if ($children != null) {
|
||||
foreach ($this->cloneChildren($entry->getContent()) as $node) {
|
||||
$a->appendChild($node);
|
||||
}
|
||||
}
|
||||
|
||||
$p = new Paragraph();
|
||||
|
@ -167,7 +167,7 @@ class Builder
|
||||
/**
|
||||
* @param Directory $parent
|
||||
* @param string $path
|
||||
* @return Content
|
||||
* @return ContentAbstract
|
||||
*/
|
||||
public static function getOrCreatePage(Directory $parent, $path)
|
||||
{
|
||||
|
@ -1,23 +1,5 @@
|
||||
<?php namespace Todaymade\Daux\Tree;
|
||||
|
||||
class ComputedRaw extends Entry
|
||||
class ComputedRaw extends ContentAbstract
|
||||
{
|
||||
/** @var string */
|
||||
protected $content;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use Webuni\FrontMatter\FrontMatter;
|
||||
|
||||
class Content extends Entry
|
||||
class Content extends ContentAbstract
|
||||
{
|
||||
/** @var string */
|
||||
protected $content;
|
||||
|
24
libs/Tree/ContentAbstract.php
Normal file
24
libs/Tree/ContentAbstract.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php namespace Todaymade\Daux\Tree;
|
||||
|
||||
|
||||
abstract class ContentAbstract extends Entry
|
||||
{
|
||||
/** @var string */
|
||||
protected $content;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
|
||||
_ = {};
|
||||
/** global localStorage */
|
||||
var _ = {};
|
||||
|
||||
_.now = Date.now || function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
|
||||
_.debounce = function(func, wait, immediate) {
|
||||
var timeout, args, context, timestamp, result;
|
||||
var timeout, args, context, timestamp;
|
||||
|
||||
var later = function() {
|
||||
var last = _.now() - timestamp;
|
||||
@ -16,8 +16,10 @@ _.debounce = function(func, wait, immediate) {
|
||||
} else {
|
||||
timeout = null;
|
||||
if (!immediate) {
|
||||
result = func.apply(context, args);
|
||||
if (!timeout) context = args = null;
|
||||
func.apply(context, args);
|
||||
if (!timeout) {
|
||||
context = args = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -27,13 +29,15 @@ _.debounce = function(func, wait, immediate) {
|
||||
args = arguments;
|
||||
timestamp = _.now();
|
||||
var callNow = immediate && !timeout;
|
||||
if (!timeout) timeout = setTimeout(later, wait);
|
||||
if (!timeout) {
|
||||
timeout = setTimeout(later, wait);
|
||||
}
|
||||
if (callNow) {
|
||||
result = func.apply(context, args);
|
||||
func.apply(context, args);
|
||||
context = args = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
@ -61,15 +65,11 @@ $(function () {
|
||||
|
||||
toggleCodeBlockBtns.removeClass("Button--active");
|
||||
|
||||
console.log("Toggle", codeBlockState);
|
||||
|
||||
switch (codeBlockState) {
|
||||
default:
|
||||
case 0: // Hidden code blocks
|
||||
toggleCodeBlockBtnHide.addClass("Button--active");
|
||||
toggleCodeBlockBtn.html("Show Code Blocks");
|
||||
codeBlockView.removeClass('Columns__right--float');
|
||||
codeBlocks.addClass('hidden');
|
||||
case 2: // Show code blocks inline
|
||||
toggleCodeBlockBtnFloat.addClass("Button--active");
|
||||
codeBlockView.addClass('Columns__right--float');
|
||||
codeBlocks.removeClass('hidden');
|
||||
break;
|
||||
case 1: // Show code blocks below
|
||||
toggleCodeBlockBtnBelow.addClass("Button--active");
|
||||
@ -77,10 +77,12 @@ $(function () {
|
||||
codeBlockView.removeClass('Columns__right--float');
|
||||
codeBlocks.removeClass('hidden');
|
||||
break;
|
||||
case 2: // Show code blocks inline
|
||||
toggleCodeBlockBtnFloat.addClass("Button--active");
|
||||
codeBlockView.addClass('Columns__right--float');
|
||||
codeBlocks.removeClass('hidden');
|
||||
case 0: // Hidden code blocks
|
||||
default:
|
||||
toggleCodeBlockBtnHide.addClass("Button--active");
|
||||
toggleCodeBlockBtn.html("Show Code Blocks");
|
||||
codeBlockView.removeClass('Columns__right--float');
|
||||
codeBlocks.addClass('hidden');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user