1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 06:06:45 +02:00

feat(shortcodes): add [textile] shortcode

This commit is contained in:
Awilum
2022-05-13 16:48:26 +03:00
parent bd70310eb0
commit f7e717f3b8
4 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
/**
* Flextype - Hybrid Content Management System with the freedom of a headless CMS
* and with the full functionality of a traditional CMS!
*
* Copyright (c) Sergey Romanenko (https://awilum.github.io)
*
* Licensed under The MIT License.
*
* For full copyright and license information, please see the LICENSE
* Redistributions of files must retain the above copyright notice.
*/
namespace Flextype\Parsers\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
use function parsers;
// Shortcode: [textile] textile text here [/textile]
parsers()->shortcodes()->addHandler('textile', static function (ShortcodeInterface $s) {
if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.textile.enabled')) {
return '';
}
return parsers()->textile()->parse($s->getContent());
});

View File

@@ -578,6 +578,9 @@ parsers:
raw:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/RawShortcode.php"
textile:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/TextileShortcode.php"
markdown:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/MarkdownShortcode.php"

View File

@@ -565,6 +565,9 @@ parsers:
raw:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/RawShortcode.php"
textile:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/TextileShortcode.php"
markdown:
enabled: true
path: "/src/flextype/core/Parsers/Shortcodes/MarkdownShortcode.php"

View File

@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);
test('[textile] shortcode', function () {
$this->assertEquals("<p><b>Foo</b></p>",
parsers()->shortcodes()->parse('[textile]**Foo**[/textile]'));
});