mirror of
https://github.com/flextype/flextype.git
synced 2025-08-11 15:44:49 +02:00
feat(parsers): move markdown and shortcode settings under parsers setting. #539
This commit is contained in:
@@ -55,9 +55,9 @@ final class Markdown
|
||||
protected function __construct()
|
||||
{
|
||||
$this->markdownFacade = new ParsedownExtra();
|
||||
$this->markdownFacade->setBreaksEnabled(flextype('registry')->get('flextype.settings.markdown.auto_line_breaks'));
|
||||
$this->markdownFacade->setUrlsLinked(flextype('registry')->get('flextype.settings.markdown.auto_url_links'));
|
||||
$this->markdownFacade->setMarkupEscaped(flextype('registry')->get('flextype.settings.markdown.escape_markup'));
|
||||
$this->markdownFacade->setBreaksEnabled(flextype('registry')->get('flextype.settings.parsers.markdown.auto_line_breaks'));
|
||||
$this->markdownFacade->setUrlsLinked(flextype('registry')->get('flextype.settings.parsers.markdown.auto_url_links'));
|
||||
$this->markdownFacade->setMarkupEscaped(flextype('registry')->get('flextype.settings.parsers.markdown.escape_markup'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -10,7 +10,7 @@ declare(strict_types=1);
|
||||
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
|
||||
|
||||
// Shortcode: [entries_fetch id="entry-id" field="field-name" default="default-value"]
|
||||
if (flextype('registry')->get('flextype.settings.shortcode.shortcodes.entries.enabled')) {
|
||||
if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.entries.enabled')) {
|
||||
flextype('parsers')->shortcode()->addHandler('entries_fetch', static function (ShortcodeInterface $s) {
|
||||
return arrays(flextype('entries')->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default'));
|
||||
});
|
||||
|
@@ -12,7 +12,7 @@ use Thunder\Shortcode\Events;
|
||||
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
|
||||
|
||||
// Shortcode: [raw]
|
||||
if (flextype('registry')->get('flextype.settings.shortcode.shortcodes.raw.enabled')) {
|
||||
if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.raw.enabled')) {
|
||||
flextype('parsers')->shortcode()->addHandler('raw', static function (ShortcodeInterface $s) {
|
||||
return $s->getContent();
|
||||
});
|
||||
|
@@ -10,7 +10,7 @@ declare(strict_types=1);
|
||||
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
|
||||
|
||||
// Shortcode: [registry_get name="item-name" default="default-value"]
|
||||
if (flextype('registry')->get('flextype.settings.shortcode.shortcodes.registry.enabled')) {
|
||||
if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.registry.enabled')) {
|
||||
flextype('parsers')->shortcode()->addHandler('registry_get', static function (ShortcodeInterface $s) {
|
||||
return flextype('registry')->get($s->getParameter('name'), $s->getParameter('default'));
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ use Slim\Http\Environment;
|
||||
use Slim\Http\Uri;
|
||||
|
||||
// Shortcode: [url]
|
||||
if (flextype('registry')->get('flextype.settings.shortcode.shortcodes.url.enabled')) {
|
||||
if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.url.enabled')) {
|
||||
flextype('parsers')->shortcode()->addHandler('url', static function () {
|
||||
if (flextype('registry')->has('flextype.settings.url') && flextype('registry')->get('flextype.settings.url') !== '') {
|
||||
return flextype('registry')->get('flextype.settings.url');
|
||||
|
@@ -134,9 +134,9 @@ if (in_array(flextype('registry')->get('flextype.settings.timezone'), DateTimeZo
|
||||
/**
|
||||
* Init shortocodes
|
||||
*
|
||||
* Load Flextype Shortcodes from directory /flextype/Support/Parsers/Shortcodes/ based on flextype.settings.shortcode.shortcodes array
|
||||
* Load Flextype Shortcodes from directory /flextype/Support/Parsers/Shortcodes/ based on flextype.settings.parsers.shortcode.shortcodes array
|
||||
*/
|
||||
$shortcodes = flextype('registry')->get('flextype.settings.shortcode.shortcodes');
|
||||
$shortcodes = flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes');
|
||||
|
||||
foreach ($shortcodes as $shortcodeName => $shortcode) {
|
||||
$shortcodeFilePath = ROOT_DIR . '/src/flextype/Support/Parsers/Shortcodes/' . str_replace('_', '', ucwords($shortcodeName, '_')) . 'Shortcode.php';
|
||||
|
@@ -344,24 +344,25 @@ image:
|
||||
# - markdown.auto_line_breaks: Enable automatic line breaks
|
||||
# - markdown.auto_url_links: Enable automatic HTML links
|
||||
# - markdown.escape_markup: Escape markup tags into entities
|
||||
markdown:
|
||||
auto_line_breaks: false
|
||||
auto_url_links: false
|
||||
escape_markup: false
|
||||
|
||||
#
|
||||
# Shortcode
|
||||
#
|
||||
# - shortcodes: Flextype Shortcodes to load.
|
||||
shortcode:
|
||||
shortcodes:
|
||||
entries:
|
||||
enabled: true
|
||||
raw:
|
||||
enabled: true
|
||||
registry:
|
||||
enabled: true
|
||||
url:
|
||||
enabled: true
|
||||
parsers:
|
||||
markdown:
|
||||
auto_line_breaks: false
|
||||
auto_url_links: false
|
||||
escape_markup: false
|
||||
shortcode:
|
||||
shortcodes:
|
||||
entries:
|
||||
enabled: true
|
||||
raw:
|
||||
enabled: true
|
||||
registry:
|
||||
enabled: true
|
||||
url:
|
||||
enabled: true
|
||||
|
||||
# CORS
|
||||
#
|
||||
|
Reference in New Issue
Block a user