jekyll-exif-data 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +9 -0
- data/README.md +49 -0
- data/lib/jekyll-exif-data.rb +7 -0
- data/lib/jekyll/exif-data.rb +24 -0
- data/lib/jekyll/exif-data/version.rb +5 -0
- data/spec/jekyll-exif-data_spec.rb +25 -0
- data/spec/spec_helper.rb +15 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a2421850c2a1d15a7c323d7bcb5af2aeaf5fee080da1a70745a353e114f09d48
|
4
|
+
data.tar.gz: 698037256bfd592ea6540f1d419f34c27e01e841f16058251791768437612c0a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8785ba40dcf425bad0e9e7fed1e0738f5a1c8758a4f30261cd5ef1229b831bb219e6c0c58152615eb4976f7d3e81951d26c70096d6fde935af985394a2876309
|
7
|
+
data.tar.gz: f1ed9c24107dd74f798e2ab9b4ca2c6bf12420b050ab468148e9a9122884dfcb49197995662fd1c0fd615e5790a6541c661f81156e98cbda44137abe9d4c15d6
|
data/LICENSE.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Niklas Eicker.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Jekyll-exif-data
|
2
|
+
|
3
|
+
This Jekyll plugin adds the Liquid filter `exif`, supplying exif data to Jekyll websites. To read the data [exifr](https://github.com/remvee/exifr) is needed as a dependency.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add the plugin to your site's Gemfile:
|
8
|
+
```
|
9
|
+
group :jekyll_plugins do
|
10
|
+
# your other jekyll plugins...
|
11
|
+
gem 'jekyll-exif-data', '~> 0.0'
|
12
|
+
end
|
13
|
+
```
|
14
|
+
Then run ```$ bundler install```. The dependency of the plugin is also automatically installed by this command.
|
15
|
+
|
16
|
+
<br><br>
|
17
|
+
|
18
|
+
Or install it:
|
19
|
+
```
|
20
|
+
$ gem install jekyll-exif-data
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
The `exif` filter takes the exif tag as the argument and acts on the path to the image (no leading slash).
|
26
|
+
|
27
|
+
Examples:
|
28
|
+
```
|
29
|
+
{% assign image_path = "assets/my_image.jpg" %}
|
30
|
+
{{ image_path | exif: 'model'}}
|
31
|
+
{{ "assets/images/example.jpg" | exif: 'model'}}
|
32
|
+
```
|
33
|
+
|
34
|
+
For more examples of possible exif tags see [exifr](https://github.com/remvee/exifr). The argument taken by the `exif` filter is the name of the method in exifr (for deeper methods join them with a dot e.g. `gps.latitude` or `f_number.to_f`).
|
35
|
+
|
36
|
+
You can use the arguments `exif?` and `gps?` to figure out whether there is any exif/gps data for your image:
|
37
|
+
```
|
38
|
+
{% capture has_exif %}{{ image-path-no-leading-slash | exif: "exif?" }}{% endcapture %}
|
39
|
+
{% capture has_gps %}{{ image-path-no-leading-slash | exif: "gps?" }}{% endcapture %}
|
40
|
+
{% if has_exif %}
|
41
|
+
Taken
|
42
|
+
{% if has_gps=="true" %}
|
43
|
+
<a href="https://www.openstreetmap.org/?mlat={{ image-path-no-leading-slash | exif: 'gps.latitude' }}&mlon={{ image-path-no-leading-slash | exif: 'gps.longitude' }}&zoom=8&layers=M" target="_blank">here </a>
|
44
|
+
{% endif %}
|
45
|
+
with a {{ image-path-no-leading-slash | exif: 'model' }}.
|
46
|
+
{% endif %}
|
47
|
+
```
|
48
|
+
|
49
|
+
If the exif tag exists, but there is no value saved for it "nil" is returned.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module ExifData
|
3
|
+
require 'exifr'
|
4
|
+
require 'exifr/jpeg'
|
5
|
+
module ExifDataFilter
|
6
|
+
|
7
|
+
# Read exif using exifr
|
8
|
+
def exif(input, exiftag)
|
9
|
+
exif = EXIFR::JPEG::new(input)
|
10
|
+
if(exiftag == "gps?")
|
11
|
+
return (exif.send('gps') != nil)
|
12
|
+
end
|
13
|
+
answer = exiftag.split('.').inject(exif){|exif,tag| exif.send(tag)}
|
14
|
+
if(answer == nil)
|
15
|
+
return "nil"
|
16
|
+
else
|
17
|
+
return answer
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Liquid::Template.register_filter(Jekyll::ExifData::ExifDataFilter)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe(Jekyll::EmailProtect::EmailProtectionFilter) do
|
4
|
+
let(:output) do
|
5
|
+
render_liquid(content, {'email' => email})
|
6
|
+
end
|
7
|
+
|
8
|
+
context "simple example address" do
|
9
|
+
let(:email) { "example@example.com" }
|
10
|
+
let(:content) { "{{ '#{email}' | encode_email }}" }
|
11
|
+
|
12
|
+
it "produces the correct percent-encoded email" do
|
13
|
+
expect(output).to eq("%65%78%61%6D%70%6C%65@%65%78%61%6D%70%6C%65.%63%6F%6D")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "example address with plus and dash" do
|
18
|
+
let(:email) { "example-person+spam@example.com" }
|
19
|
+
let(:content) { "{{ '#{email}' | encode_email }}" }
|
20
|
+
|
21
|
+
it "produces the correct percent-encoded email" do
|
22
|
+
expect(output).to eq("%65%78%61%6D%70%6C%65-%70%65%72%73%6F%6E+%73%70%61%6D@%65%78%61%6D%70%6C%65.%63%6F%6D")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
TEST_DIR = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require 'liquid'
|
4
|
+
require File.expand_path("../lib/jekyll-email-protect.rb", TEST_DIR)
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.run_all_when_everything_filtered = true
|
8
|
+
config.filter_run :focus
|
9
|
+
config.order = 'random'
|
10
|
+
|
11
|
+
def render_liquid(content, variables)
|
12
|
+
template = Liquid::Template.parse(content)
|
13
|
+
template.render(variables)
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-exif-data
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Niklas Eicker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-04-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: liquid
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: exifr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
description: jekyll-exif-data adds the Liquid filter exif which uses exirf to read
|
70
|
+
the exif data of an image
|
71
|
+
email:
|
72
|
+
- hello@nikl.me
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- LICENSE.md
|
78
|
+
- README.md
|
79
|
+
- lib/jekyll-exif-data.rb
|
80
|
+
- lib/jekyll/exif-data.rb
|
81
|
+
- lib/jekyll/exif-data/version.rb
|
82
|
+
- spec/jekyll-exif-data_spec.rb
|
83
|
+
- spec/spec_helper.rb
|
84
|
+
homepage: https://github.com/NiklasEi/jekyll-exif-data
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata:
|
88
|
+
bug_tracker_uri: https://github.com/NiklasEi/jekyll-exif-data/issues
|
89
|
+
documentation_uri: https://github.com/NiklasEi/jekyll-exif-data
|
90
|
+
homepage_uri: https://github.com/NiklasEi/jekyll-exif-data
|
91
|
+
source_code_uri: https://github.com/NiklasEi/jekyll-exif-data
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 1.9.3
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubygems_version: 3.0.3
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: jekyll-exif-data makes exif data accessible for jekyll sites
|
111
|
+
test_files:
|
112
|
+
- spec/jekyll-exif-data_spec.rb
|
113
|
+
- spec/spec_helper.rb
|