GithubHelp home page GithubHelp logo

sommerregen / grav-plugin-smileys Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 201 KB

This plugin substitutes text emoticons, also known as smilies like :-), with images.

License: Other

CSS 0.48% PHP 99.52%
grav grav-plugin smileys emoji

grav-plugin-smileys's Introduction

Grav Smileys Plugin

Release Issues Dual license Flattr PayPal

This plugin substitutes text emoticons, also known as smilies like :-), with images.

Table of Contents:

About

Smileys, also known as "emoticons," are pictorial representation of facial expressions to convey emotions in your writing. They are a great way to brighten up texts.

Text smileys are created by typing two or more punctuation marks. Some examples are:

:-) :D :'-( <3

By default, Grav Smileys Plugin automatically converts text smileys to graphic images. When you type ;-) in your page you see a smile emoticon when you preview or publish your page.

Screenshot Grav Smileys Plugin

Further it comes with a pre-configured set of example smileys (using Grav Smileys Data Pack -- Simple Smileys). An unlimited amount of custom smileys can be setup as well.

If you want, you can add your own smileys by importing ready to use packages available around the Internet. Currently available are:

Installation and Updates

Installing or updating the TSmileys plugin can be done in one of two ways. Using the GPM (Grav Package Manager) installation update method (i.e. bin/gpm install smileys) or manual install by downloading this plugin and extracting all plugin files to

user/plugins/smileys

For more informations, please check the Installation and update guide.

Usage

The Smileys plugin comes with some sensible default configuration, that are pretty self explanatory:

Config Defaults

# Global plugin configurations

enabled: true                 # Set to false to disable this plugin completely
built_in_css: true            # Use built-in CSS of the plugin
weight: 1                     # Set the weight (order of execution)

# Default values for Smileys configuration.

pack: simple_smileys          # The name of the smileys package

# Global and page specific configurations

process: true                 # Filter smileys
exclude:
  tags: [code, pre]           # Exclude tags from smiley replacement
  classes: [mathjax, latex]   # Exclude classes from smiley replacement

If you need to change any value, then the best process is to copy the smileys.yaml file into your users/config/plugins/ folder (create it if it doesn't exist), and then modify there. This will override the default settings.

If you want to alter the settings for one or a few pages only, you can do so by adding page specific configurations into your page headers, e.g.

smileys:
  process: false

to switch off Smileys plugin just for this page.

CSS Stylesheet Override

Something you might want to do is to override the look and feel of the external links, and with Grav it is super easy.

Copy the stylesheet assets/css/smileys.css into the css folder of your custom theme and add it to the list of CSS files.

user/themes/custom-theme/css/smileys.css

After that set the built_in_css option of the Smileys plugin to false. That's it.

You can now edit, override and tweak it however you prefer. Smiley images provide the CSS class smileys to style your smileys differently from other images.

Contributing

You can contribute at any time! Before opening any issue, please search for existing issues and review the guidelines for contributing.

After that please note:

  • If you find a bug, would like to make a feature request or suggest an improvement, please open a new issue. If you have any interesting ideas for additions to the syntax please do suggest them as well!
  • Feature requests are more likely to get attention if you include a clearly described use case.
  • If you wish to submit a pull request, please make again sure that your request match the guidelines for contributing and that you keep track of adding unit tests for any new or changed functionality.

Support and donations

If you like my project, feel free to support me via Flattr or by sending me some bitcoins to 1HQdy5aBzNKNvqspiLvcmzigCq7doGfLM4.

Thanks!

License

Copyright (c) 2015 Benjamin Regler. See also the list of contributors who participated in this project.

Dual-licensed for use under the terms of the MIT or GPLv3 licenses.

GNU license - Some rights reserved

grav-plugin-smileys's People

Contributors

flaviocopes avatar sommerregen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grav-plugin-smileys's Issues

Feature request: Add support for ALT and TITLE Tags

I'd like to be able to override the default ALT and TITLE tags. Currently, the default is :smiley_name: for both. ⏬

I'm not sure of the best syntax to use. Maybe something like
:smiley_name|alt_text|title_text:

My use case is that I'd like something other than :arrow_double_down: to display when hovering over my download icons.
[:arrow_double_down|Download|Download:](http://somesite.com/download.html)

E_NOTICE - Undefined index: enabled

This is the error I get on page reload, simply trying smileys out with all default settings.
setting the plugin to enabled: false in user/config/plugins/smileys.yaml makes the error go away, but then of course the plugin doesn't do anything either.
My grav is up-to-date.
Am I missing something here?

relevant log entry:

[2016-12-10 12:19:29] grav.CRITICAL: Undefined index: enabled - Trace: #0 /path/to/grav/user/plugins/smileys/classes/Smileys.php(202): Whoops\Run->handleError(8, 'Undefined index...', '/path/to/grav...', 202, Array) #1 /path/to/grav/user/plugins/smileys/classes/Smileys.php(80): Grav\Plugin\Smileys->load('simple_smileys', '/path/to/grav...') #2 /path/to/grav/user/plugins/smileys/smileys.php(237): Grav\Plugin\Smileys->__construct('simple_smileys', '/path/to/grav...') #3 /path/to/grav/user/plugins/smileys/smileys.php(113): Grav\Plugin\SmileysPlugin->init() #4 [internal function]: Grav\Plugin\SmileysPlugin->onPageContentProcessed(Object(RocketTheme\Toolbox\Event\Event), 'onPageContentPr...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #5 /path/to/grav/vendor/symfony/event-dispatcher/EventDispatcher.php(184): call_user_func(Array, Object(RocketTheme\Toolbox\Event\Event), 'onPageContentPr...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #6 /path/to/grav/vendor/symfony/event-dispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'onPageContentPr...', Object(RocketTheme\Toolbox\Event\Event)) #7 /path/to/grav/vendor/rockettheme/toolbox/Event/src/EventDispatcher.php(23): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('onPageContentPr...', Object(RocketTheme\Toolbox\Event\Event)) #8 /path/to/grav/system/src/Grav/Common/Grav.php(272): RocketTheme\Toolbox\Event\EventDispatcher->dispatch('onPageContentPr...', Object(RocketTheme\Toolbox\Event\Event)) #9 /path/to/grav/system/src/Grav/Common/Page/Page.php(598): Grav\Common\Grav->fireEvent('onPageContentPr...', Object(RocketTheme\Toolbox\Event\Event)) #10 /path/to/grav/system/src/Grav/Common/Twig/Twig.php(319): Grav\Common\Page\Page->content() #11 /path/to/grav/system/src/Grav/Common/Service/OutputServiceProvider.php(18): Grav\Common\Twig\Twig->processSite(NULL) #12 /path/to/grav/vendor/pimple/pimple/src/Pimple/Container.php(113): Grav\Common\Service\OutputServiceProvider->Grav\Common\Service\{closure}(Object(Grav\Common\Grav)) #13 /path/to/grav/system/src/Grav/Common/Processors/RenderProcessor.php(17): Pimple\Container->offsetGet('output') #14 /path/to/grav/system/src/Grav/Common/Grav.php(121): Grav\Common\Processors\RenderProcessor->process() #15 /path/to/grav/system/src/Grav/Common/Grav.php(358): Grav\Common\Grav->Grav\Common\{closure}() #16 [internal function]: Grav\Common\Grav::Grav\Common\{closure}('render', 'Render', Object(Closure)) #17 /path/to/grav/system/src/Grav/Common/Grav.php(334): call_user_func_array(Object(Closure), Array) #18 /path/to/grav/system/src/Grav/Common/Grav.php(122): Grav\Common\Grav->__call('measureTime', Array) #19 /path/to/grav/system/src/Grav/Common/Grav.php(122): Grav\Common\Grav->measureTime('render', 'Render', Object(Closure)) #20 /path/to/grav/index.php(45): Grav\Common\Grav->process() #21 {main} [] []

Plugin breaks page rendering

With plugin enabled:

enabled

With plugin disabled:
disabled

Markdown source file:
There are quite a lot of options [how to install a kubernetes cluster](https://kubernetes.io/docs/setup/pick-right-solution/).

Version:

Grav 1.4.4
Plugin: 1.2.1

Error while displaying unknown smiley

Using the simple_smileys asset package.

Whoops\Exception\ErrorException thrown with message "Undefined index: D:<"

Stacktrace:
#10 Whoops\Exception\ErrorException in E:\grav\user\plugins\smileys\classes\Smileys.php:237
#9 Whoops\Run:handleError in E:\grav\user\plugins\smileys\classes\Smileys.php:237
#8 Grav\Plugin\Smileys:load in E:\grav\user\plugins\smileys\classes\Smileys.php:78
#7 Grav\Plugin\Smileys:__construct in E:\grav\user\plugins\smileys\smileys.php:118
#6 Grav\Plugin\SmileysPlugin:onPluginsInitialized in <#unknown>:0
#5 call_user_func in E:\grav\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php:164
#4 Symfony\Component\EventDispatcher\EventDispatcher:doDispatch in E:\grav\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php:53
#3 Symfony\Component\EventDispatcher\EventDispatcher:dispatch in E:\grav\vendor\rockettheme\toolbox\Event\src\EventDispatcher.php:23
#2 RocketTheme\Toolbox\Event\EventDispatcher:dispatch in E:\grav\system\src\Grav\Common\Grav.php:328
#1 Grav\Common\Grav:fireEvent in E:\grav\system\src\Grav\Common\Grav.php:181
#0 Grav\Common\Grav:process in E:\grav\index.php:31

undefined index

Hello when I install and activate this plugin I get the following error

[2015-11-11 17:15:46] grav.CRITICAL: Undefined index: enabled - Trace: #0 C:\xampp\htdocs\__mynews\grav\user\plugins\smileys\classes\Smileys.php(202): Whoops\Run->handleError(8, 'Undefined index...', 'C:\xampp\htdocs...', 202, Array) #1 C:\xampp\htdocs\__mynews\grav\user\plugins\smileys\classes\Smileys.php(80): Grav\Plugin\Smileys->load('simple_smileys', 'C:/xampp/htdocs...') #2 C:\xampp\htdocs\__mynews\grav\user\plugins\smileys\smileys.php(237): Grav\Plugin\Smileys->__construct('simple_smileys', 'C:/xampp/htdocs...') #3 C:\xampp\htdocs\__mynews\grav\user\plugins\smileys\smileys.php(113): Grav\Plugin\SmileysPlugin->init() #4 [internal function]: Grav\Plugin\SmileysPlugin->onPageContentProcessed(Object(RocketTheme\Toolbox\Event\Event), 'onPageContentPr...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #5 C:\xampp\htdocs\__mynews\grav\vendor\symfony\event-dispatcher\EventDispatcher.php(160): call_user_func(Array, Object(RocketTheme\Toolbox\Event\Event), 'onPageContentPr...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #6 C:\xampp\htdocs\__mynews\grav\vendor\symfony\event-dispatcher\EventDispatcher.php(48): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'onPageContentPr...', Object(RocketTheme\Toolbox\Event\Event)) #7 C:\xampp\htdocs\__mynews\grav\vendor\rockettheme\toolbox\Event\src\EventDispatcher.php(23): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('onPageContentPr...', Object(RocketTheme\Toolbox\Event\Event)) #8 C:\xampp\htdocs\__mynews\grav\system\src\Grav\Common\Grav.php(406): RocketTheme\Toolbox\Event\EventDispatcher->dispatch('onPageContentPr...', Object(RocketTheme\Toolbox\Event\Event)) #9 C:\xampp\htdocs\__mynews\grav\system\src\Grav\Common\Page\Page.php(584): Grav\Common\Grav->fireEvent('onPageContentPr...', Object(RocketTheme\Toolbox\Event\Event)) #10 C:\xampp\htdocs\__mynews\grav\system\src\Grav\Common\Page\Page.php(514): Grav\Common\Page\Page->cachePageContent() #11 C:\xampp\htdocs\__mynews\grav\system\src\Grav\Common\Twig\Twig.php(302): Grav\Common\Page\Page->content() #12 C:\xampp\htdocs\__mynews\grav\system\src\Grav\Common\Grav.php(157): Grav\Common\Twig\Twig->processSite(NULL) #13 C:\xampp\htdocs\__mynews\grav\vendor\pimple\pimple\src\Pimple\Container.php(113): Grav\Common\Grav::Grav\Common\{closure}(Object(Grav\Common\Grav)) #14 C:\xampp\htdocs\__mynews\grav\system\src\Grav\Common\Grav.php(255): Pimple\Container->offsetGet('output') #15 C:\xampp\htdocs\__mynews\grav\index.php(37): Grav\Common\Grav->process() #16 {main} [] []

using Croatian chars in text breaks plugin

Hello,
thanks a lot for smiley-plugin, but have problem with emoji - as soon as text contain some of Croatian characters, plugin fails...

Here is test text:

This is a test for smiley plugin... :smile:

Let me try to add another smiley. :smile:

and it renders both, but if I change 2nd line into:

Let me try to add another šmiley. :smile:

it just shows :smile: instead. Any hint?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.