Update dependencies

This commit is contained in:
Stéphane Goetz 2020-04-22 21:39:15 +02:00
parent 47d64c2488
commit 684267b47c
8 changed files with 215 additions and 1582 deletions

View File

@ -32,6 +32,9 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest run: composer install --prefer-dist --no-progress --no-suggest
- name: Install tools
run: ./scripts/install_tools.sh
- name: Run test suite - name: Run test suite
run: composer run-script test run: composer run-script test
@ -50,6 +53,9 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest run: composer install --prefer-dist --no-progress --no-suggest
- name: Install tools
run: ./scripts/install_tools.sh
- name: Run test suite - name: Run test suite
run: composer run-script test -- --coverage-clover=coverage.clover run: composer run-script test -- --coverage-clover=coverage.clover
@ -70,4 +76,4 @@ jobs:
env: env:
FOLDER: "static" FOLDER: "static"
BRANCH: gh-pages BRANCH: gh-pages
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ node_modules
static static
/vendor /vendor
/build
.phpunit.result.cache .phpunit.result.cache
/prettier.config.js /prettier.config.js

View File

@ -20,7 +20,6 @@
"php": ">=7.2", "php": ">=7.2",
"guzzlehttp/guzzle": "~6.0", "guzzlehttp/guzzle": "~6.0",
"league/commonmark": "^1.0.0", "league/commonmark": "^1.0.0",
"league/commonmark-ext-table": "^2.0.0",
"league/plates": "~3.1", "league/plates": "~3.1",
"myclabs/deep-copy": "^1.5", "myclabs/deep-copy": "^1.5",
"scrivo/highlight.php": "^9.15", "scrivo/highlight.php": "^9.15",
@ -29,7 +28,8 @@
"symfony/mime": "^5.0", "symfony/mime": "^5.0",
"symfony/polyfill-intl-icu": "^1.10", "symfony/polyfill-intl-icu": "^1.10",
"symfony/process": "^5.0", "symfony/process": "^5.0",
"webuni/front-matter": "^1.0.0" "webuni/front-matter": "^1.0.0",
"ext-json": "*"
}, },
"suggest":{ "suggest":{
"ext-intl": "Allows to translate the modified at date" "ext-intl": "Allows to translate the modified at date"
@ -43,10 +43,9 @@
"justinwalsh/daux.io": "*" "justinwalsh/daux.io": "*"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8.0",
"mikey179/vfsstream": "^1.6" "mikey179/vfsstream": "^1.6"
}, },
"scripts": { "scripts": {
"test": "phpunit" "test": "build/phpunit"
} }
} }

1749
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,10 @@
<?php namespace Todaymade\Daux\ContentTypes\Markdown; <?php namespace Todaymade\Daux\ContentTypes\Markdown;
use League\CommonMark\DocParser;
use League\CommonMark\Environment; use League\CommonMark\Environment;
use League\CommonMark\HtmlRenderer; use League\CommonMark\Extension\Autolink\AutolinkExtension;
use League\CommonMark\Ext\Table\TableExtension; use League\CommonMark\Extension\SmartPunct\SmartPunctExtension;
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
use League\CommonMark\Extension\Table\TableExtension;
use League\CommonMark\Inline\Element as InlineElement; use League\CommonMark\Inline\Element as InlineElement;
use Todaymade\Daux\Config; use Todaymade\Daux\Config;
@ -18,6 +19,9 @@ class CommonMarkConverter extends \League\CommonMark\CommonMarkConverter
{ {
$environment = Environment::createCommonMarkEnvironment(); $environment = Environment::createCommonMarkEnvironment();
$environment->mergeConfig($config); $environment->mergeConfig($config);
$environment->addExtension(new AutolinkExtension());
$environment->addExtension(new SmartPunctExtension());
$environment->addExtension(new StrikethroughExtension());
$environment->addExtension(new TableExtension()); $environment->addExtension(new TableExtension());
// Table of Contents // Table of Contents

View File

@ -10,7 +10,6 @@ use League\CommonMark\Util\ConfigurationInterface;
use Todaymade\Daux\Config; use Todaymade\Daux\Config;
use Todaymade\Daux\DauxHelper; use Todaymade\Daux\DauxHelper;
use Todaymade\Daux\Exception\LinkNotFoundException; use Todaymade\Daux\Exception\LinkNotFoundException;
use Todaymade\Daux\Tree\Entry;
class LinkRenderer implements InlineRendererInterface, ConfigurationAwareInterface class LinkRenderer implements InlineRendererInterface, ConfigurationAwareInterface
{ {
@ -55,6 +54,7 @@ class LinkRenderer implements InlineRendererInterface, ConfigurationAwareInterfa
// Absolute urls, shouldn't either // Absolute urls, shouldn't either
if (DauxHelper::isExternalUrl($url)) { if (DauxHelper::isExternalUrl($url)) {
$element->setAttribute('class', 'Link--external'); $element->setAttribute('class', 'Link--external');
$element->setAttribute('rel', 'noopener noreferrer');
return $element; return $element;
} }
@ -78,8 +78,8 @@ class LinkRenderer implements InlineRendererInterface, ConfigurationAwareInterfa
$foundWithHash = true; $foundWithHash = true;
} }
} catch (LinkNotFoundException $e2) { } catch (LinkNotFoundException $e2) {
// If it's still not found here, we'll only // If it's still not found here, we'll only
// report on the first error as the second // report on the first error as the second
// one will tell the same. // one will tell the same.
} }
@ -87,7 +87,7 @@ class LinkRenderer implements InlineRendererInterface, ConfigurationAwareInterfa
if ($this->daux->isStatic()) { if ($this->daux->isStatic()) {
throw $e; throw $e;
} }
$element->setAttribute('class', 'Link--broken'); $element->setAttribute('class', 'Link--broken');
} }
} }

9
scripts/install_tools.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
if [ ! -d build ]; then
mkdir build;
fi
echo "-- Install phpunit"
curl -sSLo build/phpunit https://phar.phpunit.de/phpunit-8.phar
chmod +x build/phpunit

View File

@ -4,7 +4,6 @@ namespace Todaymade\Daux\ContentTypes\Markdown;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
use Todaymade\Daux\Config; use Todaymade\Daux\Config;
use Todaymade\Daux\ConfigBuilder; use Todaymade\Daux\ConfigBuilder;
use Todaymade\Daux\Daux;
use Todaymade\Daux\DauxHelper; use Todaymade\Daux\DauxHelper;
use Todaymade\Daux\Tree\Builder; use Todaymade\Daux\Tree\Builder;
use Todaymade\Daux\Tree\Root; use Todaymade\Daux\Tree\Root;
@ -26,7 +25,7 @@ class LinkRendererTest extends TestCase
['<a href="Page_with_hash.html">Link</a>', '[Link](Page_with_#_hash.md)', 'Widgets/Page.html'], ['<a href="Page_with_hash.html">Link</a>', '[Link](Page_with_#_hash.md)', 'Widgets/Page.html'],
// /Widgets/Page // /Widgets/Page
['<a href="http://google.ch" class="Link--external">Link</a>', '[Link](http://google.ch)', 'Widgets/Page.html'], ['<a href="http://google.ch" class="Link--external" rel="noopener noreferrer">Link</a>', '[Link](http://google.ch)', 'Widgets/Page.html'],
['<a href="#features">Link</a>', '[Link](#features)', 'Widgets/Page.html'], ['<a href="#features">Link</a>', '[Link](#features)', 'Widgets/Page.html'],
['<a href="Button.html">Link</a>', '[Link](Button.md)', 'Widgets/Page.html'], ['<a href="Button.html">Link</a>', '[Link](Button.md)', 'Widgets/Page.html'],
['<a href="Button.html">Link</a>', '[Link](./Button.md)', 'Widgets/Page.html'], ['<a href="Button.html">Link</a>', '[Link](./Button.md)', 'Widgets/Page.html'],
@ -42,7 +41,7 @@ class LinkRendererTest extends TestCase
['<a href="../Widgets/Button.html">Link</a>', '[Link](!Widgets/Button)', 'Content/Page.html'], ['<a href="../Widgets/Button.html">Link</a>', '[Link](!Widgets/Button)', 'Content/Page.html'],
// Mailto links // Mailto links
['<a href="mailto:me@mydomain.com" class="Link--external">me@mydomain.com</a>', '[me@mydomain.com](mailto:me@mydomain.com)', 'Content/Page.html'], ['<a href="mailto:me@mydomain.com" class="Link--external" rel="noopener noreferrer">me@mydomain.com</a>', '[me@mydomain.com](mailto:me@mydomain.com)', 'Content/Page.html'],
]; ];
} }