middleman-gemoji 0.0.5
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 +14 -0
- data/.travis.yml +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +25 -0
- data/README.md +54 -0
- data/Rakefile +2 -0
- data/features/command.feature +27 -0
- data/features/emoji_build.feature +96 -0
- data/features/emoji_server.feature +18 -0
- data/features/haml.feature +30 -0
- data/features/markdown.feature +31 -0
- data/features/slim.feature +24 -0
- data/features/support/env.rb +4 -0
- data/fixtures/command-app/config.rb +1 -0
- data/fixtures/command-app/index.html.erb +0 -0
- data/fixtures/command-app/source/images/.gitkeep +0 -0
- data/fixtures/gemoji-app/config.rb +2 -0
- data/fixtures/gemoji-app/source/images/emoji/unicode/.gitkeep +0 -0
- data/fixtures/gemoji-app/source/img/emoji/unicode/.gitkeep +0 -0
- data/fixtures/gemoji-app/source/index.html.erb +2 -0
- data/fixtures/gemoji-app/source/no-emoji.erb +1 -0
- data/fixtures/gemoji-empty-app/config.rb +2 -0
- data/fixtures/gemoji-empty-app/source/images/.gitkeep +0 -0
- data/fixtures/gemoji-empty-app/source/img/.gitkeep +0 -0
- data/fixtures/gemoji-empty-app/source/index.html.erb +2 -0
- data/fixtures/haml-app/config.rb +2 -0
- data/fixtures/haml-app/source/images/emoji/unicode/.gitkeep +0 -0
- data/fixtures/haml-app/source/index.html.haml +2 -0
- data/fixtures/haml-app/source/no-emoji.html.haml +1 -0
- data/fixtures/markdown-app/config.rb +2 -0
- data/fixtures/markdown-app/source/images/emoji/unicode/.gitkeep +0 -0
- data/fixtures/markdown-app/source/index.html.md +2 -0
- data/fixtures/markdown-app/source/no-emoji.html.md +1 -0
- data/fixtures/slim-app/config.rb +2 -0
- data/fixtures/slim-app/source/images/emoji/unicode/.gitkeep +0 -0
- data/fixtures/slim-app/source/index.html.slim +2 -0
- data/fixtures/slim-app/source/no-emoji.html.slim +1 -0
- data/lib/middleman-gemoji.rb +8 -0
- data/lib/middleman-gemoji/command.rb +41 -0
- data/lib/middleman-gemoji/extension.rb +67 -0
- data/lib/middleman-gemoji/version.rb +5 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-gemoji.gemspec +31 -0
- metadata +192 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4ae0c26df288e2834a62271d78d51b7d6ce9a8c9
|
4
|
+
data.tar.gz: 6f48e19c06ec735c31765bc22d278666988984dc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 310cd001b7eb95d41e2303ea6432f55e153bba8f36f9c949fd08f890b1bd171b62c8512a48f9dea014530ad90f458c6e800adf33d826f0ee59766e87f6110a58
|
7
|
+
data.tar.gz: 8246d345c58d3c0f5ea224f2ce64705c350357818a9d16700fed50fc48a84d83fbfc1fc3d7272bc41192a6abfa81825c1b8e8c56d00c60f60f859ae4c8a8d717
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
language: ruby
|
2
|
+
script: bundle exec cucumber
|
3
|
+
rvm:
|
4
|
+
- ruby-head
|
5
|
+
- jruby-head
|
6
|
+
- jruby-19mode
|
7
|
+
- 2.2
|
8
|
+
- 2.1
|
9
|
+
- 2.0
|
10
|
+
- 1.9.3
|
11
|
+
os:
|
12
|
+
- linux
|
13
|
+
- osx
|
14
|
+
matrix:
|
15
|
+
fast_finish: true
|
16
|
+
allow_failures:
|
17
|
+
- rvm: ruby-head
|
18
|
+
- rvm: jruby-19mode
|
19
|
+
- rvm: jruby-head
|
20
|
+
env: TEST=true
|
21
|
+
notifications:
|
22
|
+
slack:
|
23
|
+
secure: ZoA6qJJ4JHOtvWAxOhiGDuXEAV0qFhdMgIT7YHEqjzbQaLWNvoLJ0xcdMV47d3UsvrRie3jmhSZ/F1mUf//WGu2HgNMk5VWGHnBKmtXuCk7P1wg0TaeChnKKkV/ls0pRLk+2VS4bYaUYI/8KfJP20eCfvsvkgoXFVusx4CyfmE0=
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Emoji icon Licenses: https://github.com/github/gemoji/blob/master/LICENSE
|
2
|
+
|
3
|
+
This Plugin License:
|
4
|
+
Copyright (c) 2015 Yuya Terajima
|
5
|
+
|
6
|
+
MIT License
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
a copy of this software and associated documentation files (the
|
10
|
+
"Software"), to deal in the Software without restriction, including
|
11
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
+
permit persons to whom the Software is furnished to do so, subject to
|
14
|
+
the following conditions:
|
15
|
+
|
16
|
+
The above copyright notice and this permission notice shall be
|
17
|
+
included in all copies or substantial portions of the Software.
|
18
|
+
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
23
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
24
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
25
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# middleman-gemoji
|
2
|
+
|
3
|
+
middleman-gemoji is Github-flavored emoji plugin for Middleman.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'middleman-gemoji'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
```sh
|
15
|
+
$ bundle
|
16
|
+
```
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
```sh
|
21
|
+
$ gem install middleman-gemoji
|
22
|
+
```
|
23
|
+
|
24
|
+
You can download emoji files from [gemoji](https://rubygems.org/gems/gemoji) with bundler:
|
25
|
+
|
26
|
+
```sh
|
27
|
+
$ bundle exec middleman gemoji --path images/emoji
|
28
|
+
```
|
29
|
+
|
30
|
+
You can choose destination path with `--path` or `-p` option (default is 'images/emoji').
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
In config.rb:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
activate :gemoji
|
38
|
+
```
|
39
|
+
|
40
|
+
Or with options:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
activate :gemoji, :size => 20, :style => "vertical-align: middlele", :emoji_dir => "images/emoji"
|
44
|
+
```
|
45
|
+
|
46
|
+
Then you can use emoji in your template.
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
1. Fork it ( https://github.com/yterajima/middleman-gemoji/fork )
|
51
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
52
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
54
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: gemoji command
|
2
|
+
|
3
|
+
Scenario: Copy emoji files to imaged_dir
|
4
|
+
Given a fixture app "command-app"
|
5
|
+
When I run `middleman gemoji`
|
6
|
+
Then the exit status should be 0
|
7
|
+
And I cd to "source/images/emoji"
|
8
|
+
And the following files should exist:
|
9
|
+
| metal.png |
|
10
|
+
| unicode/00a9.png |
|
11
|
+
| unicode/2665.png |
|
12
|
+
| unicode/1f600.png |
|
13
|
+
| unicode/1f363.png |
|
14
|
+
| unicode/1f44d.png |
|
15
|
+
|
16
|
+
Scenario: Copy emoji files with option
|
17
|
+
Given a fixture app "command-app"
|
18
|
+
When I run `middleman gemoji -p img/gemoji`
|
19
|
+
Then the exit status should be 0
|
20
|
+
And I cd to "source/img/gemoji"
|
21
|
+
And the following files should exist:
|
22
|
+
| metal.png |
|
23
|
+
| unicode/00a9.png |
|
24
|
+
| unicode/2665.png |
|
25
|
+
| unicode/1f600.png |
|
26
|
+
| unicode/1f363.png |
|
27
|
+
| unicode/1f44d.png |
|
@@ -0,0 +1,96 @@
|
|
1
|
+
Feature: Emoji convert when build
|
2
|
+
|
3
|
+
Scenario: Load extension
|
4
|
+
Given a fixture app "gemoji-app"
|
5
|
+
When I run `middleman build --verbose`
|
6
|
+
Then the exit status should be 0
|
7
|
+
And the output should contain "Extension: gemoji"
|
8
|
+
And the output should not contain "Unknown Extension: gemoji"
|
9
|
+
|
10
|
+
Scenario: Convert ":+1+" to emoji
|
11
|
+
Given a fixture app "gemoji-app"
|
12
|
+
When I run `middleman build`
|
13
|
+
Then the exit status should be 0
|
14
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
15
|
+
And the file "build/index.html" should contain:
|
16
|
+
"""
|
17
|
+
<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" /></p>
|
18
|
+
"""
|
19
|
+
|
20
|
+
Scenario: Convert content that doesn't have :emoji:
|
21
|
+
Given a fixture app "gemoji-app"
|
22
|
+
When I run `middleman build`
|
23
|
+
Then the exit status should be 0
|
24
|
+
And the file "build/no-emoji.html" should contain "nil"
|
25
|
+
|
26
|
+
Scenario: Convert ":+1+" to emoji with :size option
|
27
|
+
Given a fixture app "gemoji-app"
|
28
|
+
And a file named "config.rb" with:
|
29
|
+
"""
|
30
|
+
activate :gemoji, :size => 20
|
31
|
+
"""
|
32
|
+
When I run `middleman build`
|
33
|
+
Then the exit status should be 0
|
34
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
35
|
+
And the file "build/index.html" should contain:
|
36
|
+
"""
|
37
|
+
<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" width="20" height="20" /></p>
|
38
|
+
|
39
|
+
"""
|
40
|
+
|
41
|
+
Scenario: Convert ":+1+" to emoji with :style option
|
42
|
+
Given a fixture app "gemoji-app"
|
43
|
+
And a file named "config.rb" with:
|
44
|
+
"""
|
45
|
+
activate :gemoji, :style => "vertical-align: middle"
|
46
|
+
"""
|
47
|
+
When I run `middleman build`
|
48
|
+
Then the exit status should be 0
|
49
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
50
|
+
And the file "build/index.html" should contain:
|
51
|
+
"""
|
52
|
+
<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" style="vertical-align: middle" /></p>
|
53
|
+
|
54
|
+
"""
|
55
|
+
|
56
|
+
Scenario: Convert ":+1+" to emoji with :emoji_dir option
|
57
|
+
Given a fixture app "gemoji-app"
|
58
|
+
And a file named "config.rb" with:
|
59
|
+
"""
|
60
|
+
activate :gemoji, :emoji_dir => "img/emoji"
|
61
|
+
"""
|
62
|
+
When I run `middleman build`
|
63
|
+
Then the exit status should be 0
|
64
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
65
|
+
And the file "build/index.html" should contain:
|
66
|
+
"""
|
67
|
+
<p><img class="gemoji" alt="+1" src="/img/emoji/unicode/1f44d.png" /></p>
|
68
|
+
|
69
|
+
"""
|
70
|
+
|
71
|
+
Scenario: Convert ":+1+" to emoji with :emoji_dir option and app.config.http_prefix
|
72
|
+
Given a fixture app "gemoji-app"
|
73
|
+
And a file named "config.rb" with:
|
74
|
+
"""
|
75
|
+
set :http_prefix, "http://localhost:4567"
|
76
|
+
activate :gemoji, :emoji_dir => "img/emoji"
|
77
|
+
"""
|
78
|
+
When I run `middleman build`
|
79
|
+
Then the exit status should be 0
|
80
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
81
|
+
And the file "build/index.html" should contain:
|
82
|
+
"""
|
83
|
+
<p><img class="gemoji" alt="+1" src="http://localhost:4567/img/emoji/unicode/1f44d.png" /></p>
|
84
|
+
|
85
|
+
"""
|
86
|
+
|
87
|
+
Scenario: Convert ":+1+" to emoji
|
88
|
+
Given a fixture app "gemoji-empty-app"
|
89
|
+
When I run `middleman build`
|
90
|
+
Then the exit status should be 0
|
91
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
92
|
+
And the file "build/index.html" should contain:
|
93
|
+
"""
|
94
|
+
<p><img class="gemoji" alt="+1" src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f44d.png" /></p>
|
95
|
+
|
96
|
+
"""
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Emoji convert under `middleman server`
|
2
|
+
|
3
|
+
Scenario: Convert ":+1+" to emoji
|
4
|
+
Given the Server is running at "gemoji-app"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should see:
|
7
|
+
"""
|
8
|
+
<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" /></p>
|
9
|
+
|
10
|
+
"""
|
11
|
+
|
12
|
+
Scenario: Convert content that doesn't have :emoji:
|
13
|
+
Given the Server is running at "gemoji-app"
|
14
|
+
When I go to "/no-emoji.html"
|
15
|
+
Then I should see:
|
16
|
+
"""
|
17
|
+
nil
|
18
|
+
"""
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Emoji convert in Markdown
|
2
|
+
|
3
|
+
Scenario: Convert ":+1+" to emoji
|
4
|
+
Given a fixture app "haml-app"
|
5
|
+
When I run `middleman build`
|
6
|
+
Then the exit status should be 0
|
7
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
8
|
+
And the file "build/index.html" should contain:
|
9
|
+
"""
|
10
|
+
<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" /></p>
|
11
|
+
"""
|
12
|
+
|
13
|
+
Scenario: Convert content that doesn't have :emoji:
|
14
|
+
Given a fixture app "haml-app"
|
15
|
+
When I run `middleman build`
|
16
|
+
Then the exit status should be 0
|
17
|
+
And the file "build/no-emoji.html" should contain:
|
18
|
+
"""
|
19
|
+
<p>nil</p>
|
20
|
+
"""
|
21
|
+
|
22
|
+
Scenario: Convert ":+1+" to emoji under `middleman server`
|
23
|
+
Given the Server is running at "haml-app"
|
24
|
+
When I go to "/index.html"
|
25
|
+
Then I should see '<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" /></p>'
|
26
|
+
|
27
|
+
Scenario: Convert content that doesn't have :emoji: under `middleman server`
|
28
|
+
Given the Server is running at "haml-app"
|
29
|
+
When I go to "/no-emoji.html"
|
30
|
+
Then I should see '<p>nil</p>'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: Emoji convert in Markdown
|
2
|
+
|
3
|
+
Scenario: Convert ":+1+" to emoji
|
4
|
+
Given a fixture app "markdown-app"
|
5
|
+
When I run `middleman build`
|
6
|
+
Then the exit status should be 0
|
7
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
8
|
+
And the file "build/index.html" should contain:
|
9
|
+
"""
|
10
|
+
<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" /></p>
|
11
|
+
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scenario: Convert content that doesn't have :emoji:
|
15
|
+
Given a fixture app "markdown-app"
|
16
|
+
When I run `middleman build`
|
17
|
+
Then the exit status should be 0
|
18
|
+
And the file "build/no-emoji.html" should contain:
|
19
|
+
"""
|
20
|
+
<p>nil</p>
|
21
|
+
"""
|
22
|
+
|
23
|
+
Scenario: Convert ":+1+" to emoji under `middleman server`
|
24
|
+
Given the Server is running at "markdown-app"
|
25
|
+
When I go to "/index.html"
|
26
|
+
Then I should see '<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" /></p>'
|
27
|
+
|
28
|
+
Scenario: Convert content that doesn't have :emoji: under `middleman server`
|
29
|
+
Given the Server is running at "markdown-app"
|
30
|
+
When I go to "/no-emoji.html"
|
31
|
+
Then I should see '<p>nil</p>'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: Emoji convert in Markdown
|
2
|
+
|
3
|
+
Scenario: Convert ":+1+" to emoji
|
4
|
+
Given a fixture app "slim-app"
|
5
|
+
When I run `middleman build`
|
6
|
+
Then the exit status should be 0
|
7
|
+
And the file "build/index.html" should not contain "<p>:+1:</p>"
|
8
|
+
And the file "build/index.html" should contain '<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" /></p>'
|
9
|
+
|
10
|
+
Scenario: Convert content that doesn't have :emoji:
|
11
|
+
Given a fixture app "slim-app"
|
12
|
+
When I run `middleman build`
|
13
|
+
Then the exit status should be 0
|
14
|
+
And the file "build/no-emoji.html" should contain '<p>nil</p>'
|
15
|
+
|
16
|
+
Scenario: Convert ":+1+" to emoji under `middleman server`
|
17
|
+
Given the Server is running at "slim-app"
|
18
|
+
When I go to "/index.html"
|
19
|
+
Then I should see '<p><img class="gemoji" alt="+1" src="/images/emoji/unicode/1f44d.png" /></p>'
|
20
|
+
|
21
|
+
Scenario: Convert content that doesn't have :emoji: under `middleman server`
|
22
|
+
Given the Server is running at "slim-app"
|
23
|
+
When I go to "/no-emoji.html"
|
24
|
+
Then I should see '<p>nil</p>'
|
@@ -0,0 +1 @@
|
|
1
|
+
activate :gemoji
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
nil
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
%p nil
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
nil
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
p nil
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'middleman-core/cli'
|
2
|
+
require 'gemoji'
|
3
|
+
|
4
|
+
module Middleman
|
5
|
+
module Cli
|
6
|
+
# Command Class
|
7
|
+
class Gemoji < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
check_unknown_options!
|
11
|
+
|
12
|
+
namespace :gemoji
|
13
|
+
|
14
|
+
def initialize(*args)
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.source_root
|
19
|
+
ENV['MM_ROOT']
|
20
|
+
end
|
21
|
+
|
22
|
+
# Tell Thor to exit with a nonzero exit code on failure
|
23
|
+
def self.exit_on_failure?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'gemoji', 'Copy emoji to destination directory'
|
28
|
+
method_option 'path',
|
29
|
+
aliases: '-p',
|
30
|
+
desc: 'Destination path of directory',
|
31
|
+
default: 'images/emoji'
|
32
|
+
def gemoji
|
33
|
+
app = ::Middleman::Application
|
34
|
+
target = File.join(app.root, app.config.source, options[:path])
|
35
|
+
source = File.expand_path('../../images/emoji/*', `gem which gemoji`)
|
36
|
+
|
37
|
+
`mkdir -p #{target} && cp -Rp #{source} #{target}`
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'gemoji'
|
2
|
+
|
3
|
+
module Middleman
|
4
|
+
module Gemoji
|
5
|
+
# Emoji Convert Extension of Middleman
|
6
|
+
class Extension < ::Middleman::Extension
|
7
|
+
option :size, nil, 'Size(width/height) of emoji im img tag'
|
8
|
+
option :style, nil, 'Value of style attribute'
|
9
|
+
option :emoji_dir, 'images/emoji', 'Path to Emoji directory from source'
|
10
|
+
|
11
|
+
def initialize(app, options_hash = {}, &block)
|
12
|
+
super
|
13
|
+
@emoji_exist = Dir.exist?(
|
14
|
+
File.join(app.config.source, options[:emoji_dir], 'unicode')
|
15
|
+
)
|
16
|
+
extension = self
|
17
|
+
|
18
|
+
app.before_render do |content|
|
19
|
+
extension.emojify(content)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def emojify(content)
|
24
|
+
@base_path = base_path
|
25
|
+
content.to_str.gsub(/:([\w+-]+):/) do |match|
|
26
|
+
emoji = Emoji.find_by_alias($1)
|
27
|
+
if emoji
|
28
|
+
image = []
|
29
|
+
image << %(alt="#{$1}")
|
30
|
+
image << src(emoji.image_filename)
|
31
|
+
image << size(options[:size]) if options[:size]
|
32
|
+
image << style(options[:style]) if options[:style]
|
33
|
+
|
34
|
+
%(<img class="gemoji" #{image.join(' ')} />)
|
35
|
+
else
|
36
|
+
match
|
37
|
+
end if content.present?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def src(path)
|
42
|
+
%(src="#{File.join(@base_path, path)}")
|
43
|
+
end
|
44
|
+
|
45
|
+
def size(size)
|
46
|
+
%(width="#{size}" height="#{size}")
|
47
|
+
end
|
48
|
+
|
49
|
+
def style(style)
|
50
|
+
%(style="#{style}")
|
51
|
+
end
|
52
|
+
|
53
|
+
def base_path
|
54
|
+
if @emoji_exist
|
55
|
+
prefix = app.config[:http_prefix]
|
56
|
+
if prefix && (/^http/ =~ prefix)
|
57
|
+
File.join(app.config[:http_prefix], options[:emoji_dir])
|
58
|
+
else
|
59
|
+
File.join('/', app.config[:http_prefix], options[:emoji_dir])
|
60
|
+
end
|
61
|
+
else
|
62
|
+
'https://assets-cdn.github.com/images/icons/emoji/'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "middleman-gemoji"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'middleman-gemoji/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "middleman-gemoji"
|
8
|
+
spec.version = Middleman::Gemoji::VERSION
|
9
|
+
spec.authors = ["Yuya Terajima"]
|
10
|
+
spec.email = ["terra@e2esound.com"]
|
11
|
+
spec.summary = %q{Github-flavored emoji plugin for Middleman.}
|
12
|
+
spec.description = %q{Github-flavored emoji plugin for Middleman.}
|
13
|
+
spec.homepage = "https://github.com/yterajima/middleman-gemoji"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 1.9.3'
|
22
|
+
|
23
|
+
spec.add_runtime_dependency "middleman", "~> 3.3"
|
24
|
+
spec.add_runtime_dependency "gemoji", "~> 2.1"
|
25
|
+
|
26
|
+
spec.add_development_dependency "cucumber", "~> 1.3"
|
27
|
+
spec.add_development_dependency "aruba", "~> 0.6"
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
29
|
+
spec.add_development_dependency "rake", "~> 10"
|
30
|
+
spec.add_development_dependency "slim", "~> 3.0"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-gemoji
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuya Terajima
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gemoji
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cucumber
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aruba
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: slim
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
description: Github-flavored emoji plugin for Middleman.
|
112
|
+
email:
|
113
|
+
- terra@e2esound.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE.txt
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- features/command.feature
|
125
|
+
- features/emoji_build.feature
|
126
|
+
- features/emoji_server.feature
|
127
|
+
- features/haml.feature
|
128
|
+
- features/markdown.feature
|
129
|
+
- features/slim.feature
|
130
|
+
- features/support/env.rb
|
131
|
+
- fixtures/command-app/config.rb
|
132
|
+
- fixtures/command-app/index.html.erb
|
133
|
+
- fixtures/command-app/source/images/.gitkeep
|
134
|
+
- fixtures/gemoji-app/config.rb
|
135
|
+
- fixtures/gemoji-app/source/images/emoji/unicode/.gitkeep
|
136
|
+
- fixtures/gemoji-app/source/img/emoji/unicode/.gitkeep
|
137
|
+
- fixtures/gemoji-app/source/index.html.erb
|
138
|
+
- fixtures/gemoji-app/source/no-emoji.erb
|
139
|
+
- fixtures/gemoji-empty-app/config.rb
|
140
|
+
- fixtures/gemoji-empty-app/source/images/.gitkeep
|
141
|
+
- fixtures/gemoji-empty-app/source/img/.gitkeep
|
142
|
+
- fixtures/gemoji-empty-app/source/index.html.erb
|
143
|
+
- fixtures/haml-app/config.rb
|
144
|
+
- fixtures/haml-app/source/images/emoji/unicode/.gitkeep
|
145
|
+
- fixtures/haml-app/source/index.html.haml
|
146
|
+
- fixtures/haml-app/source/no-emoji.html.haml
|
147
|
+
- fixtures/markdown-app/config.rb
|
148
|
+
- fixtures/markdown-app/source/images/emoji/unicode/.gitkeep
|
149
|
+
- fixtures/markdown-app/source/index.html.md
|
150
|
+
- fixtures/markdown-app/source/no-emoji.html.md
|
151
|
+
- fixtures/slim-app/config.rb
|
152
|
+
- fixtures/slim-app/source/images/emoji/unicode/.gitkeep
|
153
|
+
- fixtures/slim-app/source/index.html.slim
|
154
|
+
- fixtures/slim-app/source/no-emoji.html.slim
|
155
|
+
- lib/middleman-gemoji.rb
|
156
|
+
- lib/middleman-gemoji/command.rb
|
157
|
+
- lib/middleman-gemoji/extension.rb
|
158
|
+
- lib/middleman-gemoji/version.rb
|
159
|
+
- lib/middleman_extension.rb
|
160
|
+
- middleman-gemoji.gemspec
|
161
|
+
homepage: https://github.com/yterajima/middleman-gemoji
|
162
|
+
licenses:
|
163
|
+
- MIT
|
164
|
+
metadata: {}
|
165
|
+
post_install_message:
|
166
|
+
rdoc_options: []
|
167
|
+
require_paths:
|
168
|
+
- lib
|
169
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 1.9.3
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
requirements: []
|
180
|
+
rubyforge_project:
|
181
|
+
rubygems_version: 2.4.5
|
182
|
+
signing_key:
|
183
|
+
specification_version: 4
|
184
|
+
summary: Github-flavored emoji plugin for Middleman.
|
185
|
+
test_files:
|
186
|
+
- features/command.feature
|
187
|
+
- features/emoji_build.feature
|
188
|
+
- features/emoji_server.feature
|
189
|
+
- features/haml.feature
|
190
|
+
- features/markdown.feature
|
191
|
+
- features/slim.feature
|
192
|
+
- features/support/env.rb
|