From d2e44be9e1ddeac0abd2258595abb5a33e3828a2 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Tue, 12 Oct 2021 10:48:49 +0200
Subject: [PATCH] Add the screencast admonition
---
src/Directive/ScreencastDirective.php | 18 ++++++++++++++++++
src/KernelFactory.php | 1 +
.../html/directives/admonition.html.twig | 2 ++
tests/IntegrationTest.php | 4 ++++
.../expected/blocks/directives/screencast.html | 11 +++++++++++
.../source/blocks/directives/screencast.rst | 5 +++++
6 files changed, 41 insertions(+)
create mode 100644 src/Directive/ScreencastDirective.php
create mode 100644 tests/fixtures/expected/blocks/directives/screencast.html
create mode 100644 tests/fixtures/source/blocks/directives/screencast.rst
diff --git a/src/Directive/ScreencastDirective.php b/src/Directive/ScreencastDirective.php
new file mode 100644
index 0000000..cd2a795
--- /dev/null
+++ b/src/Directive/ScreencastDirective.php
@@ -0,0 +1,18 @@
+
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace SymfonyDocsBuilder\Directive;
+
+class ScreencastDirective extends AbstractAdmonitionDirective
+{
+ public function __construct()
+ {
+ parent::__construct('screencast', 'Screencast');
+ }
+}
diff --git a/src/KernelFactory.php b/src/KernelFactory.php
index 14cef5f..ce99fcd 100644
--- a/src/KernelFactory.php
+++ b/src/KernelFactory.php
@@ -86,6 +86,7 @@ private static function getDirectives(): array
new SymfonyDirectives\RoleDirective(),
new SymfonyDirectives\NoteDirective(),
new SymfonyDirectives\RstClassDirective(new ClassDirective()),
+ new SymfonyDirectives\ScreencastDirective(),
new SymfonyDirectives\SeeAlsoDirective(),
new SymfonyDirectives\SidebarDirective(),
new SymfonyDirectives\TipDirective(),
diff --git a/src/Templates/default/html/directives/admonition.html.twig b/src/Templates/default/html/directives/admonition.html.twig
index 9913be3..485e3b9 100644
--- a/src/Templates/default/html/directives/admonition.html.twig
+++ b/src/Templates/default/html/directives/admonition.html.twig
@@ -13,6 +13,8 @@
{% elseif name in ['seealso'] %}
+ {% elseif name in ['screencast'] %}
+
{% endif %}
{{ text }}
diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php
index 7bf7737..5b47034 100644
--- a/tests/IntegrationTest.php
+++ b/tests/IntegrationTest.php
@@ -148,6 +148,10 @@ public function parserUnitBlockProvider()
'blockName' => 'directives/note-code-block-nested',
];
+ yield 'screencast' => [
+ 'blockName' => 'directives/screencast',
+ ];
+
yield 'seealso' => [
'blockName' => 'directives/seealso',
];
diff --git a/tests/fixtures/expected/blocks/directives/screencast.html b/tests/fixtures/expected/blocks/directives/screencast.html
new file mode 100644
index 0000000..eddd89d
--- /dev/null
+++ b/tests/fixtures/expected/blocks/directives/screencast.html
@@ -0,0 +1,11 @@
+
diff --git a/tests/fixtures/source/blocks/directives/screencast.rst b/tests/fixtures/source/blocks/directives/screencast.rst
new file mode 100644
index 0000000..f44b2fa
--- /dev/null
+++ b/tests/fixtures/source/blocks/directives/screencast.rst
@@ -0,0 +1,5 @@
+.. screencast::
+
+ Do you prefer video tutorials? Check out the
+ `Stellar Development with Symfony `_
+ screencast series.