jekyll-languages 0.0.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 +17 -0
- data/.rspec +1 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +6 -0
- data/jekyll-languages.gemspec +27 -0
- data/lib/jekyll/languages.rb +36 -0
- data/lib/jekyll/languages/version.rb +5 -0
- data/spec/languages_spec.rb +66 -0
- data/spec/spec_helper.rb +2 -0
- metadata +142 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 8b50f2bbb31f68fdb5cf5cb5bf4e6f2c05aeb69a
|
|
4
|
+
data.tar.gz: 26069d9f0fa6e13a87e0a9d1ae0933155945fed2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7e1bf83159ec4b456011b3a5ad6dcf4cb4cc7693daf4b35c1a2912a159f6d21578c9ee194d1f1f5e03b85a49cef6b8ffabbd28009cdb0ee13ce9b45710a2d464
|
|
7
|
+
data.tar.gz: fa9534c0ede164daac62d8452f15be1f8b94a31b8a797d0fa3c176b168c3084118d043b427d43a93cd454d726abba38ce4a322082a096cd7586430ec7b58c332
|
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-f d
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Jan Lindblom
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Jekyll::Languages
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/janlindblom/jekyll-languages)
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Jekyll plugin system
|
|
8
|
+
|
|
9
|
+
In your `_config.yml` file, add a new array with the key gems and the values of the gem names of the plugins you’d like to use. In this case:
|
|
10
|
+
|
|
11
|
+
gems: [jekyll-languages]
|
|
12
|
+
|
|
13
|
+
### Via Bundler
|
|
14
|
+
|
|
15
|
+
Add this line to your application's `Gemfile`:
|
|
16
|
+
|
|
17
|
+
gem 'jekyll-languages'
|
|
18
|
+
|
|
19
|
+
To use it, add the following to _plugins/ext.rb:
|
|
20
|
+
|
|
21
|
+
require "jekyll/languages"
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<p><strong>Categories:</strong> {{ page.categories | sentencize_array }}</p>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Configuration
|
|
30
|
+
|
|
31
|
+
This plugin allows for some configuration options, use them in your `_config.yml` to make it actually do something useful:
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
jekyll_languages:
|
|
35
|
+
array_connector: "och"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Contributing
|
|
39
|
+
|
|
40
|
+
1. Fork it ( http://github.com/janlindblom/jekyll-languages/fork )
|
|
41
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
42
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
44
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'jekyll/languages/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "jekyll-languages"
|
|
8
|
+
spec.version = Jekyll::Languages::VERSION
|
|
9
|
+
spec.authors = ["Jan Lindblom "]
|
|
10
|
+
spec.email = ["jan@janlindblom.se"]
|
|
11
|
+
spec.summary = %q{Gives you some language filters.}
|
|
12
|
+
spec.description = %q{Gives you some language filters.}
|
|
13
|
+
spec.homepage = ""
|
|
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.add_development_dependency "bundler", "~> 1.5"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
spec.add_development_dependency "rspec"
|
|
24
|
+
spec.add_development_dependency "simplecov"
|
|
25
|
+
spec.add_development_dependency "liquid"
|
|
26
|
+
spec.add_development_dependency "jekyll"
|
|
27
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "jekyll/languages/version"
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module Languages
|
|
5
|
+
|
|
6
|
+
def sentencize_array(array)
|
|
7
|
+
connector = strings[:connector]
|
|
8
|
+
|
|
9
|
+
case array.length
|
|
10
|
+
when 0
|
|
11
|
+
""
|
|
12
|
+
when 1
|
|
13
|
+
array[0].to_s
|
|
14
|
+
when 2
|
|
15
|
+
"#{array[0]} #{connector} #{array[1]}"
|
|
16
|
+
else
|
|
17
|
+
"#{array[0...-1].join(', ')} #{connector} #{array[-1]}"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def config
|
|
24
|
+
@config ||= Jekyll.configuration({}).fetch('jekyll_languages', {})
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def strings
|
|
28
|
+
{
|
|
29
|
+
:connector => config['array_connector'] || 'and'
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Liquid::Template.register_filter(Jekyll::Languages) if defined?(Liquid)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'liquid'
|
|
3
|
+
require 'jekyll/languages'
|
|
4
|
+
require 'jekyll'
|
|
5
|
+
|
|
6
|
+
describe Jekyll::Languages do
|
|
7
|
+
before :all do
|
|
8
|
+
File.delete("_config.yml") if File.exist?("_config.yml")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "can sentencize an array into a readable sentence form" do
|
|
12
|
+
string = Liquid::Template.parse("{{ array | sentencize_array }}").render('array' => ['apples', 'bananas', 'cucumbers'])
|
|
13
|
+
string.should match /(.*), (.*) and (.*)/
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "can sentencize an array with only one element" do
|
|
17
|
+
string = Liquid::Template.parse("{{ array | sentencize_array }}").render('array' => ['apples'])
|
|
18
|
+
string.should eq "apples"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "can sentencize an array with only two elements" do
|
|
22
|
+
string = Liquid::Template.parse("{{ array | sentencize_array }}").render('array' => ['apples', 'cucumbers'])
|
|
23
|
+
string.should match /(.*) and (.*)/
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "can sentencize an empty array" do
|
|
27
|
+
string = Liquid::Template.parse("{{ array | sentencize_array }}").render('array' => [])
|
|
28
|
+
string.should eq ""
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe "will pick up configuration from the Jekyll config file" do
|
|
32
|
+
before :all do
|
|
33
|
+
config = "jekyll_languages:\n array_connector: \"och\"\n"
|
|
34
|
+
begin
|
|
35
|
+
file = File.open("_config.yml", "w")
|
|
36
|
+
file.write(config)
|
|
37
|
+
ensure
|
|
38
|
+
file.close unless file.nil?
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
after :all do
|
|
43
|
+
File.delete("_config.yml") if File.exist?("_config.yml")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "and can sentencize an array into a readable sentence form" do
|
|
47
|
+
string = Liquid::Template.parse("{{ array | sentencize_array }}").render('array' => ['apples', 'bananas', 'cucumbers'])
|
|
48
|
+
string.should match /(.*), (.*) och (.*)/
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "and can sentencize an array with only one element" do
|
|
52
|
+
string = Liquid::Template.parse("{{ array | sentencize_array }}").render('array' => ['apples'])
|
|
53
|
+
string.should eq "apples"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "and can sentencize an array with only two elements" do
|
|
57
|
+
string = Liquid::Template.parse("{{ array | sentencize_array }}").render('array' => ['apples', 'cucumbers'])
|
|
58
|
+
string.should match /(.*) och (.*)/
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "and can sentencize an empty array" do
|
|
62
|
+
string = Liquid::Template.parse("{{ array | sentencize_array }}").render('array' => [])
|
|
63
|
+
string.should eq ""
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jekyll-languages
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- 'Jan Lindblom '
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.5'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.5'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
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: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: simplecov
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: liquid
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - '>='
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - '>='
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: jekyll
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - '>='
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - '>='
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
description: Gives you some language filters.
|
|
98
|
+
email:
|
|
99
|
+
- jan@janlindblom.se
|
|
100
|
+
executables: []
|
|
101
|
+
extensions: []
|
|
102
|
+
extra_rdoc_files: []
|
|
103
|
+
files:
|
|
104
|
+
- .gitignore
|
|
105
|
+
- .rspec
|
|
106
|
+
- .travis.yml
|
|
107
|
+
- Gemfile
|
|
108
|
+
- LICENSE.txt
|
|
109
|
+
- README.md
|
|
110
|
+
- Rakefile
|
|
111
|
+
- jekyll-languages.gemspec
|
|
112
|
+
- lib/jekyll/languages.rb
|
|
113
|
+
- lib/jekyll/languages/version.rb
|
|
114
|
+
- spec/languages_spec.rb
|
|
115
|
+
- spec/spec_helper.rb
|
|
116
|
+
homepage: ''
|
|
117
|
+
licenses:
|
|
118
|
+
- MIT
|
|
119
|
+
metadata: {}
|
|
120
|
+
post_install_message:
|
|
121
|
+
rdoc_options: []
|
|
122
|
+
require_paths:
|
|
123
|
+
- lib
|
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
|
+
requirements:
|
|
126
|
+
- - '>='
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: '0'
|
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - '>='
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '0'
|
|
134
|
+
requirements: []
|
|
135
|
+
rubyforge_project:
|
|
136
|
+
rubygems_version: 2.0.14
|
|
137
|
+
signing_key:
|
|
138
|
+
specification_version: 4
|
|
139
|
+
summary: Gives you some language filters.
|
|
140
|
+
test_files:
|
|
141
|
+
- spec/languages_spec.rb
|
|
142
|
+
- spec/spec_helper.rb
|