jekyll-amp 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0227f7221c176e4147a4de9eb0e33d1ec05e9226
4
+ data.tar.gz: 902b2ebcbdda0c32b7df478d68e1ecfaa08403c2
5
+ SHA512:
6
+ metadata.gz: 3a5650bbad5649b5c8898fd27c2773f15bfca94695575cd30c2905e203326d03b5b436760f589cc4605c7e92731b55d1827c507b12e533ca5d1bafd8ef78b957
7
+ data.tar.gz: a090b5c8ae6032956a54750d3487dde2f085b9d6978df0ce9d2faba2ccaa3fbf751f6223a89f1991d2f1d46079af7087216d9380474aa9252bc7976e7b943312
@@ -0,0 +1,14 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+ /.bundle/
13
+ /vendor/bundle
14
+ /lib/bundler/man/
@@ -0,0 +1 @@
1
+ jekyll-amp
@@ -0,0 +1 @@
1
+ 2.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll-amp (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.5.0)
10
+ public_suffix (~> 2.0, >= 2.0.2)
11
+ colorator (1.1.0)
12
+ ffi (1.9.17)
13
+ forwardable-extended (2.6.0)
14
+ jekyll (3.4.0)
15
+ addressable (~> 2.4)
16
+ colorator (~> 1.0)
17
+ jekyll-sass-converter (~> 1.0)
18
+ jekyll-watch (~> 1.1)
19
+ kramdown (~> 1.3)
20
+ liquid (~> 3.0)
21
+ mercenary (~> 0.3.3)
22
+ pathutil (~> 0.9)
23
+ rouge (~> 1.7)
24
+ safe_yaml (~> 1.0)
25
+ jekyll-sass-converter (1.5.0)
26
+ sass (~> 3.4)
27
+ jekyll-watch (1.5.0)
28
+ listen (~> 3.0, < 3.1)
29
+ kramdown (1.13.2)
30
+ liquid (3.0.6)
31
+ listen (3.0.8)
32
+ rb-fsevent (~> 0.9, >= 0.9.4)
33
+ rb-inotify (~> 0.9, >= 0.9.7)
34
+ mercenary (0.3.6)
35
+ pathutil (0.14.0)
36
+ forwardable-extended (~> 2.6)
37
+ public_suffix (2.0.5)
38
+ rake (10.5.0)
39
+ rb-fsevent (0.9.8)
40
+ rb-inotify (0.9.8)
41
+ ffi (>= 0.5.0)
42
+ rouge (1.11.1)
43
+ safe_yaml (1.0.4)
44
+ sass (3.4.23)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 1.10)
51
+ jekyll (>= 3.0)
52
+ jekyll-amp!
53
+ rake (~> 10.0)
54
+
55
+ BUNDLED WITH
56
+ 1.14.3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Baptiste Lecocq
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,35 @@
1
+ # Jekyll AMP
2
+
3
+ Amp Generator for Jekyll
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'jekyll-amp'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install jekyll-amp
18
+
19
+ ## Usage
20
+
21
+ ### Configuration
22
+
23
+ Edit `_config.yml` and add:
24
+
25
+ ```yml
26
+ gems: [jekyll-amp]
27
+ ```
28
+
29
+ ## Contributing
30
+
31
+ 1. [Fork it](http://github.com/tiste/jekyll-amp/fork)
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -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-amp/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'jekyll-amp'
8
+ spec.version = Jekyll::Amp::VERSION
9
+ spec.authors = ['Baptiste Lecocq']
10
+ spec.email = ['hello@tiste.io']
11
+ spec.summary = %q{Amp Generator for Jekyll}
12
+ spec.description = %q{}
13
+ spec.homepage = 'https://github.com/tiste/jekyll-amp'
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.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.10'
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'jekyll', '>= 3.0'
23
+ end
@@ -0,0 +1,43 @@
1
+ require 'jekyll-amp/version'
2
+
3
+ module Jekyll
4
+ class AmpPost < Page
5
+ def initialize(site, dir, post, name = 'index.html')
6
+ @site = site
7
+ @base = site.source
8
+ @dir = dir
9
+ @name = name
10
+
11
+ self.process(@name)
12
+ self.read_yaml(File.join(site.source, '_layouts'), 'amp.html')
13
+ self.content = post.content
14
+ self.data['body'] = (Liquid::Template.parse post.content).render site.site_payload
15
+
16
+ # Merge all data from post so that keys from self.data have higher priority
17
+ self.data = post.data.merge(self.data)
18
+
19
+ self.data.delete('excerpt')
20
+ self.data['canonical_url'] = post.url
21
+ end
22
+ end
23
+
24
+ class AmpGenerator < Generator
25
+ safe true
26
+ priority :low
27
+
28
+ def generate(site)
29
+ dir = site.config['ampdir'] || 'amp'
30
+ pages = site.pages.dup
31
+
32
+ site.posts.docs.each do |post|
33
+ next if post.data['skip_amp'] == true
34
+ site.pages << AmpPost.new(site, File.join(dir, post.id), post)
35
+ end
36
+
37
+ pages.each do |page|
38
+ next if page.data['skip_amp'] == true
39
+ site.pages << AmpPost.new(site, File.join(dir), page, page.name)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Amp
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-amp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Baptiste Lecocq
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-30 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: jekyll
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: ''
56
+ email:
57
+ - hello@tiste.io
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".ruby-gemset"
64
+ - ".ruby-version"
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE
68
+ - README.md
69
+ - Rakefile
70
+ - jekyll-amp.gemspec
71
+ - lib/jekyll-amp.rb
72
+ - lib/jekyll-amp/version.rb
73
+ homepage: https://github.com/tiste/jekyll-amp
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.4.6
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Amp Generator for Jekyll
97
+ test_files: []