Skip to content

Commit

Permalink
Merge branch 'release/5.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Dec 9, 2021
2 parents 3c90115 + df47ece commit c11e180
Show file tree
Hide file tree
Showing 17 changed files with 677 additions and 93 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# v5.1.0
## 12/09/2021

1. [](#new)
* Notice shortcode now uses a twig template to allow for easy overriding of style
1. [](#improved)
* Updated vendor libraries to latest

# v5.0.7
## 09/28/2021

1. [](#bugfix)
* NextGen Editor: Ensure content of children shortcode elements, such as UI Tab content, have a new empty line as prefix and suffix, to ensure Markdown lists are not lost [getgrav/grav-premium-issues#123](https://github.com/getgrav/grav-premium-issues/issues/123)
2. [](#improved)
1. [](#improved)
* Added `processShortcodesRaw()` using raw_handlers [#104](https://github.com/getgrav/grav-plugin-shortcode-core/pull/104)
* Better vertical alignment for inline shortcodes in NextGen Editor
1. [](#bugfix)
* NextGen Editor: Ensure content of children shortcode elements, such as UI Tab content, have a new empty line as prefix and suffix, to ensure Markdown lists are not lost [getgrav/grav-premium-issues#123](https://github.com/getgrav/grav-premium-issues/issues/123)

# v5.0.6
## 04/27/2021
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,15 @@ enabled: true
active: true
active_admin: true
admin_pages_only: true
parser: regex
parser: regular
include_default_shortcodes: true
css:
notice_enabled: true
custom_shortcodes:
load_fontawesome: false
fontawesome:
load: true
url: '//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css'
v5: false
```
* `enabled: true|false` toggles if the shortcodes plugin is turned on or off
Expand All @@ -58,7 +63,9 @@ load_fontawesome: false
* `parser: wordpress|regex|regular` let's you configure the parser to use
* `include_default_shortcodes: true|false` toggle the inclusion of shortcodes provided by this plugin
* `custom_shortcodes:` the path to a directory where you can put your custom shortcodes (e.g. `/user/custom/shortcodes`)
* `load_fontawesome: true|false` toggles if the fontawesome icon library should be loaded or not
* `fontawesome.load: true|false` toggles if the fontawesome icon library should be loaded or not
* `fontawesome.url:` the CDN Url to use for fontawesome
* `v5:` Version 5 flag as it requires some additional logic

> NOTE: In previous versions the `wordpress` parser was preferred. However with version `2.4.0`, the `regex` parser is now default. If you have saved configuration, you should manually change this to `regex` or you may receive errors or bad output.

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Shortcode Core
slug: shortcode-core
type: plugin
version: 5.0.7
version: 5.1.0
description: "This plugin provides the core functionality for shortcode plugins"
icon: code
author:
Expand Down
8 changes: 6 additions & 2 deletions classes/shortcodes/NoticeShortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ public function init()
if ($css_enabled) {
$this->shortcode->addAssets('css', 'plugin://shortcode-core/css/shortcode-notice.css');
}
$type = $sc->getParameter('notice', $this->getBbCode($sc)) ?: 'info';

return '<div class="sc-notice '.$type.'"><div>'.$sc->getContent().'</div></div>';
$output = $this->twig->processTemplate('shortcodes/notice.html.twig', [
'type' => $sc->getParameter('notice', $this->getBbCode($sc)) ?: 'info',
'content' => $sc->getContent(),
]);

return $output;
});
}
}
17 changes: 11 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion shortcode-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public function onPluginsInitialized()
'onPageContentRaw' => ['onPageContentRaw', 0],
'onPageContentProcessed' => ['onPageContentProcessed', -10],
'onPageContent' => ['onPageContent', 0],
'onTwigInitialized' => ['onTwigInitialized', 0]
'onTwigInitialized' => ['onTwigInitialized', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
]);

$this->grav['shortcode'] = $this->shortcodes = new ShortcodeManager();
Expand Down Expand Up @@ -234,6 +235,11 @@ public function onTwigInitialized()
$this->grav['twig']->twig_vars['shortcode'] = new ShortcodeTwigVar();
}

public function onTwigTemplatePaths()
{
$this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
}

public function registerNextGenEditorPlugin($event) {
$config = $this->config->get('plugins.shortcode-core.nextgen-editor');
$plugins = $event['plugins'];
Expand Down
3 changes: 3 additions & 0 deletions templates/shortcodes/notice.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="sc-notice {{ type }}">
<div>{{ content|raw }}</div>
</div>
Loading

0 comments on commit c11e180

Please sign in to comment.