diff --git a/gulpfile.js b/gulpfile.js index 5c1c569..3f8ce7c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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); diff --git a/libs/Daux.php b/libs/Daux.php index b83bfbb..6b9127b 100644 --- a/libs/Daux.php +++ b/libs/Daux.php @@ -357,7 +357,7 @@ class Daux */ public function getContentExtensions() { - if ($this->validExtensions) { + if (!empty($this->validExtensions)) { return $this->validExtensions; } diff --git a/libs/Format/Confluence/Api.php b/libs/Format/Confluence/Api.php index 70574bf..7b2747d 100644 --- a/libs/Format/Confluence/Api.php +++ b/libs/Format/Confluence/Api.php @@ -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) { diff --git a/libs/Format/Confluence/ContentTypes/Markdown/ImageRenderer.php b/libs/Format/Confluence/ContentTypes/Markdown/ImageRenderer.php index 121a272..a135565 100644 --- a/libs/Format/Confluence/ContentTypes/Markdown/ImageRenderer.php +++ b/libs/Format/Confluence/ContentTypes/Markdown/ImageRenderer.php @@ -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( diff --git a/libs/Format/Confluence/DuplicateTitleException.php b/libs/Format/Confluence/DuplicateTitleException.php index 3b4f6b7..a6f4875 100644 --- a/libs/Format/Confluence/DuplicateTitleException.php +++ b/libs/Format/Confluence/DuplicateTitleException.php @@ -1,5 +1,5 @@ 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(); diff --git a/libs/Tree/Builder.php b/libs/Tree/Builder.php index e8f5633..32df98d 100644 --- a/libs/Tree/Builder.php +++ b/libs/Tree/Builder.php @@ -167,7 +167,7 @@ class Builder /** * @param Directory $parent * @param string $path - * @return Content + * @return ContentAbstract */ public static function getOrCreatePage(Directory $parent, $path) { diff --git a/libs/Tree/ComputedRaw.php b/libs/Tree/ComputedRaw.php index ca76319..7a9b47d 100644 --- a/libs/Tree/ComputedRaw.php +++ b/libs/Tree/ComputedRaw.php @@ -1,23 +1,5 @@ content; - } - - /** - * @param string $content - */ - public function setContent($content) - { - $this->content = $content; - } } diff --git a/libs/Tree/Content.php b/libs/Tree/Content.php index 9822750..3b39caf 100644 --- a/libs/Tree/Content.php +++ b/libs/Tree/Content.php @@ -2,7 +2,7 @@ use Webuni\FrontMatter\FrontMatter; -class Content extends Entry +class Content extends ContentAbstract { /** @var string */ protected $content; diff --git a/libs/Tree/ContentAbstract.php b/libs/Tree/ContentAbstract.php new file mode 100644 index 0000000..09621f6 --- /dev/null +++ b/libs/Tree/ContentAbstract.php @@ -0,0 +1,24 @@ +content; + } + + /** + * @param string $content + */ + public function setContent($content) + { + $this->content = $content; + } +} diff --git a/test.php b/test.php deleted file mode 100644 index e69de29..0000000 diff --git a/themes/daux/js/daux.js b/themes/daux/js/daux.js index 7be7933..52c357a 100644 --- a/themes/daux/js/daux.js +++ b/themes/daux/js/daux.js @@ -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; } }