jekyll-multiple-languages-plugin 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +180 -0
- data/README.md +195 -0
- data/Rakefile +1 -0
- data/example/Gemfile +5 -0
- data/example/LICENSE +21 -0
- data/example/README.md +11 -0
- data/example/_config.yml +7 -0
- data/example/_i18n/en.yml +9 -0
- data/example/_i18n/en/_posts/2013-12-09-example-post.md +15 -0
- data/example/_i18n/es.yml +8 -0
- data/example/_i18n/es/_posts/2013-12-09-example-post.md +15 -0
- data/example/_i18n/it.yml +8 -0
- data/example/_i18n/it/_posts/2013-12-09-example-post.md +16 -0
- data/example/_includes/post.html +40 -0
- data/example/_layouts/default.html +58 -0
- data/example/_layouts/post.html +8 -0
- data/example/_plugins/jekyll-multiple-languages-plugin.rb +1 -0
- data/example/css/main.css +285 -0
- data/example/css/responsive.css +92 -0
- data/example/css/syntax.css +60 -0
- data/example/favicon.ico +0 -0
- data/example/images/cover.jpg +0 -0
- data/example/images/logo.png +0 -0
- data/example/images/sidebar-button.png +0 -0
- data/example/index.html +8 -0
- data/example/scripts/responsive.js +14 -0
- data/jekyll-multiple-languages-plugin.gemspec +23 -0
- data/lib/jekyll/multiple/languages/plugin.rb +132 -0
- data/lib/jekyll/multiple/languages/plugin/version.rb +9 -0
- metadata +103 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
@media (max-width:1309px) {
|
2
|
+
#cover-photo {
|
3
|
+
max-width: 95%;
|
4
|
+
}
|
5
|
+
|
6
|
+
.header {
|
7
|
+
padding-top: 3.45em;
|
8
|
+
}
|
9
|
+
|
10
|
+
.posts {
|
11
|
+
font-size: 0.9em;
|
12
|
+
}
|
13
|
+
|
14
|
+
.footer {
|
15
|
+
font-size: 0.85em;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
@media (max-width:1090px) {
|
20
|
+
#logo {
|
21
|
+
max-width: 100px;
|
22
|
+
}
|
23
|
+
|
24
|
+
#title {
|
25
|
+
font-size: 3em;
|
26
|
+
}
|
27
|
+
|
28
|
+
.header {
|
29
|
+
padding-top: 3.85em;
|
30
|
+
}
|
31
|
+
|
32
|
+
.posts {
|
33
|
+
font-size: 0.85em;
|
34
|
+
}
|
35
|
+
|
36
|
+
.sidebar {
|
37
|
+
padding-left: 4em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.content {
|
41
|
+
padding-right: 3em;
|
42
|
+
}
|
43
|
+
|
44
|
+
.footer {
|
45
|
+
font-size: 0.85em;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* iPhone width
|
51
|
+
**/
|
52
|
+
@media (max-width:640px) {
|
53
|
+
#logo {
|
54
|
+
max-width: 75px;
|
55
|
+
}
|
56
|
+
|
57
|
+
#cover-photo-container {
|
58
|
+
text-align: center;
|
59
|
+
}
|
60
|
+
|
61
|
+
#title {
|
62
|
+
font-size: 2.5em;
|
63
|
+
}
|
64
|
+
|
65
|
+
.sidebar {
|
66
|
+
transition: 1s;
|
67
|
+
margin-left: -100%;
|
68
|
+
z-index: 3;
|
69
|
+
width: 35%;
|
70
|
+
padding-left: 1.75em;
|
71
|
+
}
|
72
|
+
|
73
|
+
.content {
|
74
|
+
z-index: 1;
|
75
|
+
padding-right: 2em;
|
76
|
+
}
|
77
|
+
|
78
|
+
#sidebar-button {
|
79
|
+
display: block;
|
80
|
+
z-index: 2;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
/*****************************************************************************/
|
85
|
+
/*
|
86
|
+
/* Sidebar responsive animations
|
87
|
+
/*
|
88
|
+
/*****************************************************************************/
|
89
|
+
|
90
|
+
.slideIn {
|
91
|
+
margin-left: 0%;
|
92
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
.highlight { background: #ffffff; }
|
2
|
+
.highlight .c { color: #999988; font-style: italic } /* Comment */
|
3
|
+
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
4
|
+
.highlight .k { font-weight: bold } /* Keyword */
|
5
|
+
.highlight .o { font-weight: bold } /* Operator */
|
6
|
+
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
|
7
|
+
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
|
8
|
+
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
|
9
|
+
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
|
10
|
+
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
|
11
|
+
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
|
12
|
+
.highlight .ge { font-style: italic } /* Generic.Emph */
|
13
|
+
.highlight .gr { color: #aa0000 } /* Generic.Error */
|
14
|
+
.highlight .gh { color: #999999 } /* Generic.Heading */
|
15
|
+
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
|
16
|
+
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
|
17
|
+
.highlight .go { color: #888888 } /* Generic.Output */
|
18
|
+
.highlight .gp { color: #555555 } /* Generic.Prompt */
|
19
|
+
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
20
|
+
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
|
21
|
+
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
|
22
|
+
.highlight .kc { font-weight: bold } /* Keyword.Constant */
|
23
|
+
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
|
24
|
+
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
|
25
|
+
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
|
26
|
+
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
|
27
|
+
.highlight .m { color: #009999 } /* Literal.Number */
|
28
|
+
.highlight .s { color: #d14 } /* Literal.String */
|
29
|
+
.highlight .na { color: #008080 } /* Name.Attribute */
|
30
|
+
.highlight .nb { color: #0086B3 } /* Name.Builtin */
|
31
|
+
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
|
32
|
+
.highlight .no { color: #008080 } /* Name.Constant */
|
33
|
+
.highlight .ni { color: #800080 } /* Name.Entity */
|
34
|
+
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
|
35
|
+
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
|
36
|
+
.highlight .nn { color: #555555 } /* Name.Namespace */
|
37
|
+
.highlight .nt { color: #000080 } /* Name.Tag */
|
38
|
+
.highlight .nv { color: #008080 } /* Name.Variable */
|
39
|
+
.highlight .ow { font-weight: bold } /* Operator.Word */
|
40
|
+
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
41
|
+
.highlight .mf { color: #009999 } /* Literal.Number.Float */
|
42
|
+
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
|
43
|
+
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
|
44
|
+
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
|
45
|
+
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
|
46
|
+
.highlight .sc { color: #d14 } /* Literal.String.Char */
|
47
|
+
.highlight .sd { color: #d14 } /* Literal.String.Doc */
|
48
|
+
.highlight .s2 { color: #d14 } /* Literal.String.Double */
|
49
|
+
.highlight .se { color: #d14 } /* Literal.String.Escape */
|
50
|
+
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
|
51
|
+
.highlight .si { color: #d14 } /* Literal.String.Interpol */
|
52
|
+
.highlight .sx { color: #d14 } /* Literal.String.Other */
|
53
|
+
.highlight .sr { color: #009926 } /* Literal.String.Regex */
|
54
|
+
.highlight .s1 { color: #d14 } /* Literal.String.Single */
|
55
|
+
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
|
56
|
+
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
|
57
|
+
.highlight .vc { color: #008080 } /* Name.Variable.Class */
|
58
|
+
.highlight .vg { color: #008080 } /* Name.Variable.Global */
|
59
|
+
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
|
60
|
+
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
|
data/example/favicon.ico
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/example/index.html
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
window.onload = function() {
|
2
|
+
var sidebar = document.getElementById("sidebar");
|
3
|
+
var sidebarButton = document.getElementById("sidebar-button");
|
4
|
+
|
5
|
+
function openSidebar(e) {
|
6
|
+
if (sidebar.className.indexOf("slideIn") != -1) {
|
7
|
+
sidebar.className = sidebar.className.replace(" slideIn", "");
|
8
|
+
} else {
|
9
|
+
sidebar.className = sidebar.className + " slideIn";
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
sidebarButton.addEventListener("click", openSidebar, false);
|
14
|
+
};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll/multiple/languages/plugin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jekyll-multiple-languages-plugin"
|
8
|
+
spec.version = Jekyll::Multiple::Languages::Plugin::VERSION
|
9
|
+
spec.authors = ["Martin Kurtsson"]
|
10
|
+
spec.email = ["martin.kurtsson@screeninteraction.com"]
|
11
|
+
spec.description = %q{I18n plugin for Jekyll}
|
12
|
+
spec.summary = %q{I18n plugin for Jekyll}
|
13
|
+
spec.homepage = "https://github.com/screeninteraction/jekyll-multiple-languages-plugin/"
|
14
|
+
spec.license = "MPL2"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
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.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require "jekyll/multiple/languages/plugin/version"
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
class Site
|
5
|
+
alias :process_org :process
|
6
|
+
def process
|
7
|
+
#Variables
|
8
|
+
self.config['baseurl_root'] = self.config['baseurl']
|
9
|
+
dest_org = self.dest
|
10
|
+
baseurl_org = self.baseurl
|
11
|
+
languages = self.config['languages']
|
12
|
+
|
13
|
+
#Loop
|
14
|
+
self.config['lang'] = languages.first
|
15
|
+
puts
|
16
|
+
puts "Building site for default language: \"#{self.config['lang']}\" to: " + self.dest
|
17
|
+
process_org
|
18
|
+
languages.drop(1).each do |lang|
|
19
|
+
|
20
|
+
# Build site for language lang
|
21
|
+
self.dest = self.dest + "/" + lang
|
22
|
+
self.baseurl = self.baseurl + "/" + lang
|
23
|
+
self.config['baseurl'] = self.baseurl
|
24
|
+
self.config['lang'] = lang
|
25
|
+
puts "Building site for language: \"#{self.config['lang']}\" to: " + self.dest
|
26
|
+
process_org
|
27
|
+
|
28
|
+
#Reset variables for next language
|
29
|
+
self.dest = dest_org
|
30
|
+
self.baseurl = baseurl_org
|
31
|
+
self.config['baseurl'] = baseurl_org
|
32
|
+
end
|
33
|
+
puts 'Build complete'
|
34
|
+
end
|
35
|
+
|
36
|
+
alias :read_posts_org :read_posts
|
37
|
+
def read_posts(dir)
|
38
|
+
if dir == ''
|
39
|
+
posts = read_things("_i18n/#{self.config['lang']}","_posts", Post)
|
40
|
+
posts.each do |post|
|
41
|
+
post.categories = []
|
42
|
+
if post.date != ''
|
43
|
+
if post.published && (self.future || post.date <= self.time)
|
44
|
+
aggregate_post_info(post)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
else
|
49
|
+
read_posts_org(dir)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class LocalizeInclude < Jekyll::Tags::IncludeTag
|
55
|
+
def render(context)
|
56
|
+
if "#{context[@file]}" != "" #Check for page variable
|
57
|
+
file = "#{context[@file]}"
|
58
|
+
else
|
59
|
+
file = @file
|
60
|
+
end
|
61
|
+
|
62
|
+
includes_dir = File.join(context.registers[:site].source, '_i18n/' + context.registers[:site].config['lang'])
|
63
|
+
|
64
|
+
if File.symlink?(includes_dir)
|
65
|
+
return "Includes directory '#{includes_dir}' cannot be a symlink"
|
66
|
+
end
|
67
|
+
if file !~ /^[a-zA-Z0-9_\/\.-]+$/ || file =~ /\.\// || file =~ /\/\./
|
68
|
+
return "Include file '#{file}' contains invalid characters or sequences"
|
69
|
+
end
|
70
|
+
|
71
|
+
Dir.chdir(includes_dir) do
|
72
|
+
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
73
|
+
if choices.include?(file)
|
74
|
+
source = File.read(file)
|
75
|
+
partial = Liquid::Template.parse(source)
|
76
|
+
|
77
|
+
context.stack do
|
78
|
+
context['include'] = parse_params(context) if @params
|
79
|
+
contents = partial.render(context)
|
80
|
+
site = context.registers[:site]
|
81
|
+
ext = File.extname(file)
|
82
|
+
|
83
|
+
converter = site.converters.find { |c| c.matches(ext) }
|
84
|
+
contents = converter.convert(contents) unless converter.nil?
|
85
|
+
|
86
|
+
contents
|
87
|
+
end
|
88
|
+
else
|
89
|
+
"Included file '#{file}' not found in #{includes_dir} directory"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class LocalizeTag < Liquid::Tag
|
96
|
+
|
97
|
+
def initialize(tag_name, key, tokens)
|
98
|
+
super
|
99
|
+
@key = key.strip
|
100
|
+
end
|
101
|
+
|
102
|
+
def render(context)
|
103
|
+
if "#{context[@key]}" != "" #Check for page variable
|
104
|
+
key = "#{context[@key]}"
|
105
|
+
else
|
106
|
+
key = @key
|
107
|
+
end
|
108
|
+
lang = context.registers[:site].config['lang']
|
109
|
+
candidate = YAML.load_file(context.registers[:site].source + "/_i18n/#{lang}.yml")
|
110
|
+
path = key.split(/\./) if key.is_a?(String)
|
111
|
+
while !path.empty?
|
112
|
+
key = path.shift
|
113
|
+
if candidate[key]
|
114
|
+
candidate = candidate[key]
|
115
|
+
else
|
116
|
+
candidate = ""
|
117
|
+
end
|
118
|
+
end
|
119
|
+
if candidate == ""
|
120
|
+
puts "Missing i18n key: " + lang + ":" + key
|
121
|
+
"*" + lang + ":" + key + "*"
|
122
|
+
else
|
123
|
+
candidate
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
Liquid::Template.register_tag('t', Jekyll::LocalizeTag)
|
130
|
+
Liquid::Template.register_tag('tf', Jekyll::LocalizeInclude)
|
131
|
+
Liquid::Template.register_tag('translate', Jekyll::LocalizeTag)
|
132
|
+
Liquid::Template.register_tag('translate_file', Jekyll::LocalizeInclude)
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-multiple-languages-plugin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martin Kurtsson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-03 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
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
|
+
description: I18n plugin for Jekyll
|
42
|
+
email:
|
43
|
+
- martin.kurtsson@screeninteraction.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- example/Gemfile
|
54
|
+
- example/LICENSE
|
55
|
+
- example/README.md
|
56
|
+
- example/_config.yml
|
57
|
+
- example/_i18n/en.yml
|
58
|
+
- example/_i18n/en/_posts/2013-12-09-example-post.md
|
59
|
+
- example/_i18n/es.yml
|
60
|
+
- example/_i18n/es/_posts/2013-12-09-example-post.md
|
61
|
+
- example/_i18n/it.yml
|
62
|
+
- example/_i18n/it/_posts/2013-12-09-example-post.md
|
63
|
+
- example/_includes/post.html
|
64
|
+
- example/_layouts/default.html
|
65
|
+
- example/_layouts/post.html
|
66
|
+
- example/_plugins/jekyll-multiple-languages-plugin.rb
|
67
|
+
- example/css/main.css
|
68
|
+
- example/css/responsive.css
|
69
|
+
- example/css/syntax.css
|
70
|
+
- example/favicon.ico
|
71
|
+
- example/images/cover.jpg
|
72
|
+
- example/images/logo.png
|
73
|
+
- example/images/sidebar-button.png
|
74
|
+
- example/index.html
|
75
|
+
- example/scripts/responsive.js
|
76
|
+
- jekyll-multiple-languages-plugin.gemspec
|
77
|
+
- lib/jekyll/multiple/languages/plugin.rb
|
78
|
+
- lib/jekyll/multiple/languages/plugin/version.rb
|
79
|
+
homepage: https://github.com/screeninteraction/jekyll-multiple-languages-plugin/
|
80
|
+
licenses:
|
81
|
+
- MPL2
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.1.11
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: I18n plugin for Jekyll
|
103
|
+
test_files: []
|