Skip to content

Commit c11e180

Browse files
committed
Merge branch 'release/5.1.0'
2 parents 3c90115 + df47ece commit c11e180

File tree

17 files changed

+677
-93
lines changed

17 files changed

+677
-93
lines changed

CHANGELOG.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
# v5.1.0
2+
## 12/09/2021
3+
4+
1. [](#new)
5+
* Notice shortcode now uses a twig template to allow for easy overriding of style
6+
1. [](#improved)
7+
* Updated vendor libraries to latest
8+
19
# v5.0.7
210
## 09/28/2021
311

4-
1. [](#bugfix)
5-
* 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)
6-
2. [](#improved)
12+
1. [](#improved)
713
* Added `processShortcodesRaw()` using raw_handlers [#104](https://github.com/getgrav/grav-plugin-shortcode-core/pull/104)
814
* Better vertical alignment for inline shortcodes in NextGen Editor
15+
1. [](#bugfix)
16+
* 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)
917

1018
# v5.0.6
1119
## 04/27/2021

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ enabled: true
4545
active: true
4646
active_admin: true
4747
admin_pages_only: true
48-
parser: regex
48+
parser: regular
4949
include_default_shortcodes: true
50+
css:
51+
notice_enabled: true
5052
custom_shortcodes:
51-
load_fontawesome: false
53+
fontawesome:
54+
load: true
55+
url: '//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css'
56+
v5: false
5257
```
5358
5459
* `enabled: true|false` toggles if the shortcodes plugin is turned on or off
@@ -58,7 +63,9 @@ load_fontawesome: false
5863
* `parser: wordpress|regex|regular` let's you configure the parser to use
5964
* `include_default_shortcodes: true|false` toggle the inclusion of shortcodes provided by this plugin
6065
* `custom_shortcodes:` the path to a directory where you can put your custom shortcodes (e.g. `/user/custom/shortcodes`)
61-
* `load_fontawesome: true|false` toggles if the fontawesome icon library should be loaded or not
66+
* `fontawesome.load: true|false` toggles if the fontawesome icon library should be loaded or not
67+
* `fontawesome.url:` the CDN Url to use for fontawesome
68+
* `v5:` Version 5 flag as it requires some additional logic
6269

6370
> 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.
6471

blueprints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Shortcode Core
22
slug: shortcode-core
33
type: plugin
4-
version: 5.0.7
4+
version: 5.1.0
55
description: "This plugin provides the core functionality for shortcode plugins"
66
icon: code
77
author:

classes/shortcodes/NoticeShortcode.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ public function init()
1212
if ($css_enabled) {
1313
$this->shortcode->addAssets('css', 'plugin://shortcode-core/css/shortcode-notice.css');
1414
}
15-
$type = $sc->getParameter('notice', $this->getBbCode($sc)) ?: 'info';
1615

17-
return '<div class="sc-notice '.$type.'"><div>'.$sc->getContent().'</div></div>';
16+
$output = $this->twig->processTemplate('shortcodes/notice.html.twig', [
17+
'type' => $sc->getParameter('notice', $this->getBbCode($sc)) ?: 'info',
18+
'content' => $sc->getContent(),
19+
]);
20+
21+
return $output;
1822
});
1923
}
2024
}

composer.lock

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shortcode-core.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public function onPluginsInitialized()
6262
'onPageContentRaw' => ['onPageContentRaw', 0],
6363
'onPageContentProcessed' => ['onPageContentProcessed', -10],
6464
'onPageContent' => ['onPageContent', 0],
65-
'onTwigInitialized' => ['onTwigInitialized', 0]
65+
'onTwigInitialized' => ['onTwigInitialized', 0],
66+
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
6667
]);
6768

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

238+
public function onTwigTemplatePaths()
239+
{
240+
$this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
241+
}
242+
237243
public function registerNextGenEditorPlugin($event) {
238244
$config = $this->config->get('plugins.shortcode-core.nextgen-editor');
239245
$plugins = $event['plugins'];
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="sc-notice {{ type }}">
2+
<div>{{ content|raw }}</div>
3+
</div>

0 commit comments

Comments
 (0)