jekyll_emoji_tag 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -2
- data/CHANGELOG.md +9 -1
- data/README.md +13 -10
- data/lib/emoji.rb +27 -19
- data/lib/jekyll_emoji_tag/version.rb +1 -1
- data/lib/jekyll_emoji_tag.rb +2 -0
- data/spec/jekyll_emoji_tag/emoji_spec.rb +13 -0
- data/spec/spec_helper.rb +2 -4
- metadata +4 -4
- data/spec/jekyll_emoji_tag_spec.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eb6b23f31b0027e1c56bd56cb401e238f306b68446f90f5099f6b54865771cc
|
4
|
+
data.tar.gz: 5f7db9dde9f792bce5ab4b254187de9fc4388ba6b28eb8b5bf36189f136cfc4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f6ea9272747a6e5db45df59756cdaac437c87cf4e3d00a7e3db3aaa868585776439aec0c6620823bc48f038c06ac769f7e72b7867618e0bbdf52e4392fec280
|
7
|
+
data.tar.gz: 60eda292128ef83af1bfa225adbc824a493d31d3f3d5689580d9f690c08db67e81e92a576f696bdd282fd40378c551ce2e817f905c55ca46775fde3a481c0a94
|
data/.rubocop.yml
CHANGED
@@ -8,11 +8,10 @@ require:
|
|
8
8
|
AllCops:
|
9
9
|
Exclude:
|
10
10
|
- binstub/**/*
|
11
|
-
-
|
11
|
+
- binstub/**/*
|
12
12
|
- vendor/**/*
|
13
13
|
- Gemfile*
|
14
14
|
NewCops: enable
|
15
|
-
TargetRubyVersion: 3.1.3
|
16
15
|
|
17
16
|
Gemspec/DeprecatedAttributeAssignment:
|
18
17
|
Enabled: false
|
@@ -20,6 +19,9 @@ Gemspec/DeprecatedAttributeAssignment:
|
|
20
19
|
Gemspec/RequireMFA:
|
21
20
|
Enabled: false
|
22
21
|
|
22
|
+
Gemspec/RequiredRubyVersion:
|
23
|
+
Enabled: false
|
24
|
+
|
23
25
|
Layout/HashAlignment:
|
24
26
|
EnforcedColonStyle: table
|
25
27
|
EnforcedHashRocketStyle: table
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
`jekyll_emoji_tag`
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/jekyll_emoji_tag.svg)](https://badge.fury.io/rb/jekyll_emoji_tag)
|
3
|
-
===========
|
1
|
+
# `jekyll_emoji_tag` [![Gem Version](https://badge.fury.io/rb/jekyll_emoji_tag.svg)](https://badge.fury.io/rb/jekyll_emoji_tag)
|
4
2
|
|
5
3
|
Inserts the specified emoji into the document.
|
6
4
|
You can specify the size and alignment of the emoji.
|
@@ -18,6 +16,7 @@ end
|
|
18
16
|
```
|
19
17
|
|
20
18
|
And then execute:
|
19
|
+
|
21
20
|
```bash
|
22
21
|
$ bundle
|
23
22
|
```
|
@@ -28,13 +27,17 @@ $ bundle
|
|
28
27
|
```text
|
29
28
|
{% emoji OPTIONS %}
|
30
29
|
```
|
30
|
+
|
31
31
|
`OPTIONS` are:
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
- `align` - `left`, `right` or `inline` (default is inline)
|
34
|
+
- `class` - CSS style to add to the generated emoji
|
35
|
+
- `div` - Wrap the emoji in a <div> instead of a <span>
|
36
|
+
- `emoji_and_name` - causes the name of the emoji to be output along with the image (default is false)
|
37
|
+
- `list` - output all emojis (default is false)
|
38
|
+
- `name` - name of emoji (defaults to smiley)
|
39
|
+
- `size` - height of emoji (defaults to 3em)
|
40
|
+
- `style` - Additional CSS styles for the generated emoji
|
38
41
|
|
39
42
|
`list` and `name` are mutually exclusive; only specify one of them.
|
40
43
|
|
@@ -42,7 +45,7 @@ If neither `list` nor `name` is specified, the `smiley` emoji is output.
|
|
42
45
|
|
43
46
|
The names of all supported emojis are:
|
44
47
|
|
45
|
-
```
|
48
|
+
```text
|
46
49
|
angry
|
47
50
|
boom
|
48
51
|
grin
|
@@ -88,7 +91,7 @@ and push the `.gem` file to https://rubygems.org.
|
|
88
91
|
|
89
92
|
## Contributing
|
90
93
|
|
91
|
-
Bug reports and pull requests are welcome
|
94
|
+
Bug reports and pull requests are welcome at https://github.com/mslinn/jekyll_emoji_tag.
|
92
95
|
|
93
96
|
|
94
97
|
## License
|
data/lib/emoji.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'jekyll_plugin_support'
|
2
|
-
require_relative 'jekyll_emoji_tag/version
|
2
|
+
require_relative 'jekyll_emoji_tag/version'
|
3
3
|
|
4
4
|
# This Jekyll tag plugin creates an emoji of the desired size and alignment.
|
5
5
|
#
|
@@ -24,9 +24,13 @@ module JekyllEmojiTag
|
|
24
24
|
PLUGIN_NAME = 'emoji'.freeze
|
25
25
|
VERSION = JekyllEmojiTag::VERSION
|
26
26
|
|
27
|
+
class << self
|
28
|
+
attr_accessor :emojis
|
29
|
+
end
|
30
|
+
|
27
31
|
# Supported emojis (GitHub symbol, hex code) - see https://gist.github.com/rxaviers/7360908 and
|
28
32
|
# https://www.quackit.com/character_sets/emoji/emoji_v3.0/unicode_emoji_v3.0_characters_all.cfm
|
29
|
-
|
33
|
+
Emoji.emojis = {
|
30
34
|
'angry' => '😠',
|
31
35
|
'boom' => '💥', # used when requested emoji is not recognized
|
32
36
|
'grin' => '😀',
|
@@ -46,12 +50,15 @@ module JekyllEmojiTag
|
|
46
50
|
# @param tokens [Liquid::ParseContext] tokenized command line
|
47
51
|
# @return [void]
|
48
52
|
def render_impl
|
53
|
+
@klass = @helper.parameter_specified? 'class'
|
54
|
+
@tag = @helper.parameter_specified?('div') ? 'div' : 'span'
|
55
|
+
@style = @helper.parameter_specified? 'style'
|
49
56
|
@emoji_name = @helper.parameter_specified?('name') || 'smiley' # Ignored if `list` is specified
|
50
57
|
@emoji_align = @helper.parameter_specified?('align') || 'inline' # Allowable values are: inline, right or left
|
51
58
|
@emoji_size = @helper.parameter_specified?('size') || '3em'
|
52
|
-
@emoji_and_name = @helper.parameter_specified?
|
53
|
-
@list = @helper.parameter_specified?
|
54
|
-
@emoji_hex_code =
|
59
|
+
@emoji_and_name = @helper.parameter_specified? 'emoji_and_name'
|
60
|
+
@list = @helper.parameter_specified? 'list'
|
61
|
+
@emoji_hex_code = Emoji.emojis[@emoji_name] if @emoji_name || Emoji.emojis['boom']
|
55
62
|
|
56
63
|
# variables defined in pages are stored as hash values in liquid_context
|
57
64
|
# _assigned_page_variable = @liquid_context['assigned_page_variable']
|
@@ -64,7 +71,7 @@ module JekyllEmojiTag
|
|
64
71
|
mode="#{@mode}"
|
65
72
|
page attributes:
|
66
73
|
#{@page.sort
|
67
|
-
.
|
74
|
+
.except(*REJECTED_ATTRIBUTES)
|
68
75
|
.map { |k, v| "#{k}=#{v}" }
|
69
76
|
.join("\n ")}
|
70
77
|
HEREDOC
|
@@ -81,25 +88,26 @@ module JekyllEmojiTag
|
|
81
88
|
private
|
82
89
|
|
83
90
|
def assemble_emoji(emoji_name, emoji_hex_code)
|
84
|
-
case @emoji_align
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
align = case @emoji_align
|
92
|
+
when 'inline'
|
93
|
+
''
|
94
|
+
when 'right'
|
95
|
+
' float: right; margin-left: 5px;'
|
96
|
+
when 'left'
|
97
|
+
' float: left; margin-right: 5px;'
|
98
|
+
else
|
99
|
+
@logger.error { "Invalid emoji alignment #{@emoji_align}" }
|
100
|
+
''
|
101
|
+
end
|
95
102
|
|
96
103
|
name = " <code>#{emoji_name}</code>" if @emoji_and_name
|
104
|
+
klass = @klass ? " class='#{@klass}'" : ''
|
97
105
|
|
98
|
-
"
|
106
|
+
"<#{@tag}#{klass} style='font-size: #{@emoji_size};#{align};#{@style}'>#{emoji_hex_code}</#{@tag}>#{name}"
|
99
107
|
end
|
100
108
|
|
101
109
|
def list
|
102
|
-
items =
|
110
|
+
items = Emoji.emojis.map do |ename, hex_code|
|
103
111
|
" <li>#{assemble_emoji(ename, hex_code)}</li>"
|
104
112
|
end
|
105
113
|
<<~END_RESULT
|
data/lib/jekyll_emoji_tag.rb
CHANGED
@@ -6,5 +6,7 @@ require_relative 'jekyll_emoji_tag/version'
|
|
6
6
|
|
7
7
|
# Require all Ruby files in 'lib/', except this file
|
8
8
|
Dir[File.join(__dir__, '*.rb')].each do |file|
|
9
|
+
# puts "About to require #{file}"
|
9
10
|
require file unless file.end_with?('/jekyll_emoji_tag.rb')
|
11
|
+
# puts "Required #{file}"
|
10
12
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../../lib/jekyll_emoji_tag'
|
2
|
+
|
3
|
+
RSpec.describe(JekyllEmojiTag::Emoji) do
|
4
|
+
let(:logger) do
|
5
|
+
PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:parse_context) { TestParseContext.new }
|
9
|
+
|
10
|
+
it 'has a test', skip: 'just a placeholder' do
|
11
|
+
expect(true).to be_truthy
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,12 +3,10 @@ require 'jekyll_plugin_logger'
|
|
3
3
|
require 'liquid'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'yaml'
|
6
|
-
require_relative '../lib
|
6
|
+
require_relative '../lib/jekyll_emoji_tag'
|
7
7
|
|
8
8
|
RSpec.configure do |config|
|
9
|
-
config.filter_run :focus
|
10
9
|
# config.order = 'random'
|
11
|
-
config.run_all_when_everything_filtered = true
|
12
10
|
|
13
11
|
# See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
|
14
12
|
config.example_status_persistence_file_path = '../spec/status_persistence.txt'
|
@@ -30,7 +28,7 @@ class SiteMock
|
|
30
28
|
attr_reader :config
|
31
29
|
|
32
30
|
def initialize
|
33
|
-
@config = YAML.
|
31
|
+
@config = YAML.safe_load_file('../demo/_config.yml')
|
34
32
|
@config['env'] = { 'JEKYLL_ENV' => 'development' }
|
35
33
|
end
|
36
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_emoji_tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -55,7 +55,7 @@ files:
|
|
55
55
|
- lib/emoji.rb
|
56
56
|
- lib/jekyll_emoji_tag.rb
|
57
57
|
- lib/jekyll_emoji_tag/version.rb
|
58
|
-
- spec/
|
58
|
+
- spec/jekyll_emoji_tag/emoji_spec.rb
|
59
59
|
- spec/spec_helper.rb
|
60
60
|
homepage: https://github.com/mslinn/jekyll_emoji_tag
|
61
61
|
licenses:
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
87
|
+
rubygems_version: 3.5.5
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: Inserts an emoji
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require_relative '../lib/jekyll_emoji_tag'
|
2
|
-
|
3
|
-
RSpec.describe JekyllEmojiTag::JekyllEmojiTag do
|
4
|
-
let(:logger) do
|
5
|
-
PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
6
|
-
end
|
7
|
-
|
8
|
-
let(:parse_context) { TestParseContext.new }
|
9
|
-
|
10
|
-
it 'has a test' do
|
11
|
-
expect(true).to be_true
|
12
|
-
end
|
13
|
-
end
|