Skip to content

Add the screencast admonition #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Directive/ScreencastDirective.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/*
* This file is part of the Docs Builder package.
* (c) Ryan Weaver <ryan@symfonycasts.com>
* 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');
}
}
1 change: 1 addition & 0 deletions src/KernelFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 2 additions & 0 deletions src/Templates/default/html/directives/admonition.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="24" height="24" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"></path></svg>
{% elseif name in ['seealso'] %}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="24" height="24" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" /></svg>
{% elseif name in ['screencast'] %}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="24" height="24" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>
{% endif %}
<span>{{ text }}</span>
</p>
4 changes: 4 additions & 0 deletions tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ public function parserUnitBlockProvider()
'blockName' => 'directives/note-code-block-nested',
];

yield 'screencast' => [
'blockName' => 'directives/screencast',
];

yield 'seealso' => [
'blockName' => 'directives/seealso',
];
Expand Down
11 changes: 11 additions & 0 deletions tests/fixtures/expected/blocks/directives/screencast.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="admonition admonition-screencast ">
<p class="admonition-title">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" width="24" height="24" viewbox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
</svg>
<span>Screencast</span>
</p>
<p>Do you prefer video tutorials? Check out the
<a href="https://symfonycasts.com/screencast/symfony" class="reference external" rel="external noopener noreferrer" target="_blank">Stellar Development with Symfony</a>
screencast series.</p>
</div>
5 changes: 5 additions & 0 deletions tests/fixtures/source/blocks/directives/screencast.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. screencast::

Do you prefer video tutorials? Check out the
`Stellar Development with Symfony <https://symfonycasts.com/screencast/symfony>`_
screencast series.