jekyll-smiley 0.1.1
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 +7 -0
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +32 -0
- data/jekyll-smiley.gemspec +21 -0
- data/lib/jekyll-smiley.rb +47 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 31a004e155ee0e598114cefce7cecac9e3c611ce
|
4
|
+
data.tar.gz: 0b9727931e947a7f638b3cfc0422c8222a35b6d0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7d6427e4e08461c00d53482cfd6f488706474832472892086823925fccd0675ef162623505bd47650c4bb784047ba6bd1449af0dfc41a5354d42ce2493806710
|
7
|
+
data.tar.gz: ad72ad16c7b82b10d1248b8d64951d050f177524ea64d6b6c9354d348c24d0c67441ebe40ba43af6809f1da3142530da312ab449244788ac9aa47cf6c10b3c6b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 zhangshiyu
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Jekyll Smileys Generator
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your Jekyll site's `Gemfile`:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem "jekyll-smiley"
|
9
|
+
```
|
10
|
+
|
11
|
+
Add `jekyll-smiley` to your Jekyll site's `_config.yml`:
|
12
|
+
|
13
|
+
```yaml
|
14
|
+
plugins:
|
15
|
+
- jekyll-books
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install jekyll-smiley
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/erlzhang/jekyll-smiley. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
29
|
+
|
30
|
+
## License
|
31
|
+
|
32
|
+
The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "jekyll-smiley"
|
5
|
+
spec.version = "0.1.1"
|
6
|
+
spec.authors = ["Sharon Zhang"]
|
7
|
+
spec.email = ["zhangshiyu1992@hotmail.com"]
|
8
|
+
|
9
|
+
spec.summary = "Jekyll smileys generator on comments."
|
10
|
+
spec.homepage = "https://github.com/erlzhang/jekyll-smiley"
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = `git ls-files -z`.split("\x0")
|
14
|
+
|
15
|
+
spec.required_ruby_version = '>= 2.3'
|
16
|
+
|
17
|
+
spec.add_runtime_dependency "jekyll", "~> 3.5"
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
20
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
21
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class SmileyGenerator < Generator
|
3
|
+
def generate(site)
|
4
|
+
smiley_config = site.config["smiley"]
|
5
|
+
return if not smiley_config or not smiley_config["enabled"]
|
6
|
+
|
7
|
+
dir = smiley_config["dir"] || "assets/smileys"
|
8
|
+
|
9
|
+
smileys = {}
|
10
|
+
|
11
|
+
begin
|
12
|
+
Dir.foreach(dir) do |filename|
|
13
|
+
if filename.chars.first != "."
|
14
|
+
basename = File.basename(filename, '.gif')
|
15
|
+
name = basename.split("_").last
|
16
|
+
smiley = {
|
17
|
+
"name" => name,
|
18
|
+
"img" => "/#{dir}/#{filename}",
|
19
|
+
"slug" => ":#{name}:"
|
20
|
+
}
|
21
|
+
smileys[name] = smiley
|
22
|
+
end
|
23
|
+
end
|
24
|
+
rescue Exception => e
|
25
|
+
puts e
|
26
|
+
end
|
27
|
+
site.config["smileys"] = smileys
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module SmileyFilter
|
32
|
+
def smiley(message)
|
33
|
+
site = @context.registers[:site].config
|
34
|
+
|
35
|
+
smileys = site["smileys"]
|
36
|
+
message.gsub!(/:([a-z]+):/) do |match|
|
37
|
+
smiley = smileys[$1]
|
38
|
+
if smiley
|
39
|
+
""
|
40
|
+
end
|
41
|
+
end
|
42
|
+
message
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Liquid::Template.register_filter(Jekyll::SmileyFilter)
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-smiley
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sharon Zhang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '12.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '12.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- zhangshiyu1992@hotmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- jekyll-smiley.gemspec
|
67
|
+
- lib/jekyll-smiley.rb
|
68
|
+
homepage: https://github.com/erlzhang/jekyll-smiley
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '2.3'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.5.2.1
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: Jekyll smileys generator on comments.
|
92
|
+
test_files: []
|