Skip to content

Commit

Permalink
Allow configuration to be overriden
Browse files Browse the repository at this point in the history
  • Loading branch information
nlisgo committed Jan 24, 2018
1 parent badfca4 commit ec2af83
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Annotations/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public function __construct(string $environment = 'dev')
'authority' => '',
'group' => '',
],
'common_mark.environment' => ($config['common_mark']['environment'] ?? []) + [
'allow_unsafe_links' => false,
],
'html_purifier' => ($config['html_purifier'] ?? []) + [
'Cache.SerializerPath' => __DIR__.'/../../var/cache/html_purifier',
],
Expand Down Expand Up @@ -355,11 +358,9 @@ public function __construct(string $environment = 'dev')
'sqs.region' => $this->app['aws']['region'],
]);

$this->app['annotation.serializer.common_mark.environment'] = function () {
$this->app['annotation.serializer.common_mark.environment'] = function (Application $app) {
$environment = Environment::createCommonMarkEnvironment();
$environment->setConfig([
'allow_unsafe_links' => false,
]);
$environment->setConfig($app['common_mark.environment']);

$environment->addBlockRenderer(CommonMarkBlock\Element\BlockQuote::class, new CommonMark\Block\Renderer\BlockQuoteRenderer());
$environment->addBlockRenderer(CommonMarkBlock\Element\FencedCode::class, new CommonMark\Block\Renderer\CodeRenderer());
Expand All @@ -386,7 +387,7 @@ public function __construct(string $environment = 'dev')
return new HTMLPurifier($app['html_purifier']);
};

$this->app['annotation.serializer'] = function (Application $app) {
$this->app['annotation.serializer'] = function () {
return new HypothesisClientAnnotationNormalizer($this->app['annotation.serializer.common_mark.doc_parser'], $this->app['annotation.serializer.common_mark.html_renderer'], $this->app['annotation.serializer.html_purifier'], $this->app['logger']);
};

Expand Down

0 comments on commit ec2af83

Please sign in to comment.