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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fcbd2d4d07f48b73b88309e826023eca537c472e7d2b9924a02d72e41fb9aa3
4
- data.tar.gz: fb1b823f3f23fdbefe64ada67e22bfb0d75cfe23be4b40835e67f3c5e9a368f3
3
+ metadata.gz: 64d5cea22eb35ac231d709583651d72dba062107523891bad70fe6b75c56620a
4
+ data.tar.gz: 751a2a539a60b3bc3343f9ae8a6c54be1d75364ea288a3353ada74e29fc2bcff
5
5
  SHA512:
6
- metadata.gz: 2054b06c3c37341f6609788c7611cb1c45fd87f57c625a722190660134a14529e949ebef091a3f5680e66913758b66a84c897da7130790b520953d2a157b984b
7
- data.tar.gz: 0c29401d2878048954c58117c63ac041d3b356e50c40b46aaa7e4a248673ef5681f4add7b36cf128d6250f39bfe00285d48c5af0e0a3dfea18e546d8f6af51a7
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
- - exe/**/*
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
- * Initial release.
16
+
17
+ * Initial release.
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
- - `align` - `left`, `right` or `inline` (default is inline)
34
- - `emoji_and_name` - causes the name of the emoji to be output along with the image (default is false)
35
- - `list` - output all emojis (default is false)
36
- - `name` - name of emoji (defaults to smiley)
37
- - `size` - height of emoji (defaults to 3em)
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 on #<struct Creategem::Repository::Host domain="github.com", camel_case="GitHub", id=:github> at https://github.com/mslinn/jekyll_emoji_tag.
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
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.rb'
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
- @@emojis = {
33
+ Emoji.emojis = {
30
34
  'angry' => '&#x1F620;',
31
35
  'boom' => '&#x1F4A5;', # used when requested emoji is not recognized
36
+ 'clap' => '&#x1F44F;',
37
+ 'confounded' => '&#x1F616;',
38
+ 'eggplant' => '&#x1F346;',
39
+ 'grimace' => '&#x1F62C;',
32
40
  'grin' => '&#128512;',
41
+ 'halo' => '&#x1F607;',
33
42
  'horns' => '&#128520;',
34
43
  'kiss' => '&#x1F619;',
44
+ 'loudly_cry' => '&#x1F62D;',
45
+ 'notes' => '&#x1F3B6;',
35
46
  'open' => '&#128515;',
47
+ 'please' => '&#x1F64F;',
36
48
  'poop' => '&#x1F4A9;',
49
+ 'rolling' => '&#x1F644;',
37
50
  'sad' => '&#128546;',
51
+ 'sax' => '&#x1F3B7;',
38
52
  'scream' => '&#x1F631;',
39
53
  'smiley' => '&#x1F601;', # default emoji
40
54
  'smirk' => '&#x1F60F;',
55
+ 'sunglasses' => '&#x1F60E;',
56
+ 'think' => '&#x1F914;',
41
57
  'two_hearts' => '&#x1F495;',
58
+ 'wink' => '&#x1F609;',
59
+ 'worried' => '&#x1f61f;',
60
+ 'unamused' => '&#x1F612;',
61
+ 'vulcan' => '&#x1F596;',
62
+ 'zipper' => '&#x1F910;',
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?('emoji_and_name')
53
- @list = @helper.parameter_specified?('list')
54
- @emoji_hex_code = @@emojis[@emoji_name] if @emoji_name || @@emojis['boom']
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
- .reject { |k, _| REJECTED_ATTRIBUTES.include? k }
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
- when 'inline'
86
- align = ''
87
- when 'right'
88
- align = ' float: right; margin-left: 5px;'
89
- when 'left'
90
- align = ' float: left; margin-right: 5px;'
91
- else
92
- @logger.error { "Invalid emoji alignment #{@emoji_align}" }
93
- align = ''
94
- end
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
- "<span style='font-size: #{@emoji_size};#{align}'>#{emoji_hex_code}</span>#{name}"
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 = @@emojis.map do |ename, hex_code|
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
@@ -1,3 +1,3 @@
1
1
  module JekyllEmojiTag
2
- VERSION = '0.1.0'.freeze unless defined? VERSION
2
+ VERSION = '0.1.2'.freeze unless defined? VERSION
3
3
  end
@@ -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/<%= @gem_name %>'
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.safe_load(File.read('../demo/_config.yml'))
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.0
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: 2023-07-07 00:00:00.000000000 Z
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/jekyll_emoji_tag_spec.rb
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