jekyll-widgets 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 719023f799b092dca3af60e9f140782327943202
4
+ data.tar.gz: adf8da15c56531f7f7402c55ede62fc88b3b01cb
5
+ SHA512:
6
+ metadata.gz: 3c4d4f02a3ccf923c7d2cc4d23e919842374908e1dfb090e9dc166d54dfbfd608231e3c7bebc2be7316a7a13b920032ccc405985e59b439f1e83a94455f39b16
7
+ data.tar.gz: 9409ed13b558c8240a96c65c378cff663cc39613aac4fc18946507bfcfa3204da32c1c20bf82797ba507b9375f2ef1233d1c69c34f68ec8393588a2aeb7da297
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ inherit_gem:
2
+ jekyll: .rubocop.yml
3
+
4
+ Metrics/LineLength:
5
+ Exclude:
6
+ - jekyll-widgets.gemspec
7
+
8
+ Style/Documentation:
9
+ Enabled: false
10
+
11
+ Style/FileName:
12
+ Enabled: false
13
+
14
+ AllCops:
15
+ Exclude:
16
+ - vendor/**/*
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 2.2.3
3
+ before_install: gem install bundler
4
+ language: ruby
5
+ script: script/cibuild
6
+ sudo: false
7
+ cache: bundler
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+ require 'json'
3
+ require 'open-uri'
4
+
5
+ gemspec
6
+
7
+ group :development, :test do
8
+ versions = JSON.parse(open('https://pages.github.com/versions.json').read)
9
+ versions.delete('ruby')
10
+ versions.delete('github-pages')
11
+ versions.delete('jekyll') # Remove this line when GitHub Pages supports 3.3.0
12
+
13
+ versions.each do |dep, version|
14
+ gem dep, version
15
+ end
16
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ben Balter
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Jekyll Widgets
2
+
3
+ A set of useful widgets for jekyll sites.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/jekyll-widgets.svg)](https://badge.fury.io/rb/jekyll-widgets) [![Build Status](https://travis-ci.org/abeMedia/jekyll-widgets.svg)](https://travis-ci.org/abemedia/jekyll-widgets)
6
+
7
+ ## What it does
8
+
9
+ Jekyll Widgets is a collection of snippets for common hosted apps & widgets such as facebook comments or Google Analytics.
10
+
11
+ ## Installation
12
+
13
+ 1. Add the following to your site's `Gemfile`:
14
+
15
+ ```ruby
16
+ gem 'jekyll-widgets'
17
+ ```
18
+
19
+ 2. Add the following to your site's `_config.yml`:
20
+
21
+ ```yml
22
+ gems:
23
+ - jekyll-widgets
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ Jekyll Widgets contains a number of different widgets, all with their own configuration parameters.
29
+ The general syntax is as follows:
30
+
31
+ ```liquid
32
+ {% widget widget-name param1="var1" param2="var2" %}
33
+ ```
34
+
35
+ You can use liquid variables too, even passing all params as a single hash.
36
+
37
+ Consider the following example:
38
+
39
+ ```liquid
40
+ ---
41
+ provider: piwik
42
+ options:
43
+ baseurl: //example.com
44
+ site_id: 123
45
+ ---
46
+ {% widget {{page.provider}} params=page.options %}
47
+ ```
48
+
49
+ Is the same as:
50
+
51
+ ```liquid
52
+ {% widget piwik site_id=123 baseurl="//example.com" %}
53
+ ```
54
+
55
+ ## Available Widgets
56
+
57
+ ### Analytics
58
+
59
+ #### Google Analytics
60
+
61
+ ```liquid
62
+ {% widget google_analytics tracking_id=GOOGLE_ANALYTICS_TRACKING_ID %}
63
+ ```
64
+
65
+ #### GetClicky
66
+
67
+ ```liquid
68
+ {% widget getclicky site_id=GETCLICKY_SITE_ID %}
69
+ ```
70
+
71
+ #### Mixpanel
72
+
73
+ ```liquid
74
+ {% widget mixpanel token=MIXPANEL_TOKEN %}
75
+ ```
76
+
77
+ #### Piwik
78
+
79
+ ```liquid
80
+ {% widget piwik site_id=PIWIK_SITE_ID baseurl="//yoursite.com" %}
81
+ ```
82
+
83
+ ### Comments
84
+
85
+ #### Disqus
86
+
87
+ ```liquid
88
+ {% widget disqus shortname=DISQUS_SHORTNAME %}
89
+ ```
90
+
91
+ #### Facebook Comments
92
+
93
+ ```liquid
94
+ {% widget facebook_comments appid=YOUR_FACEBOOK_APP_ID num_posts=5 width=500 colorscheme="dark" %}
95
+ ```
96
+
97
+ #### IntenseDebate
98
+
99
+ ```liquid
100
+ {% widget intensedebate account=YOUR_INTENSEDEBATE_ACCOUNT %}
101
+ ```
102
+
103
+ #### Livefyre
104
+
105
+ ```liquid
106
+ {% widget livefyre site_id=YOUR_LIVEFYRE_SITE_ID %}
107
+ ```
108
+
109
+ ### Share Buttons
110
+
111
+ #### DonReach
112
+
113
+ ```liquid
114
+ {% widget donshare providers="facebook,twitter,google,linkedin,pinterest" %}
115
+ ```
@@ -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 'jekyll/widgets/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'jekyll-widgets'
8
+ spec.version = Jekyll::Widgets::VERSION
9
+ spec.authors = ['Adam Bouqdib']
10
+ spec.email = ['adam@abemedia.co.uk']
11
+ spec.summary = "A set of useful widgets for jekyll sites."
12
+ spec.homepage = 'https://github.com/abemedia/jekyll-widgets'
13
+ spec.license = 'MIT'
14
+
15
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
16
+ # delete this section to allow pushing this gem to any host.
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
+ else
20
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
21
+ end
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = 'exe'
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_dependency 'jekyll', '~> 3.3'
29
+ spec.add_development_dependency 'bundler', '~> 1.10'
30
+ spec.add_development_dependency 'rubocop', '~> 0.37'
31
+ end
@@ -0,0 +1,8 @@
1
+ <div id="disqus_thread"></div>
2
+ <script type="text/javascript">
3
+ (function() {
4
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
5
+ dsq.src = '//{{ include.shortname }}.disqus.com/embed.js';
6
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
7
+ })();
8
+ </script>
@@ -0,0 +1,16 @@
1
+ <div class="don-share" data-style="{{ include.style }}" data-bubbles="{{ include.bubbles }}" data-limit="{{ include.limit }}">
2
+ <div class="don-share-total"></div>
3
+ {% assign providers = include.providers | split: "," %}
4
+ {% for provider in providers %}
5
+ {% assign provider = provider | trim %}
6
+ <div class="don-share-{{ provider }}"></div>
7
+ {% endfor %}
8
+ </div>
9
+ <script type="text/javascript">
10
+ (function() {
11
+ var dr = document.createElement('script');
12
+ dr.type = 'text/javascript'; dr.async = true;
13
+ dr.src = '//share.donreach.com/buttons.js';
14
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dr);
15
+ })();
16
+ </script>
@@ -0,0 +1,9 @@
1
+ <div id="fb-root"></div>
2
+ <script>(function(d, s, id) {
3
+ var js, fjs = d.getElementsByTagName(s)[0];
4
+ if (d.getElementById(id)) return;
5
+ js = d.createElement(s); js.id = id;
6
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId={{ include.appid }}";
7
+ fjs.parentNode.insertBefore(js, fjs);
8
+ }(document, 'script', 'facebook-jssdk'));</script>
9
+ <div class="fb-comments" data-href="{{ site.url }}" data-num-posts="{{ include.num_posts }}" data-width="{{ include.width }}" data-colorscheme="{{ include.colorscheme }}"></div>
@@ -0,0 +1,12 @@
1
+ <script type="text/javascript">
2
+ var clicky_site_ids = clicky_site_ids || [];
3
+ clicky_site_ids.push({{ include.site_id }});
4
+ (function() {
5
+ var s = document.createElement('script');
6
+ s.type = 'text/javascript';
7
+ s.async = true;
8
+ s.src = '//static.getclicky.com/js';
9
+ ( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
10
+ })();
11
+ </script>
12
+ <noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/{{ include.site_id }}ns.gif" /></p></noscript>
@@ -0,0 +1,9 @@
1
+ <script>
2
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
3
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
4
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
5
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
6
+
7
+ ga('create', '{{ include.tracking_id }}', 'auto');
8
+ ga('send', 'pageview');
9
+ </script>
@@ -0,0 +1,6 @@
1
+ <script>
2
+ var idcomments_acct = '{{ include.account }}';
3
+ var idcomments_post_id;
4
+ var idcomments_post_url;
5
+ </script>
6
+ <script type="text/javascript" src="//www.intensedebate.com/js/genericLinkWrapperV2.js"></script>
@@ -0,0 +1,6 @@
1
+ <script type='text/javascript' src='//zor.livefyre.com/wjs/v1.0/javascripts/livefyre_init.js'></script>
2
+ <script type='text/javascript'>
3
+ var fyre = LF({
4
+ site_id: {{ include.site_id }}
5
+ });
6
+ </script>
@@ -0,0 +1,11 @@
1
+ <script type="text/javascript">
2
+ var mpq = [];
3
+ mpq.push(["init", "{{ include.token}}"]);
4
+ (function(){var b,a,e,d,c;b=document.createElement("script");b.type="text/javascript";
5
+ b.async=true;b.src=(document.location.protocol==="https:"?"https:":"http:")+
6
+ "//api.mixpanel.com/site_media/js/api/mixpanel.js";a=document.getElementsByTagName("script")[0];
7
+ a.parentNode.insertBefore(b,a);e=function(f){return function(){mpq.push(
8
+ [f].concat(Array.prototype.slice.call(arguments,0)))}};d=["init","track","track_links",
9
+ "track_forms","register","register_once","identify","name_tag","set_config"];for(c=0;c<
10
+ d.length;c++){mpq[d[c]]=e(d[c])}})();
11
+ </script>
@@ -0,0 +1,11 @@
1
+ <script type="text/javascript">
2
+ document.write(unescape("%3Cscript src='{{ include.baseurl }}/piwik.js' type='text/javascript'%3E%3C/script%3E"));
3
+ </script>
4
+ <script type="text/javascript">
5
+ try {
6
+ var piwikTracker = Piwik.getTracker("{{ include.baseurl }}/piwik.php", {{ include.site_id }});
7
+ piwikTracker.trackPageView();
8
+ piwikTracker.enableLinkTracking();
9
+ } catch( err ) {}
10
+ </script>
11
+ <noscript><p><img src="{{ include.baseurl }}/piwik.php?idsite={{ include.site_id }}" style="border:0" alt="" /></p></noscript>
@@ -0,0 +1,9 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2016 - MIT License
3
+ # Encoding: utf-8
4
+
5
+ module Jekyll
6
+ module Widgets
7
+ VERSION="0.1.1".freeze
8
+ end
9
+ end
@@ -0,0 +1,40 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2016 - MIT License
3
+ # Encoding: utf-8
4
+
5
+ module Jekyll
6
+ module Tags
7
+ class Widgets < Jekyll::Tags::IncludeTag
8
+ def initialize(tag_name, markup, tokens)
9
+ super
10
+ @widget = @file
11
+ @file += ".html"
12
+ end
13
+
14
+ def parse_params(context)
15
+ params = super(context)
16
+ if params.key?("params")
17
+ p = params.delete("params")
18
+ Jekyll::Utils.deep_merge_hashes!(params, p)
19
+ end
20
+ params
21
+ end
22
+
23
+ def locate_include_file(_context, file, _safe)
24
+ path = File.join(widget_path, file)
25
+ return path if File.exist?(path)
26
+ raise IOError, "Widget not found: '#{@widget}'. "\
27
+ "For a full list of available widgets visit "\
28
+ "https://github.com/abemedia/jekyll-widgets."
29
+ end
30
+
31
+ def widget_path
32
+ @widget_path ||= begin
33
+ File.expand_path "./jekyll/widgets/html", File.dirname(__FILE__)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ Liquid::Template.register_tag("widget", Jekyll::Tags::Widgets)
data/script/bootstrap ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ set -ex
4
+
5
+ bundle install
data/script/cibuild ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+
3
+ set -ex
4
+
5
+ bundle exec rubocop -S -D
6
+ bundle exec gem build jekyll-widgets.gemspec
data/script/release ADDED
@@ -0,0 +1,38 @@
1
+ #!/bin/sh
2
+ # Tag and push a release.
3
+
4
+ set -e
5
+
6
+ # Make sure we're in the project root.
7
+
8
+ cd $(dirname "$0")/..
9
+
10
+ # Build a new gem archive.
11
+
12
+ rm -rf jekyll-widgets-*.gem
13
+ gem build -q jekyll-widgets.gemspec
14
+
15
+ # Make sure we're on the master branch.
16
+
17
+ (git branch | grep -q '* master') || {
18
+ echo "Only release from the master branch."
19
+ exit 1
20
+ }
21
+
22
+ # Figure out what version we're releasing.
23
+
24
+ tag=v`ls jekyll-widgets-*.gem | sed 's/^jekyll-widgets-\(.*\)\.gem$/\1/'`
25
+
26
+ # Make sure we haven't released this version before.
27
+
28
+ git fetch -t origin
29
+
30
+ (git tag -l | grep -q "$tag") && {
31
+ echo "Whoops, there's already a '${tag}' tag."
32
+ exit 1
33
+ }
34
+
35
+ # Tag it and bag it.
36
+
37
+ gem push jekyll-widgets-*.gem && git tag "$tag" &&
38
+ git push origin master && git push origin "$tag"
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-widgets
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Adam Bouqdib
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.37'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.37'
55
+ description:
56
+ email:
57
+ - adam@abemedia.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rubocop.yml"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - LICENSE
67
+ - README.md
68
+ - jekyll-widgets.gemspec
69
+ - lib/jekyll-widgets.rb
70
+ - lib/jekyll/widgets/html/disqus.html
71
+ - lib/jekyll/widgets/html/donshare.html
72
+ - lib/jekyll/widgets/html/facebook_comments.html
73
+ - lib/jekyll/widgets/html/getclicky.html
74
+ - lib/jekyll/widgets/html/google_analytics.html
75
+ - lib/jekyll/widgets/html/intensedebate.html
76
+ - lib/jekyll/widgets/html/livefyre.html
77
+ - lib/jekyll/widgets/html/mixpanel.html
78
+ - lib/jekyll/widgets/html/piwik.html
79
+ - lib/jekyll/widgets/version.rb
80
+ - script/bootstrap
81
+ - script/cibuild
82
+ - script/release
83
+ homepage: https://github.com/abemedia/jekyll-widgets
84
+ licenses:
85
+ - MIT
86
+ metadata:
87
+ allowed_push_host: https://rubygems.org
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.5.1
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: A set of useful widgets for jekyll sites.
108
+ test_files: []