jekyll_emoji_tag 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -2
- data/CHANGELOG.md +16 -1
- data/README.md +13 -10
- data/Rakefile +0 -0
- data/jekyll_emoji_tag.gemspec +0 -0
- data/lib/emoji.rb +44 -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 +3 -3
- 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: 64d5cea22eb35ac231d709583651d72dba062107523891bad70fe6b75c56620a
|
4
|
+
data.tar.gz: 751a2a539a60b3bc3343f9ae8a6c54be1d75364ea288a3353ada74e29fc2bcff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cdc209c6994b4fed0361014d3937f8210df0f642e2eab8ede4a2bc0db598d8dff2678440415e5abc4102706636945d95e4ca59363572107e043dd4337f8bab7
|
7
|
+
data.tar.gz: e2ddf7e1370266c7a9ba2d3d8853ee39cd3e981b616e4a6649e4b51f7bc4f6ddd5ee6bc70bc1e31c86d9e4161d1f8db136c2d31954c9f2e4b3f5281b67154bcc
|
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
@@ -1,2 +1,17 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 0.1.2 / 2024-01-28
|
4
|
+
|
5
|
+
* Added `clap` (hands), `confounded`, `eggplant`, `grimace`, `halo`, `loudly_crying`,
|
6
|
+
(musical) `notes`, `please` (aka prayer, thank you), `rolling` (eyes), `sax`,
|
7
|
+
`sunglasses`, `think`, `unamused`, `vulcan`, `wink`, `worried` and `zipper` emojis.
|
8
|
+
|
9
|
+
|
10
|
+
## 0.1.1 / 2024-01-23
|
11
|
+
|
12
|
+
* Added the `class`, `div` and `style` optional parameters.
|
13
|
+
|
14
|
+
|
1
15
|
## 0.1.0
|
2
|
-
|
16
|
+
|
17
|
+
* Initial release.
|
data/README.md
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
`jekyll_emoji_tag`
|
2
|
-
[](https://badge.fury.io/rb/jekyll_emoji_tag)
|
3
|
-
===========
|
1
|
+
# `jekyll_emoji_tag` [](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/Rakefile
CHANGED
File without changes
|
data/jekyll_emoji_tag.gemspec
CHANGED
File without changes
|
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,21 +24,42 @@ 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
|
36
|
+
'clap' => '👏',
|
37
|
+
'confounded' => '😖',
|
38
|
+
'eggplant' => '🍆',
|
39
|
+
'grimace' => '😬',
|
32
40
|
'grin' => '😀',
|
41
|
+
'halo' => '😇',
|
33
42
|
'horns' => '😈',
|
34
43
|
'kiss' => '😙',
|
44
|
+
'loudly_cry' => '😭',
|
45
|
+
'notes' => '🎶',
|
35
46
|
'open' => '😃',
|
47
|
+
'please' => '🙏',
|
36
48
|
'poop' => '💩',
|
49
|
+
'rolling' => '🙄',
|
37
50
|
'sad' => '😢',
|
51
|
+
'sax' => '🎷',
|
38
52
|
'scream' => '😱',
|
39
53
|
'smiley' => '😁', # default emoji
|
40
54
|
'smirk' => '😏',
|
55
|
+
'sunglasses' => '😎',
|
56
|
+
'think' => '🤔',
|
41
57
|
'two_hearts' => '💕',
|
58
|
+
'wink' => '😉',
|
59
|
+
'worried' => '😟',
|
60
|
+
'unamused' => '😒',
|
61
|
+
'vulcan' => '🖖',
|
62
|
+
'zipper' => '🤐',
|
42
63
|
}.sort_by { |k, _v| [k] }.to_h
|
43
64
|
|
44
65
|
# @param tag_name [String] is the name of the tag, which we already know.
|
@@ -46,12 +67,15 @@ module JekyllEmojiTag
|
|
46
67
|
# @param tokens [Liquid::ParseContext] tokenized command line
|
47
68
|
# @return [void]
|
48
69
|
def render_impl
|
70
|
+
@klass = @helper.parameter_specified? 'class'
|
71
|
+
@tag = @helper.parameter_specified?('div') ? 'div' : 'span'
|
72
|
+
@style = @helper.parameter_specified? 'style'
|
49
73
|
@emoji_name = @helper.parameter_specified?('name') || 'smiley' # Ignored if `list` is specified
|
50
74
|
@emoji_align = @helper.parameter_specified?('align') || 'inline' # Allowable values are: inline, right or left
|
51
75
|
@emoji_size = @helper.parameter_specified?('size') || '3em'
|
52
|
-
@emoji_and_name = @helper.parameter_specified?
|
53
|
-
@list = @helper.parameter_specified?
|
54
|
-
@emoji_hex_code =
|
76
|
+
@emoji_and_name = @helper.parameter_specified? 'emoji_and_name'
|
77
|
+
@list = @helper.parameter_specified? 'list'
|
78
|
+
@emoji_hex_code = Emoji.emojis[@emoji_name] if @emoji_name || Emoji.emojis['boom']
|
55
79
|
|
56
80
|
# variables defined in pages are stored as hash values in liquid_context
|
57
81
|
# _assigned_page_variable = @liquid_context['assigned_page_variable']
|
@@ -64,7 +88,7 @@ module JekyllEmojiTag
|
|
64
88
|
mode="#{@mode}"
|
65
89
|
page attributes:
|
66
90
|
#{@page.sort
|
67
|
-
.
|
91
|
+
.except(*REJECTED_ATTRIBUTES)
|
68
92
|
.map { |k, v| "#{k}=#{v}" }
|
69
93
|
.join("\n ")}
|
70
94
|
HEREDOC
|
@@ -81,25 +105,26 @@ module JekyllEmojiTag
|
|
81
105
|
private
|
82
106
|
|
83
107
|
def assemble_emoji(emoji_name, emoji_hex_code)
|
84
|
-
case @emoji_align
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
108
|
+
align = case @emoji_align
|
109
|
+
when 'inline'
|
110
|
+
''
|
111
|
+
when 'right'
|
112
|
+
' float: right; margin-left: 5px;'
|
113
|
+
when 'left'
|
114
|
+
' float: left; margin-right: 5px;'
|
115
|
+
else
|
116
|
+
@logger.error { "Invalid emoji alignment #{@emoji_align}" }
|
117
|
+
''
|
118
|
+
end
|
95
119
|
|
96
120
|
name = " <code>#{emoji_name}</code>" if @emoji_and_name
|
121
|
+
klass = @klass ? " class='#{@klass}'" : ''
|
97
122
|
|
98
|
-
"
|
123
|
+
"<#{@tag}#{klass} style='font-size: #{@emoji_size};#{align};#{@style}'>#{emoji_hex_code}</#{@tag}>#{name}"
|
99
124
|
end
|
100
125
|
|
101
126
|
def list
|
102
|
-
items =
|
127
|
+
items = Emoji.emojis.map do |ename, hex_code|
|
103
128
|
" <li>#{assemble_emoji(ename, hex_code)}</li>"
|
104
129
|
end
|
105
130
|
<<~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.2
|
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-30 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:
|
@@ -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
|