-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed attributes broken on link shortcode
added new gravstrap-list shortcode to handle a generic list added new gravstrap-item shortcode to handle a generic html item
- Loading branch information
Showing
9 changed files
with
203 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/** | ||
* This file is part of the Gravstrap plugin and it is distributed | ||
* under the MIT License. To use this application you must leave | ||
* intact this copyright notice. | ||
* | ||
* Copyright (c) Giansimon Diblas <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* For extra documentation and help please visit http://diblas.net | ||
* | ||
* @license MIT License | ||
* | ||
*/ | ||
|
||
namespace Grav\Plugin\Shortcodes; | ||
|
||
use Thunder\Shortcode\Shortcode\ShortcodeInterface; | ||
|
||
/** | ||
* Class ItemShortcode handles a generic html item | ||
* | ||
* @author Giansimon Diblas | ||
*/ | ||
class ItemShortcode extends GravstrapShortcode | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function shortcodeName() | ||
{ | ||
return 'gravstrap-item'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function template() | ||
{ | ||
return 'basic/item.html.twig'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function renderOutput(ShortcodeInterface $shortcode) | ||
{ | ||
return $this->grav['twig']->processTemplate($this->template(), [ | ||
'name' => $shortcode->getParameter('name'), | ||
'tag' => $shortcode->getParameter('tag'), | ||
'item_attributes' => $shortcode->getParameter('attributes'), | ||
'content' => $shortcode->getContent(), | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* This file is part of the Gravstrap plugin and it is distributed | ||
* under the MIT License. To use this application you must leave | ||
* intact this copyright notice. | ||
* | ||
* Copyright (c) Giansimon Diblas <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* For extra documentation and help please visit http://diblas.net | ||
* | ||
* @license MIT License | ||
* | ||
*/ | ||
|
||
namespace Grav\Plugin\Shortcodes; | ||
|
||
use Thunder\Shortcode\Shortcode\ShortcodeInterface; | ||
|
||
/** | ||
* Class ListItemShortcode handles a list item | ||
* | ||
* @author Giansimon Diblas | ||
*/ | ||
class ListItemShortcode extends GravstrapShortcode | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function shortcodeName() | ||
{ | ||
return 'gravstrap-list-item'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function template() | ||
{ | ||
return 'basic/list-item.html.twig'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function renderOutput(ShortcodeInterface $shortcode) | ||
{ | ||
$output = $this->grav['twig']->processTemplate($this->template(), [ | ||
'name' => $shortcode->getParameter('name'), | ||
'item_attributes' => $shortcode->getParameter('attributes'), | ||
'content' => $shortcode->getContent(), | ||
]); | ||
|
||
return $output; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* This file is part of the Gravstrap plugin and it is distributed | ||
* under the MIT License. To use this application you must leave | ||
* intact this copyright notice. | ||
* | ||
* Copyright (c) Giansimon Diblas <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* For extra documentation and help please visit http://diblas.net | ||
* | ||
* @license MIT License | ||
* | ||
*/ | ||
|
||
namespace Grav\Plugin\Shortcodes; | ||
|
||
use Gravstrap\Base\RegisteredShortcodes; | ||
use Thunder\Shortcode\Shortcode\ShortcodeInterface; | ||
|
||
/** | ||
* Class ListShortcode handles a generic list | ||
* | ||
* @author Giansimon Diblas | ||
*/ | ||
class ListShortcode extends GravstrapShortcode | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function shortcodeName() | ||
{ | ||
return 'gravstrap-list'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function template() | ||
{ | ||
return 'basic/list.html.twig'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function renderOutput(ShortcodeInterface $shortcode) | ||
{ | ||
$tag = null !== $shortcode->getParameter('tag') ? $shortcode->getParameter('tag') : 'ul'; | ||
$items = RegisteredShortcodes::get($this->shortcode->getId($shortcode)); | ||
$output = $this->grav['twig']->processTemplate($this->template(), [ | ||
'list_attributes' => $shortcode->getParameter('attributes'), | ||
'items' => $items, | ||
'tag' => $tag, | ||
]); | ||
|
||
return $output; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% set attributes = parse_attributes(item_attributes) %} | ||
{% if tag is not null %} | ||
<{{ tag }} {% include 'partials/_attributes.html.twig' %}> | ||
{% endif %} | ||
{{ content }} | ||
{% if tag is not null %} | ||
</{{ tag }}> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% set attributes = parse_attributes(item_attributes) %} | ||
<li {% include 'partials/_attributes.html.twig' %}>{{ content }}</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% set attributes = parse_attributes(list_attributes) %} | ||
<{{ tag }} {% include 'partials/_attributes.html.twig' %}> | ||
{% for item in items %} | ||
{{ item }} | ||
{% endfor %} | ||
</{{ tag }}> |